<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[183936] trunk</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/183936">183936</a></dd>
<dt>Author</dt> <dd>mrobinson@webkit.org</dd>
<dt>Date</dt> <dd>2015-05-07 11:24:31 -0700 (Thu, 07 May 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>[GTK] All spell checking layout tests fail
https://bugs.webkit.org/show_bug.cgi?id=144648

Reviewed by Carlos Garcia Campos.

Source/WebKit2:

Simplify and complete the GTK+ spell-checking implementation. Instead of using
the EFL/GTK+ only WKTextChecker interface, directly implement Enchant spell-checking
in TextCheckerGtk. The per-context spell checking API is an illusion, since all
WKTextChecker implementations will adjust the same singleton. This can be a first step
toward removing it entirely.

Also complete the implementation of the TextChecker interface by duplicating the EFL code,
which reuses other methods in the same class. Eventually this duplication will collapse,
once GTK+ and EFL can share an Enchant implementation.

* PlatformGTK.cmake:
* UIProcess/API/gtk/WebKitPrivate.h:
* UIProcess/API/gtk/WebKitTextChecker.cpp: Removed.
* UIProcess/API/gtk/WebKitTextChecker.h: Removed.
* UIProcess/API/gtk/WebKitWebContext.cpp: Remove WebTextChecker usage and
replace it with calls directly to the TextChecker singleton via static methods.
* UIProcess/TextChecker.h:
* UIProcess/gtk/TextCheckerGtk.cpp: Move the WebTextChecker enchant implementation
here and reuse the EFL version of WebKit::TextChecker::requestCheckingOfString.
Also initialize languages properly when building for developer builds. This
allows WebKitTestRunner to work even when it doesn't explicitly set the languages.

Source/WTF:

* wtf/Platform.h: Activate UNIFIED_TEXT_CHECKING for GTK+.

LayoutTests:

* platform/gtk/TestExpectations: Unskip and reclassify previously failing tests.
* platform/gtk/editing/spelling/spellcheck-paste-expected.txt: Removed.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsplatformgtkTestExpectations">trunk/LayoutTests/platform/gtk/TestExpectations</a></li>
<li><a href="#trunkSourceWTFChangeLog">trunk/Source/WTF/ChangeLog</a></li>
<li><a href="#trunkSourceWTFwtfPlatformh">trunk/Source/WTF/wtf/Platform.h</a></li>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2PlatformGTKcmake">trunk/Source/WebKit2/PlatformGTK.cmake</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPIgtkWebKitPrivateh">trunk/Source/WebKit2/UIProcess/API/gtk/WebKitPrivate.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPIgtkWebKitWebContextcpp">trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessTextCheckerh">trunk/Source/WebKit2/UIProcess/TextChecker.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessgtkTextCheckerGtkcpp">trunk/Source/WebKit2/UIProcess/gtk/TextCheckerGtk.cpp</a></li>
</ul>

<h3>Removed Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsplatformgtkeditingspellingspellcheckpasteexpectedtxt">trunk/LayoutTests/platform/gtk/editing/spelling/spellcheck-paste-expected.txt</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPIgtkWebKitTextCheckercpp">trunk/Source/WebKit2/UIProcess/API/gtk/WebKitTextChecker.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPIgtkWebKitTextCheckerh">trunk/Source/WebKit2/UIProcess/API/gtk/WebKitTextChecker.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (183935 => 183936)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2015-05-07 18:01:46 UTC (rev 183935)
+++ trunk/LayoutTests/ChangeLog        2015-05-07 18:24:31 UTC (rev 183936)
</span><span class="lines">@@ -1,3 +1,13 @@
</span><ins>+2015-05-07  Martin Robinson  &lt;mrobinson@igalia.com&gt;
+
+        [GTK] All spell checking layout tests fail
+        https://bugs.webkit.org/show_bug.cgi?id=144648
+
+        Reviewed by Carlos Garcia Campos.
+
+        * platform/gtk/TestExpectations: Unskip and reclassify previously failing tests.
+        * platform/gtk/editing/spelling/spellcheck-paste-expected.txt: Removed.
+
</ins><span class="cx"> 2015-05-07  Joanmarie Diggs  &lt;jdiggs@igalia.com&gt;
</span><span class="cx"> 
</span><span class="cx">         AX: [ATK] The pre element should be mapped to ATK_ROLE_SECTION; not ATK_ROLE_PANEL
</span></span></pre></div>
<a id="trunkLayoutTestsplatformgtkTestExpectations"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/gtk/TestExpectations (183935 => 183936)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/gtk/TestExpectations        2015-05-07 18:01:46 UTC (rev 183935)
+++ trunk/LayoutTests/platform/gtk/TestExpectations        2015-05-07 18:24:31 UTC (rev 183936)
</span><span class="lines">@@ -627,11 +627,6 @@
</span><span class="cx"> Bug(GTK) editing/spelling/inline-spelling-markers-hidpi.html [ Skip ]
</span><span class="cx"> Bug(GTK) editing/spelling/markers.html [ Skip ]
</span><span class="cx"> 
</span><del>-# Missing asynchronous spellchecking implementation.
-Bug(GTK) editing/spelling/design-mode-spellcheck-off.html [ Skip ]
-Bug(GTK) editing/spelling/spelling-insert-html.html [ Skip ]
-Bug(GTK) editing/spelling/spelling-hasspellingmarker.html [ Skip ]
-
</del><span class="cx"> # Requires ENABLE(MEDIA_CAPTURE)
</span><span class="cx"> webkit.org/b/85958 fast/forms/file/file-input-capture.html [ Failure ]
</span><span class="cx"> 
</span><span class="lines">@@ -1283,11 +1278,6 @@
</span><span class="cx"> webkit.org/b/122571 inspector-protocol/page/setEmulatedMedia.html [ Timeout Pass ]
</span><span class="cx"> webkit.org/b/122571 inspector-protocol/css/getSupportedCSSProperties.html [ Timeout Pass ]
</span><span class="cx"> 
</span><del>-webkit.org/b/130411 editing/spelling/spellcheck-paste.html [ Timeout ]
-webkit.org/b/130411 editing/spelling/spelling-changed-text.html [ Timeout ]
-webkit.org/b/130411 editing/spelling/spellcheck-paste-disabled.html [ Timeout ]
-webkit.org/b/130411 editing/spelling/spellcheck-paste-continuous-disabled.html [ Timeout ]
-
</del><span class="cx"> Bug(GTK) plugins/reloadplugins-and-pages.html [ Timeout ]
</span><span class="cx"> 
</span><span class="cx"> Bug(GTK) fast/forms/select/menulist-popup-crash.html [ Timeout ]
</span><span class="lines">@@ -1479,26 +1469,6 @@
</span><span class="cx"> webkit.org/b/42194 fast/events/5056619.html [ Failure ]
</span><span class="cx"> webkit.org/b/42194 http/tests/security/drag-drop-same-unique-origin.html [ Failure ]
</span><span class="cx"> 
</span><del>-# Missing TextChecker::requestCheckingOfString() implementation for Gtk.
-webkit.org/b/73003 editing/spelling/delete-into-misspelled-word.html [ Skip ]
-webkit.org/b/73003 editing/spelling/editing-multiple-words-with-markers.html [ Skip ]
-webkit.org/b/73003 editing/spelling/editing-word-with-marker-2.html [ Skip ]
-webkit.org/b/73003 editing/spelling/move-cursor-around-misspelled-word.html [ Skip ]
-webkit.org/b/73003 editing/spelling/spellcheck-async-mutation.html [ Skip ]
-webkit.org/b/73003 editing/spelling/spellcheck-async-remove-frame.html [ Skip ]
-webkit.org/b/73003 editing/spelling/spellcheck-async.html [ Skip ]
-webkit.org/b/73003 editing/spelling/spellcheck-queue.html [ Skip ]
-webkit.org/b/73003 editing/spelling/spellcheck-sequencenum.html [ Skip ]
-webkit.org/b/73003 editing/spelling/spelling-backward.html [ Skip ]
-webkit.org/b/73003 editing/spelling/spelling-marker-description.html [ Skip ]
-
-# Spellcheck tests don't seem to work.
-Bug(GTK) editing/spelling/spelling-backspace-between-lines.html [ Skip ]
-Bug(GTK) editing/spelling/spellcheck-attribute.html [ Skip ]
-Bug(GTK) editing/spelling/spelling-attribute-at-child.html [ Skip ]
-Bug(GTK) editing/spelling/spelling-attribute-change.html [ Skip ]
-Bug(GTK) editing/spelling/spelling-linebreak.html [ Skip ]
-
</del><span class="cx"> # Context menu problems.
</span><span class="cx"> webkit.org/b/120401 fast/events [ Skip ]
</span><span class="cx"> webkit.org/b/120401 editing/selection [ Skip ]
</span><span class="lines">@@ -1581,9 +1551,6 @@
</span><span class="cx"> Bug(GTK) editing/selection/context-menu-text-selection.html [ Failure Pass ]
</span><span class="cx"> Bug(GTK) editing/selection/context-menu-text-selection-lookup.html [ Failure Pass ]
</span><span class="cx"> 
</span><del>-# An oncontextmenu attribute is not called.
-Bug(GTK) editing/spelling/spellcheck-input-search-crash.html [ Failure ]
-
</del><span class="cx"> Bug(GTK) http/tests/misc/iframe-beforeunload-dialog-matching-ancestor-securityorigin.html [ Failure ]
</span><span class="cx"> 
</span><span class="cx"> Bug(GTK) http/tests/misc/will-send-request-returns-null-on-redirect.html [ Failure ]
</span><span class="lines">@@ -1718,9 +1685,6 @@
</span><span class="cx"> # Need to add functionality to DumpRenderTree to handle scrollbar policy changes
</span><span class="cx"> Bug(GTK) fast/overflow/scrollbar-restored-and-then-locked.html [ Failure ]
</span><span class="cx"> 
</span><del>-# DRT doesn't dispatch an event for the second call eventSender.contextClick().
-webkit.org/b/39102 editing/spelling/context-menu-suggestions.html [ Failure ]
-
</del><span class="cx"> # Some input type=range tests fail because of the size
</span><span class="cx"> # of the slider thumb in GTK+ themes.
</span><span class="cx"> Bug(GTK) fast/forms/range/slider-mouse-events.html [ Failure ]
</span><span class="lines">@@ -1800,8 +1764,6 @@
</span><span class="cx"> # Does not render the rectangle as it should, even though the multiple parts seem to work
</span><span class="cx"> webkit.org/b/54251 http/tests/multipart/invalid-image-data.html [ Failure ]
</span><span class="cx"> 
</span><del>-webkit.org/b/72248 editing/spelling/spelling-unified-emulation.html [ Failure ]
-
</del><span class="cx"> webkit.org/b/62204 svg/custom/relative-sized-use-without-attributes-on-symbol.xhtml [ Failure ]
</span><span class="cx"> webkit.org/b/62204 svg/custom/use-on-symbol-inside-pattern.svg [ Failure ]
</span><span class="cx"> webkit.org/b/62204 svg/W3C-SVG-1.1/animate-elem-04-t.svg [ Failure ]
</span><span class="lines">@@ -1909,14 +1871,6 @@
</span><span class="cx"> webkit.org/b/103927 http/tests/w3c/webperf/submission/Google/resource-timing/html/test_resource_initiator_types.html [ Failure ]
</span><span class="cx"> webkit.org/b/103927 http/tests/w3c/webperf/submission/Google/resource-timing/html/test_resource_redirects.html [ Failure ]
</span><span class="cx"> 
</span><del>-# Spellchecker behavior tests.
-webkit.org/b/108370 editing/spelling/context-menu-suggestions-multiword-selection.html [ Skip ]
-webkit.org/b/108370 editing/spelling/context-menu-suggestions-subword-selection.html [ Skip ]
-webkit.org/b/108370 editing/spelling/spelling-double-clicked-word.html [ Skip ]
-webkit.org/b/108370 editing/spelling/spelling-exactly-selected-word.html [ Skip ]
-webkit.org/b/108370 editing/spelling/spelling-with-punctuation-selection.html [ Skip ]
-webkit.org/b/108370 editing/spelling/spelling-with-whitespace-selection.html [ Skip ]
-
</del><span class="cx"> webkit.org/b/107118 fast/canvas/canvas-quadratic-same-endpoint.html [ Failure ]
</span><span class="cx"> 
</span><span class="cx"> webkit.org/b/108973 fast/css/negative-text-indent-in-inline-block.html [ ImageOnlyFailure ]
</span><span class="lines">@@ -2371,6 +2325,14 @@
</span><span class="cx"> 
</span><span class="cx"> webkit.org/b/144673 fast/forms/button-line-height.html [ ImageOnlyFailure ]
</span><span class="cx"> 
</span><ins>+webkit.org/b/144690 editing/spelling/context-menu-suggestions-multiword-selection.html [ Timeout ]
+webkit.org/b/144690 editing/spelling/context-menu-suggestions-subword-selection.html [ Timeout ]
+webkit.org/b/144690 editing/spelling/spelling-exactly-selected-word.html [ Timeout ]
+webkit.org/b/144690 editing/spelling/spelling-with-punctuation-selection.html [ Timeout ]
+webkit.org/b/144690 editing/spelling/context-menu-suggestions.html [ Failure ]
+webkit.org/b/144690 editing/spelling/spelling-double-clicked-word.html [ Failure ]
+webkit.org/b/144690 editing/spelling/delete-into-misspelled-word.html [ Timeout Pass ]
+
</ins><span class="cx"> #////////////////////////////////////////////////////////////////////////////////////////
</span><span class="cx"> # End of Tests failing
</span><span class="cx"> #////////////////////////////////////////////////////////////////////////////////////////
</span></span></pre></div>
<a id="trunkLayoutTestsplatformgtkeditingspellingspellcheckpasteexpectedtxt"></a>
<div class="delfile"><h4>Deleted: trunk/LayoutTests/platform/gtk/editing/spelling/spellcheck-paste-expected.txt (183935 => 183936)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/gtk/editing/spelling/spellcheck-paste-expected.txt        2015-05-07 18:01:46 UTC (rev 183935)
+++ trunk/LayoutTests/platform/gtk/editing/spelling/spellcheck-paste-expected.txt        2015-05-07 18:24:31 UTC (rev 183936)
</span><span class="lines">@@ -1,18 +0,0 @@
</span><del>-For Bug 40092: Spell checking for pasted text.
-
-On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
-
-
-FAIL INPUT should have a marker on 'zz apple'
-FAIL INPUT should have a marker on 'z&lt;b&gt;z appl&lt;/b&gt;e'
-FAIL INPUT should have a marker on 'zz zz zz'
-FAIL TEXTAREA should have a marker on 'zz apple'
-FAIL TEXTAREA should have a marker on 'z&lt;b&gt;z appl&lt;/b&gt;e'
-FAIL TEXTAREA should have a marker on 'zz zz zz'
-FAIL DIV should have a marker on 'zz apple'
-FAIL DIV should have a marker on 'z&lt;b&gt;z appl&lt;/b&gt;e'
-FAIL DIV should have a marker on 'zz zz zz'
-PASS successfullyParsed is true
-
-TEST COMPLETE
-
</del></span></pre></div>
<a id="trunkSourceWTFChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/ChangeLog (183935 => 183936)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/ChangeLog        2015-05-07 18:01:46 UTC (rev 183935)
+++ trunk/Source/WTF/ChangeLog        2015-05-07 18:24:31 UTC (rev 183936)
</span><span class="lines">@@ -1,3 +1,12 @@
</span><ins>+2015-05-07  Martin Robinson  &lt;mrobinson@igalia.com&gt;
+
+        [GTK] All spell checking layout tests fail
+        https://bugs.webkit.org/show_bug.cgi?id=144648
+
+        Reviewed by Carlos Garcia Campos.
+
+        * wtf/Platform.h: Activate UNIFIED_TEXT_CHECKING for GTK+.
+
</ins><span class="cx"> 2015-05-07  Dan Bernstein  &lt;mitz@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         &lt;rdar://problem/19317140&gt; [Xcode] Remove usage of AspenFamily.xcconfig in Source/
</span></span></pre></div>
<a id="trunkSourceWTFwtfPlatformh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/wtf/Platform.h (183935 => 183936)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/wtf/Platform.h        2015-05-07 18:01:46 UTC (rev 183935)
+++ trunk/Source/WTF/wtf/Platform.h        2015-05-07 18:24:31 UTC (rev 183936)
</span><span class="lines">@@ -1052,7 +1052,7 @@
</span><span class="cx"> 
</span><span class="cx"> #define USE_GRAMMAR_CHECKING 1
</span><span class="cx"> 
</span><del>-#if PLATFORM(COCOA) || PLATFORM(EFL)
</del><ins>+#if PLATFORM(COCOA) || PLATFORM(EFL) || PLATFORM(GTK)
</ins><span class="cx"> #define USE_UNIFIED_TEXT_CHECKING 1
</span><span class="cx"> #endif
</span><span class="cx"> #if PLATFORM(MAC)
</span></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (183935 => 183936)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2015-05-07 18:01:46 UTC (rev 183935)
+++ trunk/Source/WebKit2/ChangeLog        2015-05-07 18:24:31 UTC (rev 183936)
</span><span class="lines">@@ -1,3 +1,32 @@
</span><ins>+2015-05-07  Martin Robinson  &lt;mrobinson@igalia.com&gt;
+
+        [GTK] All spell checking layout tests fail
+        https://bugs.webkit.org/show_bug.cgi?id=144648
+
+        Reviewed by Carlos Garcia Campos.
+
+        Simplify and complete the GTK+ spell-checking implementation. Instead of using
+        the EFL/GTK+ only WKTextChecker interface, directly implement Enchant spell-checking
+        in TextCheckerGtk. The per-context spell checking API is an illusion, since all
+        WKTextChecker implementations will adjust the same singleton. This can be a first step
+        toward removing it entirely.
+
+        Also complete the implementation of the TextChecker interface by duplicating the EFL code,
+        which reuses other methods in the same class. Eventually this duplication will collapse,
+        once GTK+ and EFL can share an Enchant implementation.
+
+        * PlatformGTK.cmake:
+        * UIProcess/API/gtk/WebKitPrivate.h:
+        * UIProcess/API/gtk/WebKitTextChecker.cpp: Removed.
+        * UIProcess/API/gtk/WebKitTextChecker.h: Removed.
+        * UIProcess/API/gtk/WebKitWebContext.cpp: Remove WebTextChecker usage and
+        replace it with calls directly to the TextChecker singleton via static methods.
+        * UIProcess/TextChecker.h:
+        * UIProcess/gtk/TextCheckerGtk.cpp: Move the WebTextChecker enchant implementation
+        here and reuse the EFL version of WebKit::TextChecker::requestCheckingOfString.
+        Also initialize languages properly when building for developer builds. This
+        allows WebKitTestRunner to work even when it doesn't explicitly set the languages.
+
</ins><span class="cx"> 2015-05-07  Ada Chan  &lt;adachan@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Fix a couple of cases where the backForwardListState's currentIndex is not set correctly in WebBackForwardList::backForwardListState().
</span></span></pre></div>
<a id="trunkSourceWebKit2PlatformGTKcmake"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/PlatformGTK.cmake (183935 => 183936)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/PlatformGTK.cmake        2015-05-07 18:01:46 UTC (rev 183935)
+++ trunk/Source/WebKit2/PlatformGTK.cmake        2015-05-07 18:24:31 UTC (rev 183936)
</span><span class="lines">@@ -214,8 +214,6 @@
</span><span class="cx">     UIProcess/API/gtk/WebKitSettings.cpp
</span><span class="cx">     UIProcess/API/gtk/WebKitSettings.h
</span><span class="cx">     UIProcess/API/gtk/WebKitSettingsPrivate.h
</span><del>-    UIProcess/API/gtk/WebKitTextChecker.cpp
-    UIProcess/API/gtk/WebKitTextChecker.h
</del><span class="cx">     UIProcess/API/gtk/WebKitUIClient.cpp
</span><span class="cx">     UIProcess/API/gtk/WebKitUIClient.h
</span><span class="cx">     UIProcess/API/gtk/WebKitURIRequest.cpp
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPIgtkWebKitPrivateh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/gtk/WebKitPrivate.h (183935 => 183936)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/gtk/WebKitPrivate.h        2015-05-07 18:01:46 UTC (rev 183935)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/WebKitPrivate.h        2015-05-07 18:24:31 UTC (rev 183936)
</span><span class="lines">@@ -41,7 +41,6 @@
</span><span class="cx"> #include &lt;WebKit/WKSerializedScriptValue.h&gt;
</span><span class="cx"> #include &lt;WebKit/WKSoupCustomProtocolRequestManager.h&gt;
</span><span class="cx"> #include &lt;WebKit/WKString.h&gt;
</span><del>-#include &lt;WebKit/WKTextChecker.h&gt;
</del><span class="cx"> #include &lt;WebKit/WKUserMediaPermissionRequest.h&gt;
</span><span class="cx"> #include &lt;WebKit/WebKit2_C.h&gt;
</span><span class="cx"> #include &lt;glib.h&gt;
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPIgtkWebKitTextCheckercpp"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebKit2/UIProcess/API/gtk/WebKitTextChecker.cpp (183935 => 183936)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/gtk/WebKitTextChecker.cpp        2015-05-07 18:01:46 UTC (rev 183935)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/WebKitTextChecker.cpp        2015-05-07 18:24:31 UTC (rev 183936)
</span><span class="lines">@@ -1,164 +0,0 @@
</span><del>-/*
- * Copyright (C) 2012 Igalia S.L.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include &quot;config.h&quot;
-#include &quot;WebKitTextChecker.h&quot;
-
-#if ENABLE(SPELLCHECK)
-
-#include &quot;WebKitPrivate.h&quot;
-
-using namespace WebKit;
-
-static inline WebKitTextChecker* toTextChecker(const void* clientInfo)
-{
-    return static_cast&lt;WebKitTextChecker*&gt;(const_cast&lt;void*&gt;(clientInfo));
-}
-
-static bool continuousSpellCheckingEnabledCallback(const void* clientInfo)
-{
-    return toTextChecker(clientInfo)-&gt;isSpellCheckingEnabled();
-}
-
-static void setContinuousSpellCheckingEnabledCallback(bool enabled, const void* clientInfo)
-{
-    toTextChecker(clientInfo)-&gt;setSpellCheckingEnabled(enabled);
-}
-
-static void checkSpellingOfStringCallback(uint64_t /* tag */, WKStringRef text, int32_t* misspellingLocation, int32_t* misspellingLength, const void* clientInfo)
-{
-    toTextChecker(clientInfo)-&gt;checkSpellingOfString(toImpl(text)-&gt;string(), *misspellingLocation, *misspellingLength);
-}
-
-static WKArrayRef guessesForWordCallback(uint64_t /* tag */, WKStringRef word, const void* clientInfo)
-{
-    Vector&lt;String&gt; guesses = toTextChecker(clientInfo)-&gt;getGuessesForWord(toImpl(word)-&gt;string());
-    if (guesses.isEmpty())
-        return 0;
-
-    WKMutableArrayRef wkSuggestions = WKMutableArrayCreate();
-    for (Vector&lt;String&gt;::const_iterator iter = guesses.begin(); iter != guesses.end(); ++iter) {
-        WKRetainPtr&lt;WKStringRef&gt; wkSuggestion(AdoptWK, WKStringCreateWithUTF8CString(iter-&gt;utf8().data()));
-        WKArrayAppendItem(wkSuggestions, wkSuggestion.get());
-    }
-
-    return wkSuggestions;
-}
-
-static void learnWordCallback(uint64_t /* tag */, WKStringRef word, const void* clientInfo)
-{
-    toTextChecker(clientInfo)-&gt;learnWord(toImpl(word)-&gt;string());
-}
-
-static void ignoreWordCallback(uint64_t /* tag */, WKStringRef word, const void* clientInfo)
-{
-    toTextChecker(clientInfo)-&gt;ignoreWord(toImpl(word)-&gt;string());
-}
-
-WebKitTextChecker::~WebKitTextChecker()
-{
-}
-
-WebKitTextChecker::WebKitTextChecker()
-    : m_textChecker(std::make_unique&lt;WebCore::TextCheckerEnchant&gt;())
-    , m_spellCheckingEnabled(false)
-{
-    WKTextCheckerClientV0 wkTextCheckerClient = {
-        {
-            0, // version
-            this, // clientInfo
-        },
-        0, // continuousSpellCheckingAllowed
-        continuousSpellCheckingEnabledCallback,
-        setContinuousSpellCheckingEnabledCallback,
-        0, // grammarCheckingEnabled
-        0, // setGrammarCheckingEnabled
-        0, // uniqueSpellDocumentTag
-        0, // closeSpellDocumentWithTag
-        checkSpellingOfStringCallback,
-        0, // checkGrammarOfString
-        0, // spellingUIIsShowing
-        0, // toggleSpellingUIIsShowing
-        0, // updateSpellingUIWithMisspelledWord
-        0, // updateSpellingUIWithGrammarString
-        guessesForWordCallback,
-        learnWordCallback,
-        ignoreWordCallback,
-    };
-    WKTextCheckerSetClient(&amp;wkTextCheckerClient.base);
-}
-
-void WebKitTextChecker::checkSpellingOfString(const String&amp; string, int&amp; misspellingLocation, int&amp; misspellingLength)
-{
-    m_textChecker-&gt;checkSpellingOfString(string, misspellingLocation, misspellingLength);
-}
-
-Vector&lt;String&gt; WebKitTextChecker::getGuessesForWord(const String&amp; word)
-{
-    return m_textChecker-&gt;getGuessesForWord(word);
-}
-
-void WebKitTextChecker::learnWord(const String&amp; word)
-{
-    m_textChecker-&gt;learnWord(word);
-}
-
-void WebKitTextChecker::ignoreWord(const String&amp; word)
-{
-    m_textChecker-&gt;ignoreWord(word);
-}
-
-void WebKitTextChecker::setSpellCheckingEnabled(bool enabled)
-{
-    if (m_spellCheckingEnabled == enabled)
-        return;
-    m_spellCheckingEnabled = enabled;
-
-    // We need to notify the Web process that this has changed.
-    WKTextCheckerContinuousSpellCheckingEnabledStateChanged(enabled);
-}
-
-const char* const* WebKitTextChecker::getSpellCheckingLanguages()
-{
-    Vector&lt;String&gt; spellCheckingLanguages = m_textChecker-&gt;loadedSpellCheckingLanguages();
-    if (spellCheckingLanguages.isEmpty())
-        return 0;
-
-    m_spellCheckingLanguages = adoptGRef(g_ptr_array_new_with_free_func(g_free));
-    for (size_t i = 0; i &lt; spellCheckingLanguages.size(); ++i)
-        g_ptr_array_add(m_spellCheckingLanguages.get(), g_strdup(spellCheckingLanguages[i].utf8().data()));
-    g_ptr_array_add(m_spellCheckingLanguages.get(), 0);
-
-    return reinterpret_cast&lt;char**&gt;(m_spellCheckingLanguages-&gt;pdata);
-}
-
-void WebKitTextChecker::setSpellCheckingLanguages(const char* const* languages)
-{
-    Vector&lt;String&gt; spellCheckingLanguages;
-    for (size_t i = 0; languages[i]; ++i)
-        spellCheckingLanguages.append(String::fromUTF8(languages[i]));
-    m_textChecker-&gt;updateSpellCheckingLanguages(spellCheckingLanguages);
-}
-#endif // ENABLE(SPELLCHECK)
</del></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPIgtkWebKitTextCheckerh"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebKit2/UIProcess/API/gtk/WebKitTextChecker.h (183935 => 183936)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/gtk/WebKitTextChecker.h        2015-05-07 18:01:46 UTC (rev 183935)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/WebKitTextChecker.h        2015-05-07 18:24:31 UTC (rev 183936)
</span><span class="lines">@@ -1,58 +0,0 @@
</span><del>-/*
- * Copyright (C) 2012 Igalia S.L.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB.  If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifndef WebKitTextChecker_h
-#define WebKitTextChecker_h
-
-#if ENABLE(SPELLCHECK)
-
-#include &lt;WebCore/TextCheckerEnchant.h&gt;
-#include &lt;wtf/FastMalloc.h&gt;
-#include &lt;wtf/Vector.h&gt;
-#include &lt;wtf/gobject/GRefPtr.h&gt;
-#include &lt;wtf/text/CString.h&gt;
-
-class WebKitTextChecker {
-    WTF_MAKE_FAST_ALLOCATED;
-
-public:
-    WebKitTextChecker();
-    ~WebKitTextChecker();
-
-    // For implementing TextCheckerClient.
-    bool isSpellCheckingEnabled() { return m_spellCheckingEnabled; }
-    void setSpellCheckingEnabled(bool enabled);
-    void checkSpellingOfString(const String&amp; string, int&amp; misspellingLocation, int&amp; misspellingLength);
-    Vector&lt;String&gt; getGuessesForWord(const String&amp; word);
-    void learnWord(const String&amp; word);
-    void ignoreWord(const String&amp; word);
-
-    // To be called from WebKitWebContext only.
-    const char* const* getSpellCheckingLanguages();
-    void setSpellCheckingLanguages(const char* const* spellCheckingLanguages);
-
-private:
-    std::unique_ptr&lt;WebCore::TextCheckerEnchant&gt; m_textChecker;
-    GRefPtr&lt;GPtrArray&gt; m_spellCheckingLanguages;
-    bool m_spellCheckingEnabled;
-};
-
-#endif // ENABLE(SPELLCHECK)
-
-#endif // WebKitTextChecker_h
</del></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPIgtkWebKitWebContextcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.cpp (183935 => 183936)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.cpp        2015-05-07 18:01:46 UTC (rev 183935)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.cpp        2015-05-07 18:24:31 UTC (rev 183936)
</span><span class="lines">@@ -23,6 +23,8 @@
</span><span class="cx"> #include &quot;APIDownloadClient.h&quot;
</span><span class="cx"> #include &quot;APIProcessPoolConfiguration.h&quot;
</span><span class="cx"> #include &quot;APIString.h&quot;
</span><ins>+#include &quot;TextChecker.h&quot;
+#include &quot;TextCheckerState.h&quot;
</ins><span class="cx"> #include &quot;WebBatteryManagerProxy.h&quot;
</span><span class="cx"> #include &quot;WebCertificateInfo.h&quot;
</span><span class="cx"> #include &quot;WebCookieManagerProxy.h&quot;
</span><span class="lines">@@ -40,7 +42,6 @@
</span><span class="cx"> #include &quot;WebKitRequestManagerClient.h&quot;
</span><span class="cx"> #include &quot;WebKitSecurityManagerPrivate.h&quot;
</span><span class="cx"> #include &quot;WebKitSettingsPrivate.h&quot;
</span><del>-#include &quot;WebKitTextChecker.h&quot;
</del><span class="cx"> #include &quot;WebKitURISchemeRequestPrivate.h&quot;
</span><span class="cx"> #include &quot;WebKitUserContentManagerPrivate.h&quot;
</span><span class="cx"> #include &quot;WebKitWebContextPrivate.h&quot;
</span><span class="lines">@@ -172,9 +173,6 @@
</span><span class="cx"> #if ENABLE(NOTIFICATIONS)
</span><span class="cx">     RefPtr&lt;WebKitNotificationProvider&gt; notificationProvider;
</span><span class="cx"> #endif
</span><del>-#if ENABLE(SPELLCHECK)
-    std::unique_ptr&lt;WebKitTextChecker&gt; textChecker;
-#endif
</del><span class="cx">     CString faviconDatabaseDirectory;
</span><span class="cx">     WebKitTLSErrorsPolicy tlsErrorsPolicy;
</span><span class="cx"> 
</span><span class="lines">@@ -290,9 +288,6 @@
</span><span class="cx"> #if ENABLE(NOTIFICATIONS)
</span><span class="cx">     priv-&gt;notificationProvider = WebKitNotificationProvider::create(priv-&gt;context-&gt;supplement&lt;WebNotificationManagerProxy&gt;());
</span><span class="cx"> #endif
</span><del>-#if ENABLE(SPELLCHECK)
-    priv-&gt;textChecker = std::make_unique&lt;WebKitTextChecker&gt;();
-#endif
</del><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> static void webkitWebContextDispose(GObject* object)
</span><span class="lines">@@ -802,7 +797,7 @@
</span><span class="cx">     g_return_val_if_fail(WEBKIT_IS_WEB_CONTEXT(context), FALSE);
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(SPELLCHECK)
</span><del>-    return context-&gt;priv-&gt;textChecker-&gt;isSpellCheckingEnabled();
</del><ins>+    return TextChecker::state().isContinuousSpellCheckingEnabled;
</ins><span class="cx"> #else
</span><span class="cx">     return false;
</span><span class="cx"> #endif
</span><span class="lines">@@ -820,7 +815,7 @@
</span><span class="cx">     g_return_if_fail(WEBKIT_IS_WEB_CONTEXT(context));
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(SPELLCHECK)
</span><del>-    context-&gt;priv-&gt;textChecker-&gt;setSpellCheckingEnabled(enabled);
</del><ins>+    TextChecker::setContinuousSpellCheckingEnabled(enabled);
</ins><span class="cx"> #endif
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -839,10 +834,20 @@
</span><span class="cx">  */
</span><span class="cx"> const gchar* const* webkit_web_context_get_spell_checking_languages(WebKitWebContext* context)
</span><span class="cx"> {
</span><del>-    g_return_val_if_fail(WEBKIT_IS_WEB_CONTEXT(context), 0);
</del><ins>+    g_return_val_if_fail(WEBKIT_IS_WEB_CONTEXT(context), nullptr);
</ins><span class="cx"> 
</span><span class="cx"> #if ENABLE(SPELLCHECK)
</span><del>-    return context-&gt;priv-&gt;textChecker-&gt;getSpellCheckingLanguages();
</del><ins>+    Vector&lt;String&gt; spellCheckingLanguages = TextChecker::loadedSpellCheckingLanguages();
+    if (spellCheckingLanguages.isEmpty())
+        return nullptr;
+
+    static GRefPtr&lt;GPtrArray&gt; languagesToReturn;
+    languagesToReturn = adoptGRef(g_ptr_array_new_with_free_func(g_free));
+    for (const auto&amp; language : spellCheckingLanguages)
+        g_ptr_array_add(languagesToReturn.get(), g_strdup(language.utf8().data()));
+    g_ptr_array_add(languagesToReturn.get(), nullptr);
+
+    return reinterpret_cast&lt;char**&gt;(languagesToReturn-&gt;pdata);
</ins><span class="cx"> #else
</span><span class="cx">     return 0;
</span><span class="cx"> #endif
</span><span class="lines">@@ -871,7 +876,10 @@
</span><span class="cx">     g_return_if_fail(languages);
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(SPELLCHECK)
</span><del>-    context-&gt;priv-&gt;textChecker-&gt;setSpellCheckingLanguages(languages);
</del><ins>+    Vector&lt;String&gt; spellCheckingLanguages;
+    for (size_t i = 0; languages[i]; ++i)
+        spellCheckingLanguages.append(String::fromUTF8(languages[i]));
+    TextChecker::setSpellCheckingLanguages(spellCheckingLanguages);
</ins><span class="cx"> #endif
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessTextCheckerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/TextChecker.h (183935 => 183936)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/TextChecker.h        2015-05-07 18:01:46 UTC (rev 183935)
+++ trunk/Source/WebKit2/UIProcess/TextChecker.h        2015-05-07 18:24:31 UTC (rev 183936)
</span><span class="lines">@@ -62,6 +62,11 @@
</span><span class="cx">     static void toggleSubstitutionsPanelIsShowing();
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+#if PLATFORM(GTK)
+    static void setSpellCheckingLanguages(const Vector&lt;String&gt;&amp;);
+    static Vector&lt;String&gt; loadedSpellCheckingLanguages();
+#endif
+
</ins><span class="cx">     static void continuousSpellCheckingEnabledStateChanged(bool);
</span><span class="cx">     static void grammarCheckingEnabledStateChanged(bool);
</span><span class="cx">     static int64_t uniqueSpellDocumentTag(WebPageProxy*);
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessgtkTextCheckerGtkcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/gtk/TextCheckerGtk.cpp (183935 => 183936)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/gtk/TextCheckerGtk.cpp        2015-05-07 18:01:46 UTC (rev 183935)
+++ trunk/Source/WebKit2/UIProcess/gtk/TextCheckerGtk.cpp        2015-05-07 18:24:31 UTC (rev 183936)
</span><span class="lines">@@ -1,6 +1,7 @@
</span><span class="cx"> /*
</span><span class="cx">  * Copyright (C) 2010 Apple Inc. All rights reserved.
</span><span class="cx">  * Portions Copyright (c) 2010 Motorola Mobility, Inc.  All rights reserved.
</span><ins>+ * Copyright (C) 2011-2013 Samsung Electronics
</ins><span class="cx">  *
</span><span class="cx">  * Redistribution and use in source and binary forms, with or without
</span><span class="cx">  * modification, are permitted provided that the following conditions
</span><span class="lines">@@ -27,120 +28,227 @@
</span><span class="cx"> #include &quot;config.h&quot;
</span><span class="cx"> #include &quot;TextChecker.h&quot;
</span><span class="cx"> 
</span><ins>+#include &quot;TextBreakIterator.h&quot;
</ins><span class="cx"> #include &quot;TextCheckerState.h&quot;
</span><ins>+#include &quot;WebProcessPool.h&quot;
</ins><span class="cx"> #include &quot;WebTextChecker.h&quot;
</span><span class="cx"> #include &lt;WebCore/NotImplemented.h&gt;
</span><ins>+#include &lt;WebCore/TextCheckerEnchant.h&gt;
+#include &lt;wtf/NeverDestroyed.h&gt;
</ins><span class="cx"> 
</span><span class="cx"> using namespace WebCore;
</span><del>- 
</del><ins>+
</ins><span class="cx"> namespace WebKit {
</span><span class="cx"> 
</span><del>-static TextCheckerState textCheckerState;
-
-const TextCheckerState&amp; TextChecker::state()
</del><ins>+static WebCore::TextCheckerEnchant&amp; enchantTextChecker()
</ins><span class="cx"> {
</span><del>-    static bool didInitializeState = false;
-    if (didInitializeState)
-        return textCheckerState;
</del><ins>+    static NeverDestroyed&lt;WebCore::TextCheckerEnchant&gt; checker;
</ins><span class="cx"> 
</span><del>-    WebTextCheckerClient&amp; client = WebTextChecker::singleton()-&gt;client();
-    textCheckerState.isContinuousSpellCheckingEnabled = client.continuousSpellCheckingEnabled();
-    textCheckerState.isGrammarCheckingEnabled =  client.grammarCheckingEnabled();
</del><ins>+#if defined(DEVELOPMENT_BUILD)
+    // This is a bit of a hack, but ensures that for testing purposes,
+    // spell checking is properly initialized in WebKitTestRunner while
+    // running layout tests. We should consider replacing this with some
+    // more accessible C API at some point.
+    static std::once_flag onceFlag;
+    std::call_once(onceFlag, [] {
+        checker.get().updateSpellCheckingLanguages(Vector&lt;String&gt; { &quot;en_US&quot; });
+    });
+#endif
</ins><span class="cx"> 
</span><del>-    didInitializeState = true;
</del><ins>+    return checker;
+}
</ins><span class="cx"> 
</span><ins>+TextCheckerState&amp; checkerState()
+{
+    static TextCheckerState textCheckerState;
+    static std::once_flag onceFlag;
+    std::call_once(onceFlag, [] {
+        textCheckerState.isContinuousSpellCheckingEnabled = false;;
+        textCheckerState.isGrammarCheckingEnabled = false;;
+    });
+
</ins><span class="cx">     return textCheckerState;
</span><span class="cx"> }
</span><del>-  
</del><ins>+
+const TextCheckerState&amp; TextChecker::state()
+{
+    return checkerState();
+}
+
+static void updateStateForAllContexts()
+{
+    const Vector&lt;WebProcessPool*&gt;&amp; contexts = WebProcessPool::allProcessPools();
+    for (size_t i = 0; i &lt; contexts.size(); ++i)
+        contexts[i]-&gt;textCheckerStateChanged();
+}
+
</ins><span class="cx"> bool TextChecker::isContinuousSpellCheckingAllowed()
</span><span class="cx"> {
</span><del>-    return WebTextChecker::singleton()-&gt;client().continuousSpellCheckingAllowed();
</del><ins>+    return true;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void TextChecker::setContinuousSpellCheckingEnabled(bool isContinuousSpellCheckingEnabled)
</span><span class="cx"> {
</span><del>-    if (state().isContinuousSpellCheckingEnabled == isContinuousSpellCheckingEnabled)
</del><ins>+    if (checkerState().isContinuousSpellCheckingEnabled == isContinuousSpellCheckingEnabled)
</ins><span class="cx">         return;
</span><del>-    textCheckerState.isContinuousSpellCheckingEnabled = isContinuousSpellCheckingEnabled;
-    WebTextChecker::singleton()-&gt;client().setContinuousSpellCheckingEnabled(isContinuousSpellCheckingEnabled);
</del><ins>+    checkerState().isContinuousSpellCheckingEnabled = isContinuousSpellCheckingEnabled;
+    updateStateForAllContexts();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void TextChecker::setGrammarCheckingEnabled(bool isGrammarCheckingEnabled)
</span><span class="cx"> {
</span><del>-    if (state().isGrammarCheckingEnabled == isGrammarCheckingEnabled)
</del><ins>+    if (checkerState().isGrammarCheckingEnabled == isGrammarCheckingEnabled)
</ins><span class="cx">         return;
</span><del>-    textCheckerState.isGrammarCheckingEnabled = isGrammarCheckingEnabled;
-    WebTextChecker::singleton()-&gt;client().setGrammarCheckingEnabled(isGrammarCheckingEnabled);
</del><ins>+    checkerState().isGrammarCheckingEnabled = isGrammarCheckingEnabled;
+    updateStateForAllContexts();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void TextChecker::continuousSpellCheckingEnabledStateChanged(bool enabled)
</span><span class="cx"> {
</span><del>-    textCheckerState.isContinuousSpellCheckingEnabled = enabled;
</del><ins>+    checkerState().isContinuousSpellCheckingEnabled = enabled;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void TextChecker::grammarCheckingEnabledStateChanged(bool enabled)
</span><span class="cx"> {
</span><del>-    textCheckerState.isGrammarCheckingEnabled = enabled;
</del><ins>+    checkerState().isGrammarCheckingEnabled = enabled;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-int64_t TextChecker::uniqueSpellDocumentTag(WebPageProxy* page)
</del><ins>+int64_t TextChecker::uniqueSpellDocumentTag(WebPageProxy*)
</ins><span class="cx"> {
</span><del>-    return WebTextChecker::singleton()-&gt;client().uniqueSpellDocumentTag(page);
</del><ins>+    return 0;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void TextChecker::closeSpellDocumentWithTag(int64_t tag)
</del><ins>+void TextChecker::closeSpellDocumentWithTag(int64_t /* tag */)
</ins><span class="cx"> {
</span><del>-    WebTextChecker::singleton()-&gt;client().closeSpellDocumentWithTag(tag);
</del><span class="cx"> }
</span><span class="cx"> 
</span><del>-void TextChecker::checkSpellingOfString(int64_t spellDocumentTag, StringView text, int32_t&amp; misspellingLocation, int32_t&amp; misspellingLength)
</del><ins>+void TextChecker::checkSpellingOfString(int64_t /* spellDocumentTag */, StringView text, int32_t&amp; misspellingLocation, int32_t&amp; misspellingLength)
</ins><span class="cx"> {
</span><del>-    WebTextChecker::singleton()-&gt;client().checkSpellingOfString(spellDocumentTag, text.toStringWithoutCopying(), misspellingLocation, misspellingLength);
</del><ins>+    misspellingLocation = -1;
+    misspellingLength = 0;
+    enchantTextChecker().checkSpellingOfString(text.toStringWithoutCopying(), misspellingLocation, misspellingLength);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void TextChecker::checkGrammarOfString(int64_t spellDocumentTag, StringView text, Vector&lt;WebCore::GrammarDetail&gt;&amp; grammarDetails, int32_t&amp; badGrammarLocation, int32_t&amp; badGrammarLength)
</del><ins>+void TextChecker::checkGrammarOfString(int64_t /* spellDocumentTag */, StringView /* text */, Vector&lt;WebCore::GrammarDetail&gt;&amp; /* grammarDetails */, int32_t&amp; /* badGrammarLocation */, int32_t&amp; /* badGrammarLength */)
</ins><span class="cx"> {
</span><del>-    WebTextChecker::singleton()-&gt;client().checkGrammarOfString(spellDocumentTag, text.toStringWithoutCopying(), grammarDetails, badGrammarLocation, badGrammarLength);
</del><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> bool TextChecker::spellingUIIsShowing()
</span><span class="cx"> {
</span><del>-    return WebTextChecker::singleton()-&gt;client().spellingUIIsShowing();
</del><ins>+    return false;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void TextChecker::toggleSpellingUIIsShowing()
</span><span class="cx"> {
</span><del>-    WebTextChecker::singleton()-&gt;client().toggleSpellingUIIsShowing();
</del><span class="cx"> }
</span><span class="cx"> 
</span><del>-void TextChecker::updateSpellingUIWithMisspelledWord(int64_t spellDocumentTag, const String&amp; misspelledWord)
</del><ins>+void TextChecker::updateSpellingUIWithMisspelledWord(int64_t /* spellDocumentTag */, const String&amp; /* misspelledWord */)
</ins><span class="cx"> {
</span><del>-    WebTextChecker::singleton()-&gt;client().updateSpellingUIWithMisspelledWord(spellDocumentTag, misspelledWord);
</del><span class="cx"> }
</span><span class="cx"> 
</span><del>-void TextChecker::updateSpellingUIWithGrammarString(int64_t spellDocumentTag, const String&amp; badGrammarPhrase, const GrammarDetail&amp; grammarDetail)
</del><ins>+void TextChecker::updateSpellingUIWithGrammarString(int64_t /* spellDocumentTag */, const String&amp; /* badGrammarPhrase */, const GrammarDetail&amp; /* grammarDetail */)
</ins><span class="cx"> {
</span><del>-    WebTextChecker::singleton()-&gt;client().updateSpellingUIWithGrammarString(spellDocumentTag, badGrammarPhrase, grammarDetail);
</del><span class="cx"> }
</span><span class="cx"> 
</span><del>-void TextChecker::getGuessesForWord(int64_t spellDocumentTag, const String&amp; word, const String&amp; /* context */, Vector&lt;String&gt;&amp; guesses)
</del><ins>+void TextChecker::getGuessesForWord(int64_t /* spellDocumentTag */, const String&amp; word, const String&amp; /* context */, Vector&lt;String&gt;&amp; guesses)
</ins><span class="cx"> {
</span><del>-    WebTextChecker::singleton()-&gt;client().guessesForWord(spellDocumentTag, word, guesses);
</del><ins>+    guesses = enchantTextChecker().getGuessesForWord(word);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void TextChecker::learnWord(int64_t spellDocumentTag, const String&amp; word)
</del><ins>+void TextChecker::learnWord(int64_t /* spellDocumentTag */, const String&amp; word)
</ins><span class="cx"> {
</span><del>-    WebTextChecker::singleton()-&gt;client().learnWord(spellDocumentTag, word);
</del><ins>+    enchantTextChecker().learnWord(word);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void TextChecker::ignoreWord(int64_t spellDocumentTag, const String&amp; word)
</span><span class="cx"> {
</span><del>-    WebTextChecker::singleton()-&gt;client().ignoreWord(spellDocumentTag, word);
</del><ins>+    enchantTextChecker().ignoreWord(word);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void TextChecker::requestCheckingOfString(PassRefPtr&lt;TextCheckerCompletion&gt;)
</del><ins>+void TextChecker::requestCheckingOfString(PassRefPtr&lt;TextCheckerCompletion&gt; completion)
</ins><span class="cx"> {
</span><del>-    notImplemented();
</del><ins>+    if (!completion)
+        return;
+
+    TextCheckingRequestData request = completion-&gt;textCheckingRequestData();
+    ASSERT(request.sequence() != unrequestedTextCheckingSequence);
+    ASSERT(request.mask() != TextCheckingTypeNone);
+
+    completion-&gt;didFinishCheckingText(checkTextOfParagraph(completion-&gt;spellDocumentTag(), request.text(), request.mask()));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><ins>+#if USE(UNIFIED_TEXT_CHECKING)
+static unsigned nextWordOffset(StringView text, unsigned currentOffset)
+{
+    // FIXME: avoid creating textIterator object here, it could be passed as a parameter.
+    //        isTextBreak() leaves the iterator pointing to the first boundary position at
+    //        or after &quot;offset&quot; (ubrk_isBoundary side effect).
+    //        For many word separators, the method doesn't properly determine the boundaries
+    //        without resetting the iterator.
+    TextBreakIterator* textIterator = wordBreakIterator(text);
+    if (!textIterator)
+        return currentOffset;
+
+    unsigned wordOffset = currentOffset;
+    while (wordOffset &lt; text.length() &amp;&amp; isTextBreak(textIterator, wordOffset))
+        ++wordOffset;
+
+    // Do not treat the word's boundary as a separator.
+    if (!currentOffset &amp;&amp; wordOffset == 1)
+        return currentOffset;
+
+    // Omit multiple separators.
+    if ((wordOffset - currentOffset) &gt; 1)
+        --wordOffset;
+
+    return wordOffset;
+}
+
+Vector&lt;TextCheckingResult&gt; TextChecker::checkTextOfParagraph(int64_t spellDocumentTag, StringView text, uint64_t checkingTypes)
+{
+    if (!(checkingTypes &amp; TextCheckingTypeSpelling))
+        return Vector&lt;TextCheckingResult&gt;();
+
+    TextBreakIterator* textIterator = wordBreakIterator(text);
+    if (!textIterator)
+        return Vector&lt;TextCheckingResult&gt;();
+
+    // Omit the word separators at the beginning/end of the text to don't unnecessarily
+    // involve the client to check spelling for them.
+    unsigned offset = nextWordOffset(text, 0);
+    unsigned lengthStrip = text.length();
+    while (lengthStrip &gt; 0 &amp;&amp; isTextBreak(textIterator, lengthStrip - 1))
+        --lengthStrip;
+
+    Vector&lt;TextCheckingResult&gt; paragraphCheckingResult;
+    while (offset &lt; lengthStrip) {
+        int32_t misspellingLocation = -1;
+        int32_t misspellingLength = 0;
+        checkSpellingOfString(spellDocumentTag, text.substring(offset, lengthStrip - offset), misspellingLocation, misspellingLength);
+        if (!misspellingLength)
+            break;
+
+        TextCheckingResult misspellingResult;
+        misspellingResult.type = TextCheckingTypeSpelling;
+        misspellingResult.location = offset + misspellingLocation;
+        misspellingResult.length = misspellingLength;
+        paragraphCheckingResult.append(misspellingResult);
+        offset += misspellingLocation + misspellingLength;
+        // Generally, we end up checking at the word separator, move to the adjacent word.
+        offset = nextWordOffset(text.substring(0, lengthStrip), offset);
+    }
+    return paragraphCheckingResult;
+}
+#endif
+
+void TextChecker::setSpellCheckingLanguages(const Vector&lt;String&gt;&amp; languages)
+{
+    enchantTextChecker().updateSpellCheckingLanguages(languages);
+}
+
+Vector&lt;String&gt; TextChecker::loadedSpellCheckingLanguages()
+{
+    return enchantTextChecker().loadedSpellCheckingLanguages();
+}
+
</ins><span class="cx"> } // namespace WebKit
</span></span></pre>
</div>
</div>

</body>
</html>