Title: [92928] trunk
Revision
92928
Author
[email protected]
Date
2011-08-11 22:38:41 -0700 (Thu, 11 Aug 2011)

Log Message

[Chromium][DRT] editing/spelling/spelling-backspace-between-lines.html fails
https://bugs.webkit.org/show_bug.cgi?id=45438

Reviewed by Kent Tamura.

Tools:

MockSpellCheck was assuming the input of spellCheckWord() is a word.
But it can be a series of word. This change made spellCheckWord()
understand simple word boundary which appears in tests.

* DumpRenderTree/chromium/MockSpellCheck.cpp:
(MockSpellCheck::spellCheckWord):

LayoutTests:

Added a chromium specific expectation because chromium will use window's (wrong) expectation
unless chromium has its own.

* platform/chromium/editing/spelling/spelling-backspace-between-lines-expected.txt: Added

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (92927 => 92928)


--- trunk/LayoutTests/ChangeLog	2011-08-12 05:27:26 UTC (rev 92927)
+++ trunk/LayoutTests/ChangeLog	2011-08-12 05:38:41 UTC (rev 92928)
@@ -1,3 +1,15 @@
+2011-08-11  MORITA Hajime  <[email protected]>
+
+        [Chromium][DRT] editing/spelling/spelling-backspace-between-lines.html fails
+        https://bugs.webkit.org/show_bug.cgi?id=45438
+
+        Reviewed by Kent Tamura.
+
+        Added a chromium specific expectation because chromium will use window's (wrong) expectation
+        unless chromium has its own.
+        
+        * platform/chromium/editing/spelling/spelling-backspace-between-lines-expected.txt: Added
+
 2011-08-11  Hayato Ito  <[email protected]>
 
         Implement proper handling of events with a related target in regard to shadow DOM boundaries.

Added: trunk/LayoutTests/platform/chromium/editing/spelling/spelling-backspace-between-lines-expected.txt (0 => 92928)


--- trunk/LayoutTests/platform/chromium/editing/spelling/spelling-backspace-between-lines-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/platform/chromium/editing/spelling/spelling-backspace-between-lines-expected.txt	2011-08-12 05:38:41 UTC (rev 92928)
@@ -0,0 +1,21 @@
+For Bug 41423: Spelling marker should remain after hitting a backspace key.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS firstLineText() is 'OK'
+PASS sel.anchorNode.data is 'OK zz OK'
+PASS layoutTestController.hasSpellingMarker(3, 2) is true
+PASS sel.anchorNode.data is 'OK zz OK'
+PASS firstLineText() is 'OKOK zz OK'
+PASS layoutTestController.hasSpellingMarker(3, 2) is true
+PASS firstLineText() is 'OK'
+PASS sel.anchorNode.data is 'OK zz OK'
+PASS layoutTestController.hasSpellingMarker(3, 2) is true
+PASS firstLineText() is 'OKOK zz OK'
+PASS sel.anchorNode.data is 'OK zz OK'
+PASS layoutTestController.hasSpellingMarker(3, 2) is true
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Modified: trunk/Tools/ChangeLog (92927 => 92928)


--- trunk/Tools/ChangeLog	2011-08-12 05:27:26 UTC (rev 92927)
+++ trunk/Tools/ChangeLog	2011-08-12 05:38:41 UTC (rev 92928)
@@ -1,3 +1,17 @@
+2011-08-11  MORITA Hajime  <[email protected]>
+
+        [Chromium][DRT] editing/spelling/spelling-backspace-between-lines.html fails
+        https://bugs.webkit.org/show_bug.cgi?id=45438
+
+        Reviewed by Kent Tamura.
+
+        MockSpellCheck was assuming the input of spellCheckWord() is a word.
+        But it can be a series of word. This change made spellCheckWord()
+        understand simple word boundary which appears in tests.
+        
+        * DumpRenderTree/chromium/MockSpellCheck.cpp:
+        (MockSpellCheck::spellCheckWord):
+
 2011-08-11  Mark Rowe  <[email protected]>
 
         Rework some Makefile logic to remove a double-negative.

Modified: trunk/Tools/DumpRenderTree/chromium/MockSpellCheck.cpp (92927 => 92928)


--- trunk/Tools/DumpRenderTree/chromium/MockSpellCheck.cpp	2011-08-12 05:27:26 UTC (rev 92927)
+++ trunk/Tools/DumpRenderTree/chromium/MockSpellCheck.cpp	2011-08-12 05:38:41 UTC (rev 92928)
@@ -59,35 +59,43 @@
 
     // Convert to a String because we store String instances in
     // m_misspelledWords and WebString has no find().
-    const WTF::String stringText(text.data(), text.length());
+    WTF::String stringText(text.data(), text.length());
+    int skippedLength = 0;
 
-    // Extract the first possible English word from the given string.
-    // The given string may include non-ASCII characters or numbers. So, we
-    // should filter out such characters before start looking up our
-    // misspelled-word table.
-    // (This is a simple version of our SpellCheckWordIterator class.)
-    // If the given string doesn't include any ASCII characters, we can treat the
-    // string as valid one.
-    // Unfortunately, This implementation splits a contraction, i.e. "isn't" is
-    // split into two pieces "isn" and "t". This is OK because webkit tests
-    // don't have misspelled contractions.
-    int wordOffset = stringText.find(isASCIIAlpha);
-    if (wordOffset == -1)
-        return true;
-    int wordEnd = stringText.find(isNotASCIIAlpha, wordOffset);
-    int wordLength = wordEnd == -1 ? static_cast<int>(stringText.length()) - wordOffset : wordEnd - wordOffset;
+    while (!stringText.isEmpty()) {
+        // Extract the first possible English word from the given string.
+        // The given string may include non-ASCII characters or numbers. So, we
+        // should filter out such characters before start looking up our
+        // misspelled-word table.
+        // (This is a simple version of our SpellCheckWordIterator class.)
+        // If the given string doesn't include any ASCII characters, we can treat the
+        // string as valid one.
+        // Unfortunately, This implementation splits a contraction, i.e. "isn't" is
+        // split into two pieces "isn" and "t". This is OK because webkit tests
+        // don't have misspelled contractions.
+        int wordOffset = stringText.find(isASCIIAlpha);
+        if (wordOffset == -1)
+            return true;
+        int wordEnd = stringText.find(isNotASCIIAlpha, wordOffset);
+        int wordLength = wordEnd == -1 ? static_cast<int>(stringText.length()) - wordOffset : wordEnd - wordOffset;
 
-    // Look up our misspelled-word table to check if the extracted word is a
-    // known misspelled word, and return the offset and the length of the
-    // extracted word if this word is a known misspelled word.
-    // (See the comment in MockSpellCheck::initializeIfNeeded() why we use a
-    // misspelled-word table.)
-    WTF::String word = stringText.substring(wordOffset, wordLength);
-    if (!m_misspelledWords.contains(word))
-        return true;
+        // Look up our misspelled-word table to check if the extracted word is a
+        // known misspelled word, and return the offset and the length of the
+        // extracted word if this word is a known misspelled word.
+        // (See the comment in MockSpellCheck::initializeIfNeeded() why we use a
+        // misspelled-word table.)
+        WTF::String word = stringText.substring(wordOffset, wordLength);
+        if (m_misspelledWords.contains(word)) {
+            *misspelledOffset = wordOffset + skippedLength;
+            *misspelledLength = wordLength;
+            break;
+        }
 
-    *misspelledOffset = wordOffset;
-    *misspelledLength = wordLength;
+        ASSERT(0 < wordOffset + wordLength);
+        stringText = stringText.substring(wordOffset + wordLength);
+        skippedLength += wordOffset + wordLength;
+    }
+
     return false;
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to