Title: [141471] trunk
- Revision
- 141471
- Author
- [email protected]
- Date
- 2013-01-31 12:58:51 -0800 (Thu, 31 Jan 2013)
Log Message
Tools: [Chromium] Add two-word misspelling to mock spellchecker
https://bugs.webkit.org/show_bug.cgi?id=108498
Patch by Rouslan Solomakhin <[email protected]> on 2013-01-31
Reviewed by Tony Chang.
Some layout tests verify spellcheck behavior when multiple words are
marked as a single misspelling. This change adds a two-word misspelling
'upper case' to the mock spellchecker used by layout tests.
* DumpRenderTree/chromium/TestRunner/src/MockSpellCheck.cpp:
(MockSpellCheck::spellCheckWord): Modified to handle spaces in misspellings.
(MockSpellCheck::initializeIfNeeded): Modified to use a vector instead of a hash table.
* DumpRenderTree/chromium/TestRunner/src/MockSpellCheck.h:
(MockSpellCheck): Changed misspellings container from hash table to vector.
LayoutTests: [Chromium] Expect spellcheck to work for exactly-selected multi-word misspellings
https://bugs.webkit.org/show_bug.cgi?id=108498
Patch by Rouslan Solomakhin <[email protected]> on 2013-01-31
Reviewed by Tony Chang.
* platform/chromium/TestExpectations: Update spellcheck tests expectations.
Modified Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (141470 => 141471)
--- trunk/LayoutTests/ChangeLog 2013-01-31 20:55:33 UTC (rev 141470)
+++ trunk/LayoutTests/ChangeLog 2013-01-31 20:58:51 UTC (rev 141471)
@@ -1,3 +1,12 @@
+2013-01-31 Rouslan Solomakhin <[email protected]>
+
+ [Chromium] Expect spellcheck to work for exactly-selected multi-word misspellings
+ https://bugs.webkit.org/show_bug.cgi?id=108498
+
+ Reviewed by Tony Chang.
+
+ * platform/chromium/TestExpectations: Update spellcheck tests expectations.
+
2013-01-31 Jessie Berlin <[email protected]>
REGRESSION(r141136): Apple's internal PLT test suite doesn't finish
Modified: trunk/LayoutTests/platform/chromium/TestExpectations (141470 => 141471)
--- trunk/LayoutTests/platform/chromium/TestExpectations 2013-01-31 20:55:33 UTC (rev 141470)
+++ trunk/LayoutTests/platform/chromium/TestExpectations 2013-01-31 20:58:51 UTC (rev 141471)
@@ -4357,16 +4357,11 @@
webkit.org/b/108286 platform/chromium/virtual/softwarecompositing/geometry/fixed-position-iframe-composited-page-scale-down.html [ ImageOnlyFailure ]
# Spellchecker behavior tests.
-webkit.org/b/108370 editing/spelling/spelling-double-clicked-word.html [ Skip ]
-webkit.org/b/108370 editing/spelling/spelling-double-clicked-word-with-underscores.html [ Skip ]
-webkit.org/b/108370 editing/spelling/spelling-exactly-selected-multiple-words.html [ Skip ]
-webkit.org/b/108370 editing/spelling/spelling-exactly-selected-word.html [ Skip ]
-webkit.org/b/108370 editing/spelling/spelling-multiword-selection.html [ Skip ]
-webkit.org/b/108370 editing/spelling/spelling-should-select-multiple-words.html [ Skip ]
-webkit.org/b/108370 editing/spelling/spelling-should-select-single-word.html [ Skip ]
-webkit.org/b/108370 editing/spelling/spelling-subword-selection.html [ Skip ]
-webkit.org/b/108370 editing/spelling/spelling-with-punctuation-selection.html [ Skip ]
-webkit.org/b/108370 editing/spelling/spelling-with-underscore-selection.html [ Skip ]
-webkit.org/b/108370 editing/spelling/spelling-with-whitespace-selection.html [ Skip ]
+webkit.org/b/108370 editing/spelling/spelling-double-clicked-word.html [ Failure ]
+webkit.org/b/108370 editing/spelling/spelling-double-clicked-word-with-underscores.html [ Failure ]
+webkit.org/b/108370 editing/spelling/spelling-should-select-multiple-words.html [ Failure ]
+webkit.org/b/108370 editing/spelling/spelling-with-punctuation-selection.html [ Failure ]
+webkit.org/b/108370 editing/spelling/spelling-with-underscore-selection.html [ Failure ]
+webkit.org/b/108370 editing/spelling/spelling-with-whitespace-selection.html [ Failure ]
webkit.org/b/108424 media/video-error-does-not-exist.html [ Failure Crash ]
Modified: trunk/Tools/ChangeLog (141470 => 141471)
--- trunk/Tools/ChangeLog 2013-01-31 20:55:33 UTC (rev 141470)
+++ trunk/Tools/ChangeLog 2013-01-31 20:58:51 UTC (rev 141471)
@@ -1,3 +1,20 @@
+2013-01-31 Rouslan Solomakhin <[email protected]>
+
+ [Chromium] Add two-word misspelling to mock spellchecker
+ https://bugs.webkit.org/show_bug.cgi?id=108498
+
+ Reviewed by Tony Chang.
+
+ Some layout tests verify spellcheck behavior when multiple words are
+ marked as a single misspelling. This change adds a two-word misspelling
+ 'upper case' to the mock spellchecker used by layout tests.
+
+ * DumpRenderTree/chromium/TestRunner/src/MockSpellCheck.cpp:
+ (MockSpellCheck::spellCheckWord): Modified to handle spaces in misspellings.
+ (MockSpellCheck::initializeIfNeeded): Modified to use a vector instead of a hash table.
+ * DumpRenderTree/chromium/TestRunner/src/MockSpellCheck.h:
+ (MockSpellCheck): Changed misspellings container from hash table to vector.
+
2013-01-31 Simon Hausmann <[email protected]>
[Qt] Prospective build fix.
Modified: trunk/Tools/DumpRenderTree/chromium/TestRunner/src/MockSpellCheck.cpp (141470 => 141471)
--- trunk/Tools/DumpRenderTree/chromium/TestRunner/src/MockSpellCheck.cpp 2013-01-31 20:55:33 UTC (rev 141470)
+++ trunk/Tools/DumpRenderTree/chromium/TestRunner/src/MockSpellCheck.cpp 2013-01-31 20:58:51 UTC (rev 141471)
@@ -58,7 +58,7 @@
// Convert to a String because we store String instances in
// m_misspelledWords and WebString has no find().
- WTF::String stringText(text.data(), text.length());
+ String stringText(text.data(), text.length());
int skippedLength = 0;
while (!stringText.isEmpty()) {
@@ -69,27 +69,34 @@
// (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;
+ int maxWordLength = static_cast<int>(stringText.length()) - wordOffset;
+ int wordLength;
+ String word;
// 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;
+ for (int i = 0; i < m_misspelledWords.size(); ++i) {
+ wordLength = static_cast<int>(m_misspelledWords.at(i).length()) > maxWordLength ? maxWordLength : static_cast<int>(m_misspelledWords.at(i).length());
+ word = stringText.substring(wordOffset, wordLength);
+ if (word == m_misspelledWords.at(i) && (static_cast<int>(stringText.length()) == wordOffset + wordLength || isNotASCIIAlpha(stringText[wordOffset + wordLength]))) {
+ *misspelledOffset = wordOffset + skippedLength;
+ *misspelledLength = wordLength;
+ break;
+ }
}
+ if (*misspelledLength > 0)
+ break;
+
+ int wordEnd = stringText.find(isNotASCIIAlpha, wordOffset);
+ wordLength = wordEnd == -1 ? static_cast<int>(stringText.length()) - wordOffset : wordEnd - wordOffset;
+
ASSERT(0 < wordOffset + wordLength);
stringText = stringText.substring(wordOffset + wordLength);
skippedLength += wordOffset + wordLength;
@@ -151,12 +158,13 @@
"ifmmp",
"qwertyuiopasd",
"qwertyuiopasdf",
+ "upper case",
"wellcome"
};
m_misspelledWords.clear();
for (size_t i = 0; i < arraysize(misspelledWords); ++i)
- m_misspelledWords.add(WTF::String::fromUTF8(misspelledWords[i]), false);
+ m_misspelledWords.append(String::fromUTF8(misspelledWords[i]));
// Mark as initialized to prevent this object from being initialized twice
// or more.
Modified: trunk/Tools/DumpRenderTree/chromium/TestRunner/src/MockSpellCheck.h (141470 => 141471)
--- trunk/Tools/DumpRenderTree/chromium/TestRunner/src/MockSpellCheck.h 2013-01-31 20:55:33 UTC (rev 141470)
+++ trunk/Tools/DumpRenderTree/chromium/TestRunner/src/MockSpellCheck.h 2013-01-31 20:58:51 UTC (rev 141471)
@@ -33,8 +33,7 @@
#include "Platform/chromium/public/WebString.h"
#include "Platform/chromium/public/WebVector.h"
-#include <wtf/HashMap.h>
-#include <wtf/text/StringHash.h>
+#include <wtf/Vector.h>
#include <wtf/text/WTFString.h>
// A mock implementation of a spell-checker used for WebKit tests.
@@ -71,7 +70,7 @@
bool initializeIfNeeded();
// A table that consists of misspelled words.
- HashMap<WTF::String, bool> m_misspelledWords;
+ Vector<String> m_misspelledWords;
// A flag representing whether or not this object is initialized.
bool m_initialized;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes