<!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>[164101] trunk/LayoutTests</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/164101">164101</a></dd>
<dt>Author</dt> <dd>g.czajkowski@samsung.com</dd>
<dt>Date</dt> <dd>2014-02-14 05:57:53 -0800 (Fri, 14 Feb 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>Refactoring design-mode-spellcheck-off.html to use asynchronous spellchecking
https://bugs.webkit.org/show_bug.cgi?id=127770

Reviewed by Ryosuke Niwa.

Enable asynchronous spellchecking in design-mode-spellcheck-off.html.

Due to js-test-pre.js adds some HTML elements inside the BODY, the misspelled
phrase was moved into separated div element. It allows to check spelling marker
on desired element instead of whole body.

It turned out that the test does not underline &quot;asdf&quot; as misspelled although
spellcheck attribute is on. To force spellchecking, the caret needs to be moved
out of the misspelled word. To be more reliable, the test now contains two test
cases in 'desingMode=on' when spellcheck attribute is off and on.

* editing/spelling/design-mode-spellcheck-off-expected.txt:
* editing/spelling/design-mode-spellcheck-off.html:

* platform/gtk-wk2/TestExpectations:
* platform/gtk/TestExpectations:
Skip the test for GTK.

* platform/win/TestExpectations:
Add failing test expectation.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestseditingspellingdesignmodespellcheckoffexpectedtxt">trunk/LayoutTests/editing/spelling/design-mode-spellcheck-off-expected.txt</a></li>
<li><a href="#trunkLayoutTestseditingspellingdesignmodespellcheckoffhtml">trunk/LayoutTests/editing/spelling/design-mode-spellcheck-off.html</a></li>
<li><a href="#trunkLayoutTestsplatformgtkTestExpectations">trunk/LayoutTests/platform/gtk/TestExpectations</a></li>
<li><a href="#trunkLayoutTestsplatformgtkwk2TestExpectations">trunk/LayoutTests/platform/gtk-wk2/TestExpectations</a></li>
<li><a href="#trunkLayoutTestsplatformwinTestExpectations">trunk/LayoutTests/platform/win/TestExpectations</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (164100 => 164101)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2014-02-14 12:26:54 UTC (rev 164100)
+++ trunk/LayoutTests/ChangeLog        2014-02-14 13:57:53 UTC (rev 164101)
</span><span class="lines">@@ -1,5 +1,33 @@
</span><span class="cx"> 2014-02-14  Grzegorz Czajkowski  &lt;g.czajkowski@samsung.com&gt;
</span><span class="cx"> 
</span><ins>+        Refactoring design-mode-spellcheck-off.html to use asynchronous spellchecking
+        https://bugs.webkit.org/show_bug.cgi?id=127770
+
+        Reviewed by Ryosuke Niwa.
+
+        Enable asynchronous spellchecking in design-mode-spellcheck-off.html.
+
+        Due to js-test-pre.js adds some HTML elements inside the BODY, the misspelled
+        phrase was moved into separated div element. It allows to check spelling marker
+        on desired element instead of whole body.
+
+        It turned out that the test does not underline &quot;asdf&quot; as misspelled although
+        spellcheck attribute is on. To force spellchecking, the caret needs to be moved
+        out of the misspelled word. To be more reliable, the test now contains two test
+        cases in 'desingMode=on' when spellcheck attribute is off and on.
+
+        * editing/spelling/design-mode-spellcheck-off-expected.txt:
+        * editing/spelling/design-mode-spellcheck-off.html:
+
+        * platform/gtk-wk2/TestExpectations:
+        * platform/gtk/TestExpectations:
+        Skip the test for GTK.
+
+        * platform/win/TestExpectations:
+        Add failing test expectation.
+
+2014-02-14  Grzegorz Czajkowski  &lt;g.czajkowski@samsung.com&gt;
+
</ins><span class="cx">         Use asynchronous spellchecking in spelling-hasspellingmarker.js
</span><span class="cx">         https://bugs.webkit.org/show_bug.cgi?id=128526
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkLayoutTestseditingspellingdesignmodespellcheckoffexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/editing/spelling/design-mode-spellcheck-off-expected.txt (164100 => 164101)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/editing/spelling/design-mode-spellcheck-off-expected.txt        2014-02-14 12:26:54 UTC (rev 164100)
+++ trunk/LayoutTests/editing/spelling/design-mode-spellcheck-off-expected.txt        2014-02-14 13:57:53 UTC (rev 164101)
</span><span class="lines">@@ -1,4 +1,12 @@
</span><ins>+This tests whether WebKit does not spell check in 'designMode' when spellcheck='false'. To test manually, click arround 'asdf'. There should be no spelling marker for 'asdf' after the click.
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+PASS internals.hasSpellingMarker(0, 4) became false
+document.body.setAttribute(&quot;spellcheck&quot;, &quot;true&quot;)
+PASS internals.hasSpellingMarker(0, 4) became different from false
+PASS successfullyParsed is true
+
+TEST COMPLETE
</ins><span class="cx"> asdf is misspelled.
</span><del>-To test this manually, click &quot;asdf&quot; above. There should be no spelling marker for &quot;asdf&quot; after the click.
-
-PASS
</del></span></pre></div>
<a id="trunkLayoutTestseditingspellingdesignmodespellcheckoffhtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/editing/spelling/design-mode-spellcheck-off.html (164100 => 164101)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/editing/spelling/design-mode-spellcheck-off.html        2014-02-14 12:26:54 UTC (rev 164100)
+++ trunk/LayoutTests/editing/spelling/design-mode-spellcheck-off.html        2014-02-14 13:57:53 UTC (rev 164101)
</span><span class="lines">@@ -1,39 +1,49 @@
</span><span class="cx"> &lt;!DOCTYPE html&gt;
</span><span class="cx"> &lt;html&gt;
</span><del>-&lt;body spellcheck=&quot;false&quot;&gt; 
-asdf is misspelled.
-&lt;p&gt;To test this manually, click &quot;asdf&quot; above. There should be no spelling marker for &quot;asdf&quot; after the click.&lt;/p&gt;
</del><ins>+&lt;body spellcheck=&quot;false&quot;&gt;
+&lt;script src=&quot;../editing.js&quot;&gt;&lt;/script&gt;
+&lt;script src=&quot;../../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+&lt;div id=&quot;misspelled&quot; onmouseup=&quot;checkSpellingMarker()&quot;&gt;asdf is misspelled.&lt;/div&gt;
</ins><span class="cx"> &lt;script&gt;
</span><ins>+description(&quot;This tests whether WebKit does not spell check in 'designMode' &quot;
+    + &quot;when spellcheck='false'. To test manually, click arround 'asdf'. &quot;
+    + &quot;There should be no spelling marker for 'asdf' after the click.&quot;);
</ins><span class="cx"> 
</span><del>-if (window.testRunner)
-    testRunner.dumpAsText();
</del><ins>+jsTestIsAsync = true;
</ins><span class="cx"> 
</span><ins>+if (window.internals) {
+    internals.settings.setUnifiedTextCheckerEnabled(true);
+    internals.settings.setAsynchronousSpellCheckingEnabled(true);
+}
+
</ins><span class="cx"> document.designMode = &quot;on&quot;;
</span><span class="cx"> 
</span><del>-if (document.activeElement != document.body)
-    document.body.appendChild(document.createTextNode('FAIL: active element before click is not body element'));
-else if (window.testRunner &amp;&amp; window.eventSender) {
-    testRunner.waitUntilDone();
</del><ins>+function checkSpellingMarker()
+{
+    // First, verify spelling with spellcheck attribute off.
+    // Move selection to the next word to notify WebKit that &quot;asdf&quot; has been typed/changed
+    // to give a chance to spellcheck.
+    moveSelectionForwardByWordCommand();
</ins><span class="cx"> 
</span><del>-    document.body.addEventListener('mousedown', function() {
-        if (document.activeElement != document.body)
-            document.body.appendChild(document.createTextNode('FAIL: active element after click is not body element'));
-        else if (internals.hasSpellingMarker(0, 4))
-            document.body.appendChild(document.createTextNode('FAIL: spell check was invoked'));
-        else
-            document.body.appendChild(document.createTextNode('PASS'));
-        testRunner.notifyDone();
-    });
</del><ins>+    if (window.internals) {
+        shouldBecomeEqual('internals.hasSpellingMarker(0, 4)', 'false', function() {
+            evalAndLog('document.body.setAttribute(&quot;spellcheck&quot;, &quot;true&quot;)');
+            // Do any selection change to force spellchecking after attribute change.
+            moveSelectionForwardByLineCommand();
+            shouldBecomeDifferent('internals.hasSpellingMarker(0, 4)', 'false', finishJSTest);
+        });
+    }
+}
</ins><span class="cx"> 
</span><del>-    var x = document.body.offsetLeft + 10;
-    var y = document.body.offsetTop + 10;
</del><ins>+if (window.eventSender) {
+    var misspelledDiv = document.getElementById(&quot;misspelled&quot;);
+    var x = misspelledDiv.offsetLeft;
+    var y = misspelledDiv.offsetTop;
</ins><span class="cx">     eventSender.mouseMoveTo(x, y);
</span><span class="cx">     eventSender.mouseDown();
</span><span class="cx">     eventSender.mouseUp();
</span><del>-    setTimeout(&quot;testRunner.notifyDone();document.body.appendChild(document.createTextNode('FAIL: timeout'));&quot;, 500);
-} else
-    document.body.appendChild(document.createTextNode('PASS'));
-
</del><ins>+}
</ins><span class="cx"> &lt;/script&gt; 
</span><ins>+&lt;script src=&quot;../../resources/js-test-post.js&quot;&gt;&lt;/script&gt;
</ins><span class="cx"> &lt;/body&gt;
</span><span class="cx"> &lt;/html&gt;
</span></span></pre></div>
<a id="trunkLayoutTestsplatformgtkTestExpectations"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/gtk/TestExpectations (164100 => 164101)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/gtk/TestExpectations        2014-02-14 12:26:54 UTC (rev 164100)
+++ trunk/LayoutTests/platform/gtk/TestExpectations        2014-02-14 13:57:53 UTC (rev 164101)
</span><span class="lines">@@ -1145,6 +1145,7 @@
</span><span class="cx"> Bug(GTK) editing/spelling/markers.html [ Skip ]
</span><span class="cx"> 
</span><span class="cx"> # Missing asynchronous spellchecking implementation.
</span><ins>+Bug(GTK) editing/spelling/design-mode-spellcheck-off.html [ Skip ]
</ins><span class="cx"> Bug(GTK) editing/spelling/spelling-hasspellingmarker.html [ Skip ]
</span><span class="cx"> 
</span><span class="cx"> # testRunner.overridePreference(&quot;WebKitDefaultFontSize&quot;...) does not take into account screen DPI
</span></span></pre></div>
<a id="trunkLayoutTestsplatformgtkwk2TestExpectations"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/gtk-wk2/TestExpectations (164100 => 164101)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/gtk-wk2/TestExpectations        2014-02-14 12:26:54 UTC (rev 164100)
+++ trunk/LayoutTests/platform/gtk-wk2/TestExpectations        2014-02-14 13:57:53 UTC (rev 164101)
</span><span class="lines">@@ -159,7 +159,6 @@
</span><span class="cx"> Bug(GTK) editing/spelling/context-menu-suggestions-multiword-selection.html [ Skip ]
</span><span class="cx"> Bug(GTK) editing/spelling/context-menu-suggestions-subword-selection.html [ Skip ]
</span><span class="cx"> Bug(GTK) editing/spelling/spelling-backspace-between-lines.html [ Skip ]
</span><del>-Bug(GTK) editing/spelling/design-mode-spellcheck-off.html [ Skip ]
</del><span class="cx"> Bug(GTK) editing/spelling/spellcheck-attribute.html [ Skip ]
</span><span class="cx"> Bug(GTK) editing/spelling/spelling-attribute-at-child.html [ Skip ]
</span><span class="cx"> Bug(GTK) editing/spelling/spelling-attribute-change.html [ Skip ]
</span></span></pre></div>
<a id="trunkLayoutTestsplatformwinTestExpectations"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/win/TestExpectations (164100 => 164101)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/win/TestExpectations        2014-02-14 12:26:54 UTC (rev 164100)
+++ trunk/LayoutTests/platform/win/TestExpectations        2014-02-14 13:57:53 UTC (rev 164101)
</span><span class="lines">@@ -2449,6 +2449,7 @@
</span><span class="cx"> media/W3C/video/events/event_canplaythrough.html
</span><span class="cx"> 
</span><span class="cx"> # Spellchecker behavior tests.
</span><ins>+webkit.org/b/108370 editing/spelling/design-mode-spellcheck-off.html [ Failure ]
</ins><span class="cx"> webkit.org/b/108370 editing/spelling/context-menu-suggestions-multiword-selection.html [ Failure ]
</span><span class="cx"> webkit.org/b/108370 editing/spelling/context-menu-suggestions-subword-selection.html [ Failure ]
</span><span class="cx"> webkit.org/b/108370 editing/spelling/spelling-double-clicked-word.html [ Failure ]
</span></span></pre>
</div>
</div>

</body>
</html>