WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
Patch
bug-106815-20130130152407.patch (text/plain), 77.20 KB, created by
Rouslan Solomakhin
on 2013-01-30 15:27:23 PST
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Rouslan Solomakhin
Created:
2013-01-30 15:27:23 PST
Size:
77.20 KB
patch
obsolete
>Subversion Revision: 141329 >diff --git a/Source/WebKit/chromium/ChangeLog b/Source/WebKit/chromium/ChangeLog >index 1ff53aba8773608aeff9dabb90378f1c5999992b..d3e9b7ab653eed4e90d7b63671aa45bde5fb04a4 100644 >--- a/Source/WebKit/chromium/ChangeLog >+++ b/Source/WebKit/chromium/ChangeLog >@@ -1,3 +1,42 @@ >+2013-01-30 Rouslan Solomakhin <rouslan@chromium.org> >+ >+ Fixes for spellcheck behavior >+ https://bugs.webkit.org/show_bug.cgi?id=106815 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Fix spellcheck to behave as follows: >+ - Spellcheck selects the misspelled word on context click. >+ - Spelling should work when the user selects the misspelled word exactly. >+ - If the word is not misspelled, there should be no spelling options in the context menu. >+ - Spellcheck should select multi-word misspellings on context click. >+ - Spelling should work when the user selects a multi-word misspelling exactly. >+ - Spelling should work for double-clicked misspellings. >+ - Spelling should ignore whitespace. >+ - Underscores should be treated as whitespace: spelling should ignore them. >+ - Punctuation marks should be treated as whitespace: spelling should ignore them. >+ - Spelling should be disabled when user selects a part of misspelling. >+ - Spelling should be disabled when user selects multiple words that are not a single misspelling. >+ >+ Tests: editing/spelling/spelling-double-clicked-word-with-underscores.html >+ editing/spelling/spelling-double-clicked-word.html >+ editing/spelling/spelling-exactly-selected-multiple-words.html >+ editing/spelling/spelling-exactly-selected-word.html >+ editing/spelling/spelling-multiword-selection.html >+ editing/spelling/spelling-should-select-multiple-words.html >+ editing/spelling/spelling-should-select-single-word.html >+ editing/spelling/spelling-subword-selection.html >+ editing/spelling/spelling-with-punctuation-selection.html >+ editing/spelling/spelling-with-underscore-selection.html >+ editing/spelling/spelling-with-whitespace-selection.html >+ >+ * src/ContextMenuClientImpl.cpp: >+ (WebKit): >+ (WebKit::IsWhiteSpaceOrPunctuation): Added utility function to detect whitespace or punctuation. >+ (WebKit::ContextMenuClientImpl::getCustomMenuFromDefaultItems): Modified to fix spellcheck behavior. >+ * src/WebFrameImpl.cpp: >+ (WebKit::WebFrameImpl::replaceMisspelledRange): Fixed to replace the correct range. Chromium will use this method instead of replaceRange when correcting misspellings. >+ > 2013-01-30 Kentaro Hara <haraken@chromium.org> > > Implement WheelEvent constructor >diff --git a/Source/WebKit/chromium/src/ContextMenuClientImpl.cpp b/Source/WebKit/chromium/src/ContextMenuClientImpl.cpp >index 33956bca784e019459b2f93d4b4601c56ef50327..7a3f052745c7d53ab1cfd45507a0cbdd7a13aa44 100644 >--- a/Source/WebKit/chromium/src/ContextMenuClientImpl.cpp >+++ b/Source/WebKit/chromium/src/ContextMenuClientImpl.cpp >@@ -40,6 +40,7 @@ > #include "DocumentMarkerController.h" > #include "Editor.h" > #include "EventHandler.h" >+#include "ExceptionCodePlaceholder.h" > #include "FrameLoader.h" > #include "FrameView.h" > #include "HTMLFormElement.h" >@@ -78,6 +79,12 @@ using namespace WebCore; > > namespace WebKit { > >+// Returns true for whitespace and punctuation characters. Returns false for every other type of character. >+static bool IsWhiteSpaceOrPunctuation(UChar c) >+{ >+ return WTF::Unicode::isSeparatorSpace(c) || WTF::Unicode::isPunct(c); >+} >+ > // Figure out the URL of a page or subframe. Returns |page_type| as the type, > // which indicates page or subframe, or ContextNodeType::NONE if the URL could not > // be determined for some reason. >@@ -102,8 +109,8 @@ static bool isASingleWord(const String& text) > } > > // Helper function to get misspelled word on which context menu >-// is to be evolked. This function also sets the word on which context menu >-// has been evoked to be the selected word, as required. This function changes >+// is to be invoked. This function also sets the word on which context menu >+// has been invoked to be the selected word, as required. This function changes > // the selection only when there were no selected characters on OS X. > static String selectMisspelledWord(const ContextMenu* defaultMenu, Frame* selectedFrame) > { >@@ -274,36 +281,34 @@ PlatformMenuDescription ContextMenuClientImpl::getCustomMenuFromDefaultItems( > #endif > // When Chrome enables asynchronous spellchecking, its spellchecker adds spelling markers to misspelled > // words and attaches suggestions to these markers in the background. Therefore, when a user right-clicks >- // a mouse on a word, Chrome just needs to find a spelling marker on the word instread of spellchecking it. >+ // a mouse on a word, Chrome just needs to find a spelling marker on the word instead of spellchecking it. > if (selectedFrame->settings() && selectedFrame->settings()->asynchronousSpellCheckingEnabled()) { > VisibleSelection selection = selectedFrame->selection()->selection(); >- bool shouldUpdateSelection = false; > if (selection.isCaretOrRange()) { >- if (selection.isCaret()) { >- selection.expandUsingGranularity(WordGranularity); >- shouldUpdateSelection = true; >- } >- RefPtr<Range> range = selection.toNormalizedRange(); >- Vector<DocumentMarker*> markers = selectedFrame->document()->markers()->markersInRange(range.get(), DocumentMarker::Spelling | DocumentMarker::Grammar); >+ // Caret and range selections always return valid normalized ranges. >+ RefPtr<Range> selectionRange = selection.toNormalizedRange(); >+ // Cloning a range fails only for invalid ranges. >+ RefPtr<Range> markerRange = selectionRange->cloneRange(ASSERT_NO_EXCEPTION); >+ Vector<DocumentMarker*> markers = selectedFrame->document()->markers()->markersInRange(selectionRange.get(), DocumentMarker::Spelling | DocumentMarker::Grammar); > if (markers.size() == 1) { >- if (markers[0]->startOffset() != static_cast<unsigned>(range->startOffset()) || markers[0]->endOffset() != static_cast<unsigned>(range->endOffset())) >- markers.clear(); >- } >- if (markers.size() == 1) { >- range->setStart(range->startContainer(), markers[0]->startOffset()); >- range->setEnd(range->endContainer(), markers[0]->endOffset()); >- data.misspelledWord = range->text(); >- if (markers[0]->description().length()) { >- Vector<String> suggestions; >- markers[0]->description().split('\n', suggestions); >- data.dictionarySuggestions = suggestions; >- } else if (m_webView->spellCheckClient()) { >- int misspelledOffset, misspelledLength; >- m_webView->spellCheckClient()->spellCheck(data.misspelledWord, misspelledOffset, misspelledLength, &data.dictionarySuggestions); >- } >- selection = VisibleSelection(range.get()); >- if (shouldUpdateSelection && selectedFrame->selection()->shouldChangeSelection(selection)) >+ markerRange->setStart(markerRange->startContainer(), markers[0]->startOffset()); >+ markerRange->setEnd(markerRange->endContainer(), markers[0]->endOffset()); >+ if (selection.isCaret()) { >+ selection = VisibleSelection(markerRange.get()); > selectedFrame->selection()->setSelection(selection, WordGranularity); >+ selectionRange = selection.toNormalizedRange(); >+ } >+ if (selectionRange->text().stripWhiteSpace(&IsWhiteSpaceOrPunctuation) == markerRange->text().stripWhiteSpace(&IsWhiteSpaceOrPunctuation)) { >+ data.misspelledWord = markerRange->text(); >+ if (markers[0]->description().length()) { >+ Vector<String> suggestions; >+ markers[0]->description().split('\n', suggestions); >+ data.dictionarySuggestions = suggestions; >+ } else if (m_webView->spellCheckClient()) { >+ int misspelledOffset, misspelledLength; >+ m_webView->spellCheckClient()->spellCheck(data.misspelledWord, misspelledOffset, misspelledLength, &data.dictionarySuggestions); >+ } >+ } > } > } > } else { >diff --git a/Source/WebKit/chromium/src/WebFrameImpl.cpp b/Source/WebKit/chromium/src/WebFrameImpl.cpp >index 5baf08ec277dff1ddbd0f5ea2e14edbbb767e64c..f9b5a4c9557705a7de24063c0cf5482bc6f2a89d 100644 >--- a/Source/WebKit/chromium/src/WebFrameImpl.cpp >+++ b/Source/WebKit/chromium/src/WebFrameImpl.cpp >@@ -1302,11 +1302,16 @@ void WebFrameImpl::replaceMisspelledRange(const WebString& text) > Vector<DocumentMarker*> markers = frame()->document()->markers()->markersInRange(caretRange.get(), DocumentMarker::Spelling | DocumentMarker::Grammar); > if (markers.size() < 1 || markers[0]->startOffset() >= markers[0]->endOffset()) > return; >- RefPtr<Range> markerRange = TextIterator::rangeFromLocationAndLength(frame()->selection()->rootEditableElementOrDocumentElement(), markers[0]->startOffset(), markers[0]->endOffset() - markers[0]->startOffset()); >- if (!markerRange.get() || !frame()->selection()->shouldChangeSelection(markerRange.get())) >+ ExceptionCode exceptionCode; >+ RefPtr<Range> markerRange = caretRange->cloneRange(exceptionCode); >+ if (!exceptionCode) >+ return; >+ markerRange->setStart(markerRange->startContainer(), markers[0]->startOffset()); >+ markerRange->setEnd(markerRange->endContainer(), markers[0]->endOffset()); >+ if (!frame()->selection()->shouldChangeSelection(markerRange.get())) > return; > frame()->selection()->setSelection(markerRange.get(), CharacterGranularity); >- frame()->editor()->replaceSelectionWithText(text, false, true); >+ frame()->editor()->replaceSelectionWithText(text, false, false); > } > > bool WebFrameImpl::hasSelection() const >diff --git a/Tools/ChangeLog b/Tools/ChangeLog >index 621ffb0a9a6b40abc8dc2e65d518a696a1320162..6eb32ed438866a53630ad1030f97c4f39d991ed5 100644 >--- a/Tools/ChangeLog >+++ b/Tools/ChangeLog >@@ -1,3 +1,23 @@ >+2013-01-30 Rouslan Solomakhin <rouslan@chromium.org> >+ >+ Add two-word misspelling 'upper case' to mock spellchecker >+ https://bugs.webkit.org/show_bug.cgi?id=106815 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ 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. >+ >+ Tests: editing/spelling/spelling-exactly-selected-multiple-words.html >+ editing/spelling/spelling-should-select-multiple-words.html >+ >+ * 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-30 Jochen Eisinger <jochen@chromium.org> > > [chromium] move custom policy delegate to TestRunner library >diff --git a/Tools/DumpRenderTree/chromium/TestRunner/src/MockSpellCheck.cpp b/Tools/DumpRenderTree/chromium/TestRunner/src/MockSpellCheck.cpp >index 7593c719042350d2c21eaa19dab9f5a99990a881..e7efeeeda434980c41b822b7a06bbcda79a91b7c 100644 >--- a/Tools/DumpRenderTree/chromium/TestRunner/src/MockSpellCheck.cpp >+++ b/Tools/DumpRenderTree/chromium/TestRunner/src/MockSpellCheck.cpp >@@ -69,27 +69,34 @@ bool MockSpellCheck::spellCheckWord(const WebString& text, int* misspelledOffset > // (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; >+ WTF::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 @@ bool MockSpellCheck::initializeIfNeeded() > "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(WTF::String::fromUTF8(misspelledWords[i])); > > // Mark as initialized to prevent this object from being initialized twice > // or more. >diff --git a/Tools/DumpRenderTree/chromium/TestRunner/src/MockSpellCheck.h b/Tools/DumpRenderTree/chromium/TestRunner/src/MockSpellCheck.h >index 8a98d707c04b1bc85e28f57104dbc03164146b5d..bfa188b2705e2ef8eab7a602844f6336a284894c 100644 >--- a/Tools/DumpRenderTree/chromium/TestRunner/src/MockSpellCheck.h >+++ b/Tools/DumpRenderTree/chromium/TestRunner/src/MockSpellCheck.h >@@ -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 @@ private: > bool initializeIfNeeded(); > > // A table that consists of misspelled words. >- HashMap<WTF::String, bool> m_misspelledWords; >+ Vector<WTF::String> m_misspelledWords; > > // A flag representing whether or not this object is initialized. > bool m_initialized; >diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog >index a079232d622a6625eff1c60d38fd05958725e548..273f845affc1296aa0a4ca26343bbee7fa94789e 100644 >--- a/LayoutTests/ChangeLog >+++ b/LayoutTests/ChangeLog >@@ -1,3 +1,58 @@ >+2013-01-30 Rouslan Solomakhin <rouslan@chromium.org> >+ >+ Tests for spellcheck behavior >+ https://bugs.webkit.org/show_bug.cgi?id=106815 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Add tests for the following spellcheck behavior: >+ - Spellcheck selects the misspelled word on context click. >+ - Spelling should work when the user selects the misspelled word exactly. >+ - If the word is not misspelled, there should be no spelling options in the context menu. >+ - Spellcheck should select multi-word misspellings on context click. >+ - Spelling should work when the user selects a multi-word misspelling exactly. >+ - Spelling should work for double-clicked misspellings. >+ - Spelling should ignore whitespace. >+ - Underscores should be treated as whitespace: spelling should ignore them. >+ - Punctuation marks should be treated as whitespace: spelling should ignore them. >+ - Spelling should be disabled when user selects a part of misspelling. >+ - Spelling should be disabled when user selects multiple words that are not a single misspelling. >+ >+ * editing/spelling/resources/util.js: Added. >+ (initSpellTest): Added function for common boilerplate in spell check tests. >+ * editing/spelling/spelling-double-clicked-word-expected.txt: Added. >+ * editing/spelling/spelling-double-clicked-word-with-underscores-expected.txt: Added. >+ * editing/spelling/spelling-double-clicked-word-with-underscores.html: Added. >+ * editing/spelling/spelling-double-clicked-word.html: Added. >+ * editing/spelling/spelling-exactly-selected-multiple-words-expected.txt: Added. >+ * editing/spelling/spelling-exactly-selected-multiple-words.html: Added. >+ * editing/spelling/spelling-exactly-selected-word-expected.txt: Added. >+ * editing/spelling/spelling-exactly-selected-word.html: Added. >+ * editing/spelling/spelling-multiword-selection-expected.txt: Added. >+ * editing/spelling/spelling-multiword-selection.html: Added. >+ * editing/spelling/spelling-should-select-multiple-words-expected.txt: Added. >+ * editing/spelling/spelling-should-select-multiple-words.html: Added. >+ * editing/spelling/spelling-should-select-single-word-expected.txt: Added. >+ * editing/spelling/spelling-should-select-single-word.html: Added. >+ * editing/spelling/spelling-subword-selection-expected.txt: Added. >+ * editing/spelling/spelling-subword-selection.html: Added. >+ * editing/spelling/spelling-with-punctuation-selection-expected.txt: Added. >+ * editing/spelling/spelling-with-punctuation-selection.html: Added. >+ * editing/spelling/spelling-with-underscore-selection-expected.txt: Added. >+ * editing/spelling/spelling-with-underscore-selection.html: Added. >+ * editing/spelling/spelling-with-whitespace-selection-expected.txt: Added. >+ * editing/spelling/spelling-with-whitespace-selection.html: Added. >+ * platform/mac-wk2/TestExpectations: Skipping the new spellcheck tests because Mac WK2 does not implement setAsynchronousSpellCheckingEnabled. >+ * platform/mac/editing/spelling/spelling-double-clicked-word-expected.txt: Added. >+ * platform/mac/editing/spelling/spelling-double-clicked-word-with-underscores-expected.txt: Added. >+ * platform/mac/editing/spelling/spelling-exactly-selected-multiple-words-expected.txt: Added. >+ * platform/mac/editing/spelling/spelling-exactly-selected-word-expected.txt: Added. >+ * platform/mac/editing/spelling/spelling-should-select-multiple-words-expected.txt: Added. >+ * platform/mac/editing/spelling/spelling-should-select-single-word-expected.txt: Added. >+ * platform/mac/editing/spelling/spelling-with-punctuation-selection-expected.txt: Added. >+ * platform/mac/editing/spelling/spelling-with-underscore-selection-expected.txt: Added. >+ * platform/mac/editing/spelling/spelling-with-whitespace-selection-expected.txt: Added. >+ > 2013-01-30 Jessie Berlin <jberlin@apple.com> > > Revert r138912, the right fix for https://bugs.webkit.org/show_bug.cgi?id=106187 is in >diff --git a/LayoutTests/editing/spelling/resources/util.js b/LayoutTests/editing/spelling/resources/util.js >new file mode 100644 >index 0000000000000000000000000000000000000000..cf8033418843cf20c6671e7c84907b7072d49520 >--- /dev/null >+++ b/LayoutTests/editing/spelling/resources/util.js >@@ -0,0 +1,38 @@ >+function log(msg) >+{ >+ document.getElementById("console").innerHTML += (msg + "\n"); >+} >+ >+function verifySpellTest(nretry) >+{ >+ if (!nretry) { >+ log("FAIL Spellcheck timed out"); >+ finishJSTest() >+ return; >+ } >+ if (!internals.markerCountForNode(destination.childNodes[0], "spelling")) { >+ window.setTimeout(function() { verifySpellTest(nretry - 1); }, 0); >+ return; >+ } >+ testFunctionCallback(destination.childNodes[0]); >+ finishJSTest() >+} >+ >+function initSpellTest(testElementId, testText, testFunction) >+{ >+ if (!window.internals || !window.testRunner || !window.testRunner.setAsynchronousSpellCheckingEnabled) { >+ log("FAIL Incomplete test environment"); >+ return; >+ } >+ testFunctionCallback = testFunction; >+ jsTestIsAsync = true; >+ testRunner.setAsynchronousSpellCheckingEnabled(true); >+ testRunner.setSmartInsertDeleteEnabled(true); >+ testRunner.setSelectTrailingWhitespaceEnabled(false); >+ internals.settings.setUnifiedTextCheckerEnabled(true); >+ internals.settings.setEditingBehavior("win"); >+ var destination = document.getElementById(testElementId); >+ destination.focus(); >+ document.execCommand("InsertText", false, testText); >+ window.setTimeout(function() { verifySpellTest(10); }, 0); >+} >diff --git a/LayoutTests/editing/spelling/spelling-double-clicked-word-expected.txt b/LayoutTests/editing/spelling/spelling-double-clicked-word-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..ff54cd92c31269301e9a13d42a1f991be0958ef1 >--- /dev/null >+++ b/LayoutTests/editing/spelling/spelling-double-clicked-word-expected.txt >@@ -0,0 +1,20 @@ >+Spelling should work for double-clicked misspellings. To test manually, type 'wellcome home.', double-click on 'wellcome', and context-click on the selection. The test succeeds when the context menu shows spell check suggestions. >+ >+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". >+ >+ >+PASS spellingMarkerRange.toString() is "wellcome" >+PASS window.getSelection().toString() is "" >+PASS window.getSelection().toString() is "wellcome" >+PASS spellingMarkerRange.toString() is "wellcome" >+PASS window.getSelection().toString() is "wellcome" >+PASS contextMenuElements[contextMenuElements.length - 1] is "welcome" >+PASS window.getSelection().toString() is "" >+PASS window.getSelection().toString() is "wellcome " >+PASS spellingMarkerRange.toString() is "wellcome" >+PASS window.getSelection().toString() is "wellcome " >+PASS contextMenuElements[contextMenuElements.length - 1] is "welcome" >+PASS successfullyParsed is true >+ >+TEST COMPLETE >+wellcome home. >diff --git a/LayoutTests/editing/spelling/spelling-double-clicked-word-with-underscores-expected.txt b/LayoutTests/editing/spelling/spelling-double-clicked-word-with-underscores-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..4e5b56f338c11c424ccf647d0dc74fb0d648dc68 >--- /dev/null >+++ b/LayoutTests/editing/spelling/spelling-double-clicked-word-with-underscores-expected.txt >@@ -0,0 +1,20 @@ >+Spelling should work for double-clicked misspelled words with underscores. To test manually, type 'wellcome_ home.', double-click on 'wellcome_', and context-click on the selection. The test succeeds when the context menu shows spell check suggestions. >+ >+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". >+ >+ >+PASS spellingMarkerRange.toString() is "wellcome" >+PASS window.getSelection().toString() is "" >+PASS window.getSelection().toString() is "wellcome_" >+PASS spellingMarkerRange.toString() is "wellcome" >+PASS window.getSelection().toString() is "wellcome_" >+PASS contextMenuElements[contextMenuElements.length - 1] is "welcome" >+PASS window.getSelection().toString() is "" >+PASS window.getSelection().toString() is "wellcome_ " >+PASS spellingMarkerRange.toString() is "wellcome" >+PASS window.getSelection().toString() is "wellcome_ " >+PASS contextMenuElements[contextMenuElements.length - 1] is "welcome" >+PASS successfullyParsed is true >+ >+TEST COMPLETE >+wellcome_ home. >diff --git a/LayoutTests/editing/spelling/spelling-double-clicked-word-with-underscores.html b/LayoutTests/editing/spelling/spelling-double-clicked-word-with-underscores.html >new file mode 100644 >index 0000000000000000000000000000000000000000..ca5935fe0005a5a061352cf9a23ef63123b16a36 >--- /dev/null >+++ b/LayoutTests/editing/spelling/spelling-double-clicked-word-with-underscores.html >@@ -0,0 +1,80 @@ >+<!DOCTYPE html> >+<html> >+<head> >+<script src="../../fast/js/resources/js-test-pre.js"></script> >+<script src="resources/util.js"></script> >+</head> >+<body> >+<div id="container"> >+ <div id="destination" contentEditable></div> >+</div> >+ >+<script> >+ >+description("Spelling should work for double-clicked misspelled words with underscores. " + >+ "To test manually, type 'wellcome_ home.', double-click on 'wellcome_', and context-click on the selection. " + >+ "The test succeeds when the context menu shows spell check suggestions."); >+ >+initSpellTest("destination", "wellcome_ home.", function(textNode) { >+ spellingMarkerRange = internals.markerRangeForNode(textNode, "spelling", 0); >+ shouldBeEqualToString("spellingMarkerRange.toString()", "wellcome"); >+ shouldBeEqualToString("window.getSelection().toString()", ""); >+ >+ // Double-click the misspelled word without the trailing whitespace. >+ testRunner.setSelectTrailingWhitespaceEnabled(false); >+ var x = destination.offsetParent.offsetLeft + destination.offsetLeft + 40; >+ var y = destination.offsetParent.offsetTop + destination.offsetTop + destination.offsetHeight / 2; >+ eventSender.mouseMoveTo(x, y); >+ eventSender.mouseDown(); >+ eventSender.mouseUp(); >+ eventSender.mouseDown(); >+ eventSender.mouseUp(); >+ >+ shouldBeEqualToString("window.getSelection().toString()", "wellcome_"); >+ >+ // Context click on "wellcome_" to show the context menu. >+ x = destination.offsetParent.offsetLeft + destination.offsetLeft + 40; >+ y = destination.offsetParent.offsetTop + destination.offsetTop + destination.offsetHeight / 2; >+ eventSender.mouseMoveTo(x, y); >+ contextMenuElements = eventSender.contextClick(); >+ // Esc key to hide the context menu. >+ eventSender.keyDown(String.fromCharCode(0x001B), null); >+ >+ spellingMarkerRange = internals.markerRangeForNode(textNode, "spelling", 0); >+ shouldBeEqualToString("spellingMarkerRange.toString()", "wellcome"); >+ shouldBeEqualToString("window.getSelection().toString()", "wellcome_"); >+ shouldBeEqualToString("contextMenuElements[contextMenuElements.length - 1]", "welcome"); >+ >+ window.getSelection().removeAllRanges(); >+ shouldBeEqualToString("window.getSelection().toString()", ""); >+ >+ // Double-click the misspelled word with the trailing whitespace. >+ testRunner.setSelectTrailingWhitespaceEnabled(true); >+ var x = destination.offsetParent.offsetLeft + destination.offsetLeft + 40; >+ var y = destination.offsetParent.offsetTop + destination.offsetTop + destination.offsetHeight / 2; >+ eventSender.mouseMoveTo(x, y); >+ eventSender.mouseDown(); >+ eventSender.mouseUp(); >+ eventSender.mouseDown(); >+ eventSender.mouseUp(); >+ >+ shouldBeEqualToString("window.getSelection().toString()", "wellcome_ "); >+ >+ // Context click on "wellcome_ " to show the context menu. >+ x = destination.offsetParent.offsetLeft + destination.offsetLeft + 40; >+ y = destination.offsetParent.offsetTop + destination.offsetTop + destination.offsetHeight / 2; >+ eventSender.mouseMoveTo(x, y); >+ contextMenuElements = eventSender.contextClick(); >+ // Esc key to hide the context menu. >+ eventSender.keyDown(String.fromCharCode(0x001B), null); >+ >+ spellingMarkerRange = internals.markerRangeForNode(textNode, "spelling", 0); >+ shouldBeEqualToString("spellingMarkerRange.toString()", "wellcome"); >+ shouldBeEqualToString("window.getSelection().toString()", "wellcome_ "); >+ shouldBeEqualToString("contextMenuElements[contextMenuElements.length - 1]", "welcome"); >+}); >+ >+</script> >+<script src="../../fast/js/resources/js-test-post.js"></script> >+</body> >+</html> >diff --git a/LayoutTests/editing/spelling/spelling-double-clicked-word.html b/LayoutTests/editing/spelling/spelling-double-clicked-word.html >new file mode 100644 >index 0000000000000000000000000000000000000000..249273d2e0abab9d9bcec927a09c3fc46ce027cf >--- /dev/null >+++ b/LayoutTests/editing/spelling/spelling-double-clicked-word.html >@@ -0,0 +1,79 @@ >+<!DOCTYPE html> >+<html> >+<head> >+<script src="../../fast/js/resources/js-test-pre.js"></script> >+<script src="resources/util.js"></script> >+</head> >+<body> >+<div id="container"> >+ <div id="destination" contentEditable></div> >+</div> >+ >+<script> >+ >+description("Spelling should work for double-clicked misspellings. " + >+ "To test manually, type 'wellcome home.', double-click on 'wellcome', and context-click on the selection. " + >+ "The test succeeds when the context menu shows spell check suggestions."); >+ >+initSpellTest("destination", "wellcome home.", function(textNode) { >+ spellingMarkerRange = internals.markerRangeForNode(textNode, "spelling", 0); >+ shouldBeEqualToString("spellingMarkerRange.toString()", "wellcome"); >+ shouldBeEqualToString("window.getSelection().toString()", ""); >+ >+ // Double-click the misspelled word without trailing whitespace. >+ testRunner.setSelectTrailingWhitespaceEnabled(false); >+ var x = destination.offsetParent.offsetLeft + destination.offsetLeft + 40; >+ var y = destination.offsetParent.offsetTop + destination.offsetTop + destination.offsetHeight / 2; >+ eventSender.mouseMoveTo(x, y); >+ eventSender.mouseDown(); >+ eventSender.mouseUp(); >+ eventSender.mouseDown(); >+ eventSender.mouseUp(); >+ >+ shouldBeEqualToString("window.getSelection().toString()", "wellcome"); >+ >+ // Context click on "wellcome" to show the context menu. >+ x = destination.offsetParent.offsetLeft + destination.offsetLeft + 40; >+ y = destination.offsetParent.offsetTop + destination.offsetTop + destination.offsetHeight / 2; >+ eventSender.mouseMoveTo(x, y); >+ contextMenuElements = eventSender.contextClick(); >+ // Esc key to hide the context menu. >+ eventSender.keyDown(String.fromCharCode(0x001B), null); >+ >+ spellingMarkerRange = internals.markerRangeForNode(textNode, "spelling", 0); >+ shouldBeEqualToString("spellingMarkerRange.toString()", "wellcome"); >+ shouldBeEqualToString("window.getSelection().toString()", "wellcome"); >+ shouldBeEqualToString("contextMenuElements[contextMenuElements.length - 1]", "welcome"); >+ >+ window.getSelection().removeAllRanges(); >+ shouldBeEqualToString("window.getSelection().toString()", ""); >+ >+ // Double-click the misspelled word with trailing whitespace. >+ testRunner.setSelectTrailingWhitespaceEnabled(true); >+ var x = destination.offsetParent.offsetLeft + destination.offsetLeft + 40; >+ var y = destination.offsetParent.offsetTop + destination.offsetTop + destination.offsetHeight / 2; >+ eventSender.mouseMoveTo(x, y); >+ eventSender.mouseDown(); >+ eventSender.mouseUp(); >+ eventSender.mouseDown(); >+ eventSender.mouseUp(); >+ shouldBeEqualToString("window.getSelection().toString()", "wellcome "); >+ >+ // Context click on "wellcome " to show the context menu. >+ x = destination.offsetParent.offsetLeft + destination.offsetLeft + 40; >+ y = destination.offsetParent.offsetTop + destination.offsetTop + destination.offsetHeight / 2; >+ eventSender.mouseMoveTo(x, y); >+ contextMenuElements = eventSender.contextClick(); >+ // Esc key to hide the context menu. >+ eventSender.keyDown(String.fromCharCode(0x001B), null); >+ >+ spellingMarkerRange = internals.markerRangeForNode(textNode, "spelling", 0); >+ shouldBeEqualToString("spellingMarkerRange.toString()", "wellcome"); >+ shouldBeEqualToString("window.getSelection().toString()", "wellcome "); >+ shouldBeEqualToString("contextMenuElements[contextMenuElements.length - 1]", "welcome"); >+}); >+ >+</script> >+<script src="../../fast/js/resources/js-test-post.js"></script> >+</body> >+</html> >diff --git a/LayoutTests/editing/spelling/spelling-exactly-selected-multiple-words-expected.txt b/LayoutTests/editing/spelling/spelling-exactly-selected-multiple-words-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..44a79475e576fbb87981b62e67b51a4827ccf62d >--- /dev/null >+++ b/LayoutTests/editing/spelling/spelling-exactly-selected-multiple-words-expected.txt >@@ -0,0 +1,14 @@ >+Spelling should work when the user selects a multi-word misspelling exactly. To test manually, enable 'Ask Google for Suggestions' in Chrome, type 'It should be upper case.', select 'upper case', and context-click on the selection.The test succeeds when the context menu shows spelling suggestions. >+ >+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". >+ >+ >+PASS spellingMarkerRange.toString() is "upper case" >+PASS window.getSelection().toString() is "" >+PASS window.getSelection().toString() is "upper case" >+PASS spellingMarkerRange.toString() is "upper case" >+PASS window.getSelection().toString() is "upper case" >+PASS successfullyParsed is true >+ >+TEST COMPLETE >+It should be upper case. >diff --git a/LayoutTests/editing/spelling/spelling-exactly-selected-multiple-words.html b/LayoutTests/editing/spelling/spelling-exactly-selected-multiple-words.html >new file mode 100644 >index 0000000000000000000000000000000000000000..3d3254fb468b874723ee5c6a4c8c194bf60a9293 >--- /dev/null >+++ b/LayoutTests/editing/spelling/spelling-exactly-selected-multiple-words.html >@@ -0,0 +1,47 @@ >+<!DOCTYPE html> >+<html> >+<head> >+<script src="../../fast/js/resources/js-test-pre.js"></script> >+<script src="resources/util.js"></script> >+</head> >+<body> >+<div id="container"> >+ <div id="destination" contentEditable></div> >+</div> >+<script> >+ >+description("Spelling should work when the user selects a multi-word misspelling exactly. " + >+ "To test manually, enable 'Ask Google for Suggestions' in Chrome, type 'It should be upper case.', select 'upper case', and context-click on the selection." + >+ "The test succeeds when the context menu shows spelling suggestions."); >+ >+initSpellTest("destination", "It should be upper case.", function(textNode) { >+ spellingMarkerRange = internals.markerRangeForNode(textNode, "spelling", 0); >+ shouldBeEqualToString("spellingMarkerRange.toString()", "upper case"); >+ shouldBeEqualToString("window.getSelection().toString()", ""); >+ >+ // Select the multi-word misspelling without surrounding whitespace or punctuation. >+ var wordRange = document.createRange(); >+ wordRange.setStart(textNode, 13); >+ wordRange.setEnd(textNode, 23); >+ window.getSelection().removeAllRanges(); >+ window.getSelection().addRange(wordRange); >+ >+ shouldBeEqualToString("window.getSelection().toString()", "upper case"); >+ >+ // Context click on "upper case" to show the context menu. >+ var x = destination.offsetParent.offsetLeft + destination.offsetLeft + 100; >+ var y = destination.offsetParent.offsetTop + destination.offsetTop + destination.offsetHeight / 2; >+ eventSender.mouseMoveTo(x, y); >+ contextMenuElements = eventSender.contextClick(); >+ // Esc key to hide the context menu. >+ eventSender.keyDown(String.fromCharCode(0x001B), null); >+ >+ spellingMarkerRange = internals.markerRangeForNode(textNode, "spelling", 0); >+ shouldBeEqualToString("spellingMarkerRange.toString()", "upper case"); >+ shouldBeEqualToString("window.getSelection().toString()", "upper case"); >+}); >+ >+</script> >+<script src="../../fast/js/resources/js-test-post.js"></script> >+</body> >+</html> >diff --git a/LayoutTests/editing/spelling/spelling-exactly-selected-word-expected.txt b/LayoutTests/editing/spelling/spelling-exactly-selected-word-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..34e36cf0439104996f0caf156b3e9931a188e383 >--- /dev/null >+++ b/LayoutTests/editing/spelling/spelling-exactly-selected-word-expected.txt >@@ -0,0 +1,18 @@ >+Spelling should work when the user selects the misspelled word exactly. To test manually, type 'wellcome home.', select 'wellcome', and context-click on the selection. The test succeeds when the context menu shows spelling suggestions. >+ >+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". >+ >+ >+PASS spellingMarkerRange.toString() is "wellcome" >+PASS window.getSelection().toString() is "" >+PASS window.getSelection().toString() is "wellcome" >+PASS spellingMarkerRange.toString() is "wellcome" >+PASS window.getSelection().toString() is "wellcome" >+PASS contextMenuElements[contextMenuElements.length - 1] is "welcome" >+PASS window.getSelection().toString() is "home" >+PASS window.getSelection().toString() is "home" >+PASS contextMenuElements[contextMenuElements.length - 1] is "<separator>" >+PASS successfullyParsed is true >+ >+TEST COMPLETE >+wellcome home. >diff --git a/LayoutTests/editing/spelling/spelling-exactly-selected-word.html b/LayoutTests/editing/spelling/spelling-exactly-selected-word.html >new file mode 100644 >index 0000000000000000000000000000000000000000..221d96d87c04d9731abcb0fa357cb27578ed86cb >--- /dev/null >+++ b/LayoutTests/editing/spelling/spelling-exactly-selected-word.html >@@ -0,0 +1,67 @@ >+<!DOCTYPE html> >+<html> >+<head> >+<script src="../../fast/js/resources/js-test-pre.js"></script> >+<script src="resources/util.js"></script> >+</head> >+<body> >+<div id="container"> >+ <div id="destination" contentEditable></div> >+</div> >+ >+<script> >+ >+description("Spelling should work when the user selects the misspelled word exactly. " + >+ "To test manually, type 'wellcome home.', select 'wellcome', and context-click on the selection. " + >+ "The test succeeds when the context menu shows spelling suggestions."); >+ >+initSpellTest("destination", "wellcome home.", function(textNode) { >+ spellingMarkerRange = internals.markerRangeForNode(textNode, "spelling", 0); >+ shouldBeEqualToString("spellingMarkerRange.toString()", "wellcome"); >+ shouldBeEqualToString("window.getSelection().toString()", ""); >+ >+ // Select the misspelled word without surrounding whitespace or punctuation. >+ var wordRange = document.createRange(); >+ wordRange.setStart(textNode, 0); >+ wordRange.setEnd(textNode, 8); >+ window.getSelection().removeAllRanges(); >+ window.getSelection().addRange(wordRange); >+ >+ shouldBeEqualToString("window.getSelection().toString()", "wellcome"); >+ >+ // Context click on "wellcome" to show the context menu. >+ var x = destination.offsetParent.offsetLeft + destination.offsetLeft + 40; >+ var y = destination.offsetParent.offsetTop + destination.offsetTop + destination.offsetHeight / 2; >+ eventSender.mouseMoveTo(x, y); >+ contextMenuElements = eventSender.contextClick(); >+ // Esc key to hide the context menu. >+ eventSender.keyDown(String.fromCharCode(0x001B), null); >+ >+ spellingMarkerRange = internals.markerRangeForNode(textNode, "spelling", 0); >+ shouldBeEqualToString("spellingMarkerRange.toString()", "wellcome"); >+ shouldBeEqualToString("window.getSelection().toString()", "wellcome"); >+ shouldBeEqualToString("contextMenuElements[contextMenuElements.length - 1]", "welcome"); >+ >+ // Select a correctly spelled word without surrounding whitespace or punctuation. >+ wordRange.setStart(textNode, 9); >+ wordRange.setEnd(textNode, 13); >+ window.getSelection().removeAllRanges(); >+ window.getSelection().addRange(wordRange); >+ shouldBeEqualToString("window.getSelection().toString()", "home"); >+ >+ // Context click on "home" to show the context menu. >+ var x = destination.offsetParent.offsetLeft + destination.offsetLeft + 80; >+ var y = destination.offsetParent.offsetTop + destination.offsetTop + destination.offsetHeight / 2; >+ eventSender.mouseMoveTo(x, y); >+ contextMenuElements = eventSender.contextClick(); >+ // Esc key to hide the context menu. >+ eventSender.keyDown(String.fromCharCode(0x001B), null); >+ >+ shouldBeEqualToString("window.getSelection().toString()", "home"); >+ shouldBeEqualToString("contextMenuElements[contextMenuElements.length - 1]", "<separator>"); >+}); >+ >+</script> >+<script src="../../fast/js/resources/js-test-post.js"></script> >+</body> >+</html> >diff --git a/LayoutTests/editing/spelling/spelling-multiword-selection-expected.txt b/LayoutTests/editing/spelling/spelling-multiword-selection-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..9f0dd2be09f8feaec63036775272031e864101ee >--- /dev/null >+++ b/LayoutTests/editing/spelling/spelling-multiword-selection-expected.txt >@@ -0,0 +1,15 @@ >+Spelling should be disabled when user selects multiple words that are not a single misspelling. To test manually, type 'wellcome home.', select 'wellcome home', and context-click on the selection. The test suceeds when the context menu has no spell check suggestions. >+ >+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". >+ >+ >+PASS spellingMarkerRange.toString() is "wellcome" >+PASS window.getSelection().toString() is "" >+PASS window.getSelection().toString() is "wellcome home" >+PASS spellingMarkerRange.toString() is "wellcome" >+PASS window.getSelection().toString() is "wellcome home" >+PASS contextMenuElements[contextMenuElements.length - 1] is "<separator>" >+PASS successfullyParsed is true >+ >+TEST COMPLETE >+wellcome home. >diff --git a/LayoutTests/editing/spelling/spelling-multiword-selection.html b/LayoutTests/editing/spelling/spelling-multiword-selection.html >new file mode 100644 >index 0000000000000000000000000000000000000000..e027b97bc714c1d8d0c60e072892804341646be9 >--- /dev/null >+++ b/LayoutTests/editing/spelling/spelling-multiword-selection.html >@@ -0,0 +1,49 @@ >+<!DOCTYPE html> >+<html> >+<head> >+<script src="../../fast/js/resources/js-test-pre.js"></script> >+<script src="resources/util.js"></script> >+</head> >+<body> >+<div id="container"> >+ <div id="destination" contentEditable></div> >+</div> >+ >+<script> >+ >+description("Spelling should be disabled when user selects multiple words that are not a single misspelling. " + >+ "To test manually, type 'wellcome home.', select 'wellcome home', and context-click on the selection. " + >+ "The test suceeds when the context menu has no spell check suggestions."); >+ >+initSpellTest("destination", "wellcome home.", function(textNode) { >+ spellingMarkerRange = internals.markerRangeForNode(textNode, "spelling", 0); >+ shouldBeEqualToString("spellingMarkerRange.toString()", "wellcome"); >+ shouldBeEqualToString("window.getSelection().toString()", ""); >+ >+ // Select the text "wellcome home". >+ var multiWordRange = document.createRange(); >+ multiWordRange.setStart(textNode, 0); >+ multiWordRange.setEnd(textNode, 13); >+ window.getSelection().removeAllRanges(); >+ window.getSelection().addRange(multiWordRange); >+ >+ shouldBeEqualToString("window.getSelection().toString()", "wellcome home"); >+ >+ // Context click to show the context menu. >+ var x = destination.offsetParent.offsetLeft + destination.offsetLeft + 40; >+ var y = destination.offsetParent.offsetTop + destination.offsetTop + destination.offsetHeight / 2; >+ eventSender.mouseMoveTo(x, y); >+ contextMenuElements = eventSender.contextClick(); >+ // Esc key to hide the context menu. >+ eventSender.keyDown(String.fromCharCode(0x001B), null); >+ >+ spellingMarkerRange = internals.markerRangeForNode(textNode, "spelling", 0); >+ shouldBeEqualToString("spellingMarkerRange.toString()", "wellcome"); >+ shouldBeEqualToString("window.getSelection().toString()", "wellcome home"); >+ shouldBeEqualToString("contextMenuElements[contextMenuElements.length - 1]", "<separator>"); >+}); >+ >+</script> >+<script src="../../fast/js/resources/js-test-post.js"></script> >+</body> >+</html> >diff --git a/LayoutTests/editing/spelling/spelling-should-select-multiple-words-expected.txt b/LayoutTests/editing/spelling/spelling-should-select-multiple-words-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..b6a454168adc97d1c7d6de40a3fe7a7ad0b294ca >--- /dev/null >+++ b/LayoutTests/editing/spelling/spelling-should-select-multiple-words-expected.txt >@@ -0,0 +1,13 @@ >+Spell check should select multi-word misspellings on context click. To test manually, enable 'Ask Google for Suggestions' in Chrome, type 'It should be upper case.', and context-click on the word 'upper'. The test succeeds when 'upper case' was selected after context click. >+ >+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". >+ >+ >+PASS spellingMarkerRange.toString() is "upper case" >+PASS window.getSelection().toString() is "" >+PASS spellingMarkerRange.toString() is "upper case" >+PASS window.getSelection().toString() is "upper case" >+PASS successfullyParsed is true >+ >+TEST COMPLETE >+It should be upper case. >diff --git a/LayoutTests/editing/spelling/spelling-should-select-multiple-words.html b/LayoutTests/editing/spelling/spelling-should-select-multiple-words.html >new file mode 100644 >index 0000000000000000000000000000000000000000..cdf042837b145630409c808f5f84452355679435 >--- /dev/null >+++ b/LayoutTests/editing/spelling/spelling-should-select-multiple-words.html >@@ -0,0 +1,38 @@ >+<!DOCTYPE html> >+<html> >+<head> >+<script src="../../fast/js/resources/js-test-pre.js"></script> >+<script src="resources/util.js"></script> >+</head> >+<body> >+<div id="container"> >+ <div id="destination" contentEditable></div> >+</div> >+<script> >+ >+description("Spell check should select multi-word misspellings on context click. "+ >+ "To test manually, enable 'Ask Google for Suggestions' in Chrome, type 'It should be upper case.', and context-click on the word 'upper'. " + >+ "The test succeeds when 'upper case' was selected after context click."); >+ >+initSpellTest("destination", "It should be upper case.", function(textNode) { >+ spellingMarkerRange = internals.markerRangeForNode(textNode, "spelling", 0); >+ shouldBeEqualToString("spellingMarkerRange.toString()", "upper case"); >+ shouldBeEqualToString("window.getSelection().toString()", ""); >+ >+ // Context click on "upper case" to show the context menu. >+ var x = destination.offsetParent.offsetLeft + destination.offsetLeft + 100; >+ var y = destination.offsetParent.offsetTop + destination.offsetTop + destination.offsetHeight / 2; >+ eventSender.mouseMoveTo(x, y); >+ contextMenuElements = eventSender.contextClick(); >+ // Esc key to hide the context menu. >+ eventSender.keyDown(String.fromCharCode(0x001B), null); >+ >+ spellingMarkerRange = internals.markerRangeForNode(textNode, "spelling", 0); >+ shouldBeEqualToString("spellingMarkerRange.toString()", "upper case"); >+ shouldBeEqualToString("window.getSelection().toString()", "upper case"); >+}); >+ >+</script> >+<script src="../../fast/js/resources/js-test-post.js"></script> >+</body> >+</html> >diff --git a/LayoutTests/editing/spelling/spelling-should-select-single-word-expected.txt b/LayoutTests/editing/spelling/spelling-should-select-single-word-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..6a8d0866a337880d19dea4b2ca1c883fcbec212b >--- /dev/null >+++ b/LayoutTests/editing/spelling/spelling-should-select-single-word-expected.txt >@@ -0,0 +1,17 @@ >+Spell check selects the misspelled word on context click. To test manually, type 'wellcome home.' and context-click on 'wellcome'. The test succeeds when 'wellcome' is selected after the context click. >+ >+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". >+ >+ >+PASS spellingMarkerRange.toString() is "wellcome" >+PASS window.getSelection().toString() is "" >+PASS spellingMarkerRange.toString() is "wellcome" >+PASS window.getSelection().toString() is "wellcome" >+PASS contextMenuElements[contextMenuElements.length - 1] is "welcome" >+PASS window.getSelection().toString() is "" >+PASS window.getSelection().toString() is "" >+PASS contextMenuElements[contextMenuElements.length - 1] is "<separator>" >+PASS successfullyParsed is true >+ >+TEST COMPLETE >+wellcome home. >diff --git a/LayoutTests/editing/spelling/spelling-should-select-single-word.html b/LayoutTests/editing/spelling/spelling-should-select-single-word.html >new file mode 100644 >index 0000000000000000000000000000000000000000..0b8284a949ea0e90cb014af0267f7574c48644e8 >--- /dev/null >+++ b/LayoutTests/editing/spelling/spelling-should-select-single-word.html >@@ -0,0 +1,55 @@ >+<!DOCTYPE html> >+<html> >+<head> >+<script src="../../fast/js/resources/js-test-pre.js"></script> >+<script src="resources/util.js"></script> >+</head> >+<body> >+<div id="container"> >+ <div id="destination" contentEditable></div> >+</div> >+ >+<script> >+ >+description("Spell check selects the misspelled word on context click. " + >+ "To test manually, type 'wellcome home.' and context-click on 'wellcome'. " + >+ "The test succeeds when 'wellcome' is selected after the context click."); >+ >+initSpellTest("destination", "wellcome home.", function(textNode) { >+ spellingMarkerRange = internals.markerRangeForNode(textNode, "spelling", 0); >+ shouldBeEqualToString("spellingMarkerRange.toString()", "wellcome"); >+ shouldBeEqualToString("window.getSelection().toString()", ""); >+ >+ // Context click on "wellcome" to show the context menu. >+ var x = destination.offsetParent.offsetLeft + destination.offsetLeft + 40; >+ var y = destination.offsetParent.offsetTop + destination.offsetTop + destination.offsetHeight / 2; >+ eventSender.mouseMoveTo(x, y); >+ contextMenuElements = eventSender.contextClick(); >+ // Esc key to hide the context menu. >+ eventSender.keyDown(String.fromCharCode(0x001B), null); >+ >+ spellingMarkerRange = internals.markerRangeForNode(textNode, "spelling", 0); >+ shouldBeEqualToString("spellingMarkerRange.toString()", "wellcome"); >+ shouldBeEqualToString("window.getSelection().toString()", "wellcome"); >+ shouldBeEqualToString("contextMenuElements[contextMenuElements.length - 1]", "welcome"); >+ >+ window.getSelection().removeAllRanges(); >+ shouldBeEqualToString("window.getSelection().toString()", ""); >+ >+ // Context click on "home" to show the context menu. >+ var x = destination.offsetParent.offsetLeft + destination.offsetLeft + 80; >+ var y = destination.offsetParent.offsetTop + destination.offsetTop + destination.offsetHeight / 2; >+ eventSender.mouseMoveTo(x, y); >+ contextMenuElements = eventSender.contextClick(); >+ // Esc key to hide the context menu. >+ eventSender.keyDown(String.fromCharCode(0x001B), null); >+ >+ // Context click should not select correctly spelled words with "win" editing behavior. >+ shouldBeEqualToString("window.getSelection().toString()", ""); >+ shouldBeEqualToString("contextMenuElements[contextMenuElements.length - 1]", "<separator>"); >+}); >+ >+</script> >+<script src="../../fast/js/resources/js-test-post.js"></script> >+</body> >+</html> >diff --git a/LayoutTests/editing/spelling/spelling-subword-selection-expected.txt b/LayoutTests/editing/spelling/spelling-subword-selection-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..097ee76ea14a505fd94ff868840b9f732d5a5b09 >--- /dev/null >+++ b/LayoutTests/editing/spelling/spelling-subword-selection-expected.txt >@@ -0,0 +1,15 @@ >+Spelling should be disabled when user selects a part of misspelling. To test manually, type 'wellcome home.' select 'llco', and context-click on the selection. The test suceeds when the context menu has no spell check suggestions. >+ >+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". >+ >+ >+PASS spellingMarkerRange.toString() is "wellcome" >+PASS window.getSelection().toString() is "" >+PASS window.getSelection().toString() is "llco" >+PASS spellingMarkerRange.toString() is "wellcome" >+PASS window.getSelection().toString() is "llco" >+PASS contextMenuElements[contextMenuElements.length - 1] is "<separator>" >+PASS successfullyParsed is true >+ >+TEST COMPLETE >+wellcome home. >diff --git a/LayoutTests/editing/spelling/spelling-subword-selection.html b/LayoutTests/editing/spelling/spelling-subword-selection.html >new file mode 100644 >index 0000000000000000000000000000000000000000..f9bc85dac2a9830a3f164e74d7b153f06018edf3 >--- /dev/null >+++ b/LayoutTests/editing/spelling/spelling-subword-selection.html >@@ -0,0 +1,49 @@ >+<!DOCTYPE html> >+<html> >+<head> >+<script src="../../fast/js/resources/js-test-pre.js"></script> >+<script src="resources/util.js"></script> >+</head> >+<body> >+<div id="container"> >+ <div id="destination" contentEditable></div> >+</div> >+ >+<script> >+ >+description("Spelling should be disabled when user selects a part of misspelling. " + >+ "To test manually, type 'wellcome home.' select 'llco', and context-click on the selection. " + >+ "The test suceeds when the context menu has no spell check suggestions."); >+ >+initSpellTest("destination", "wellcome home.", function(textNode) { >+ spellingMarkerRange = internals.markerRangeForNode(textNode, "spelling", 0); >+ shouldBeEqualToString("spellingMarkerRange.toString()", "wellcome"); >+ shouldBeEqualToString("window.getSelection().toString()", ""); >+ >+ // Select the text "llco". >+ var subWordRange = document.createRange(); >+ subWordRange.setStart(textNode, 2); >+ subWordRange.setEnd(textNode, 6); >+ window.getSelection().removeAllRanges(); >+ window.getSelection().addRange(subWordRange); >+ >+ shouldBeEqualToString("window.getSelection().toString()", "llco"); >+ >+ // Context click on 'llco' to show the context menu. >+ var x = destination.offsetParent.offsetLeft + destination.offsetLeft + 40; >+ var y = destination.offsetParent.offsetTop + destination.offsetTop + destination.offsetHeight / 2; >+ eventSender.mouseMoveTo(x, y); >+ contextMenuElements = eventSender.contextClick(); >+ // Esc key to hide the context menu. >+ eventSender.keyDown(String.fromCharCode(0x001B), null); >+ >+ spellingMarkerRange = internals.markerRangeForNode(textNode, "spelling", 0); >+ shouldBeEqualToString("spellingMarkerRange.toString()", "wellcome"); >+ shouldBeEqualToString("window.getSelection().toString()", "llco"); >+ shouldBeEqualToString("contextMenuElements[contextMenuElements.length - 1]", "<separator>"); >+}); >+ >+</script> >+<script src="../../fast/js/resources/js-test-post.js"></script> >+</body> >+</html> >diff --git a/LayoutTests/editing/spelling/spelling-with-punctuation-selection-expected.txt b/LayoutTests/editing/spelling/spelling-with-punctuation-selection-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..822180d0fb01fd512f39d29591917239f6d3f8dc >--- /dev/null >+++ b/LayoutTests/editing/spelling/spelling-with-punctuation-selection-expected.txt >@@ -0,0 +1,15 @@ >+Punctuation marks should be treated as whitespace: spelling should ignore them. To test manually, type 'wellcome!', select 'wellcome!', and context-click on the selection. The test succeeds when the context menu has spell check suggestions. >+ >+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". >+ >+ >+PASS spellingMarkerRange.toString() is "wellcome" >+PASS window.getSelection().toString() is "" >+PASS window.getSelection().toString() is "wellcome!" >+PASS spellingMarkerRange.toString() is "wellcome" >+PASS window.getSelection().toString() is "wellcome!" >+PASS contextMenuElements[contextMenuElements.length - 1] is "welcome" >+PASS successfullyParsed is true >+ >+TEST COMPLETE >+wellcome! >diff --git a/LayoutTests/editing/spelling/spelling-with-punctuation-selection.html b/LayoutTests/editing/spelling/spelling-with-punctuation-selection.html >new file mode 100644 >index 0000000000000000000000000000000000000000..eb565b70fae1b643be18bdcd886e8e438112f97c >--- /dev/null >+++ b/LayoutTests/editing/spelling/spelling-with-punctuation-selection.html >@@ -0,0 +1,49 @@ >+<!DOCTYPE html> >+<html> >+<head> >+<script src="../../fast/js/resources/js-test-pre.js"></script> >+<script src="resources/util.js"></script> >+</head> >+<body> >+<div id="container"> >+ <div id="destination" contentEditable></div> >+</div> >+ >+<script> >+ >+description("Punctuation marks should be treated as whitespace: spelling should ignore them. " + >+ "To test manually, type 'wellcome!', select 'wellcome!', and context-click on the selection. " + >+ "The test succeeds when the context menu has spell check suggestions."); >+ >+initSpellTest("destination", "wellcome!", function(textNode) { >+ spellingMarkerRange = internals.markerRangeForNode(textNode, "spelling", 0); >+ shouldBeEqualToString("spellingMarkerRange.toString()", "wellcome"); >+ shouldBeEqualToString("window.getSelection().toString()", ""); >+ >+ // Select the text "wellcome!" with the exclamation mark. >+ var range = document.createRange(); >+ range.setStart(textNode, 0); >+ range.setEnd(textNode, 9); >+ window.getSelection().removeAllRanges(); >+ window.getSelection().addRange(range); >+ >+ shouldBeEqualToString("window.getSelection().toString()", "wellcome!"); >+ >+ // Context click to show the context menu. >+ var x = destination.offsetParent.offsetLeft + destination.offsetLeft + 40; >+ var y = destination.offsetParent.offsetTop + destination.offsetTop + destination.offsetHeight / 2; >+ eventSender.mouseMoveTo(x, y); >+ contextMenuElements = eventSender.contextClick(); >+ // Esc key to hide the context menu. >+ eventSender.keyDown(String.fromCharCode(0x001B), null); >+ >+ spellingMarkerRange = internals.markerRangeForNode(textNode, "spelling", 0); >+ shouldBeEqualToString("spellingMarkerRange.toString()", "wellcome"); >+ shouldBeEqualToString("window.getSelection().toString()", "wellcome!"); >+ shouldBeEqualToString("contextMenuElements[contextMenuElements.length - 1]", "welcome"); >+}); >+ >+</script> >+<script src="../../fast/js/resources/js-test-post.js"></script> >+</body> >+</html> >diff --git a/LayoutTests/editing/spelling/spelling-with-underscore-selection-expected.txt b/LayoutTests/editing/spelling/spelling-with-underscore-selection-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..3e14461ef1b4aacad15933a6b7e278a5dfef3afb >--- /dev/null >+++ b/LayoutTests/editing/spelling/spelling-with-underscore-selection-expected.txt >@@ -0,0 +1,15 @@ >+Underscores should be treated as whitespace: spelling should ignore them. To test manually, type 'Hi, _wellcome_ home.', select '_wellcome_', and context-click on the selection. The test succeeds when the context menu has spell check suggestions. >+ >+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". >+ >+ >+PASS spellingMarkerRange.toString() is "wellcome" >+PASS window.getSelection().toString() is "" >+PASS window.getSelection().toString() is "_wellcome_" >+PASS spellingMarkerRange.toString() is "wellcome" >+PASS window.getSelection().toString() is "_wellcome_" >+PASS contextMenuElements[contextMenuElements.length - 1] is "welcome" >+PASS successfullyParsed is true >+ >+TEST COMPLETE >+Hi, _wellcome_ home. >diff --git a/LayoutTests/editing/spelling/spelling-with-underscore-selection.html b/LayoutTests/editing/spelling/spelling-with-underscore-selection.html >new file mode 100644 >index 0000000000000000000000000000000000000000..ab036bb82b9af3342cc6cf556199b32d7048dcf7 >--- /dev/null >+++ b/LayoutTests/editing/spelling/spelling-with-underscore-selection.html >@@ -0,0 +1,49 @@ >+<!DOCTYPE html> >+<html> >+<head> >+<script src="../../fast/js/resources/js-test-pre.js"></script> >+<script src="resources/util.js"></script> >+</head> >+<body> >+<div id="container"> >+ <div id="destination" contentEditable></div> >+</div> >+ >+<script> >+ >+description("Underscores should be treated as whitespace: spelling should ignore them. " + >+ "To test manually, type 'Hi, _wellcome_ home.', select '_wellcome_', and context-click on the selection. " + >+ "The test succeeds when the context menu has spell check suggestions."); >+ >+initSpellTest("destination", "Hi, _wellcome_ home.", function(textNode) { >+ spellingMarkerRange = internals.markerRangeForNode(textNode, "spelling", 0); >+ shouldBeEqualToString("spellingMarkerRange.toString()", "wellcome"); >+ shouldBeEqualToString("window.getSelection().toString()", ""); >+ >+ // Select the text "_wellcome_". >+ var rangeWithUnderscores = document.createRange(); >+ rangeWithUnderscores.setStart(textNode, 4); >+ rangeWithUnderscores.setEnd(textNode, 14); >+ window.getSelection().removeAllRanges(); >+ window.getSelection().addRange(rangeWithUnderscores); >+ >+ shouldBeEqualToString("window.getSelection().toString()", "_wellcome_"); >+ >+ // Context click on "_wellcome_" to show the context menu. >+ var x = destination.offsetParent.offsetLeft + destination.offsetLeft + 80; >+ var y = destination.offsetParent.offsetTop + destination.offsetTop + destination.offsetHeight / 2; >+ eventSender.mouseMoveTo(x, y); >+ contextMenuElements = eventSender.contextClick(); >+ // Esc key to hide the context menu. >+ eventSender.keyDown(String.fromCharCode(0x001B), null); >+ >+ spellingMarkerRange = internals.markerRangeForNode(textNode, "spelling", 0); >+ shouldBeEqualToString("spellingMarkerRange.toString()", "wellcome"); >+ shouldBeEqualToString("window.getSelection().toString()", "_wellcome_"); >+ shouldBeEqualToString("contextMenuElements[contextMenuElements.length - 1]", "welcome"); >+}); >+ >+</script> >+<script src="../../fast/js/resources/js-test-post.js"></script> >+</body> >+</html> >diff --git a/LayoutTests/editing/spelling/spelling-with-whitespace-selection-expected.txt b/LayoutTests/editing/spelling/spelling-with-whitespace-selection-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..84355173a73879fe45b49a298a3cf0c5cf4d5672 >--- /dev/null >+++ b/LayoutTests/editing/spelling/spelling-with-whitespace-selection-expected.txt >@@ -0,0 +1,14 @@ >+Spelling should ignore whitespace. To test manually, type 'hello, wellcome home.', select ' wellcome ', and context-click on the selection. The test succeeds when the context menu has spell check suggestions. >+ >+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". >+ >+ >+PASS spellingMarkerRange.toString() is "wellcome" >+PASS window.getSelection().toString() is " wellcome " >+PASS spellingMarkerRange.toString() is "wellcome" >+PASS window.getSelection().toString() is " wellcome " >+PASS contextMenuElements[contextMenuElements.length - 1] is "welcome" >+PASS successfullyParsed is true >+ >+TEST COMPLETE >+hello, wellcome home. >diff --git a/LayoutTests/editing/spelling/spelling-with-whitespace-selection.html b/LayoutTests/editing/spelling/spelling-with-whitespace-selection.html >new file mode 100644 >index 0000000000000000000000000000000000000000..ae91190b79e9f408935ee4ac7a1ff3a722aff80d >--- /dev/null >+++ b/LayoutTests/editing/spelling/spelling-with-whitespace-selection.html >@@ -0,0 +1,48 @@ >+<!DOCTYPE html> >+<html> >+<head> >+<script src="../../fast/js/resources/js-test-pre.js"></script> >+<script src="resources/util.js"></script> >+</head> >+<body> >+<div id="container"> >+ <div id="destination" contentEditable></div> >+</div> >+ >+<script> >+ >+description("Spelling should ignore whitespace. " + >+ "To test manually, type 'hello, wellcome home.', select ' wellcome ', and context-click on the selection. " + >+ "The test succeeds when the context menu has spell check suggestions."); >+ >+initSpellTest("destination", "hello, wellcome home.", function(textNode) { >+ spellingMarkerRange = internals.markerRangeForNode(textNode, "spelling", 0); >+ shouldBeEqualToString("spellingMarkerRange.toString()", "wellcome"); >+ >+ // Select the text " wellcome " with surrounding whitespace. >+ var rangeWithWhitespace = document.createRange(); >+ rangeWithWhitespace.setStart(textNode, 6); >+ rangeWithWhitespace.setEnd(textNode, 16); >+ window.getSelection().removeAllRanges(); >+ window.getSelection().addRange(rangeWithWhitespace); >+ >+ shouldBeEqualToString("window.getSelection().toString()", " wellcome "); >+ >+ // Context click on " wellcome " to show the context menu. >+ var x = destination.offsetParent.offsetLeft + destination.offsetLeft + 80; >+ var y = destination.offsetParent.offsetTop + destination.offsetTop + destination.offsetHeight / 2; >+ eventSender.mouseMoveTo(x, y); >+ contextMenuElements = eventSender.contextClick(); >+ // Esc key to hide the context menu. >+ eventSender.keyDown(String.fromCharCode(0x001B), null); >+ >+ spellingMarkerRange = internals.markerRangeForNode(textNode, "spelling", 0); >+ shouldBeEqualToString("spellingMarkerRange.toString()", "wellcome"); >+ shouldBeEqualToString("window.getSelection().toString()", " wellcome "); >+ shouldBeEqualToString("contextMenuElements[contextMenuElements.length - 1]", "welcome"); >+}); >+ >+</script> >+<script src="../../fast/js/resources/js-test-post.js"></script> >+</body> >+</html> >diff --git a/LayoutTests/platform/mac-wk2/TestExpectations b/LayoutTests/platform/mac-wk2/TestExpectations >index 0db8078d5fffb8fd7df174e38bd150fac0ef4b3b..c7d3cb0cdae0e5b886195157dcb1f93cce75a3ae 100644 >--- a/LayoutTests/platform/mac-wk2/TestExpectations >+++ b/LayoutTests/platform/mac-wk2/TestExpectations >@@ -310,6 +310,19 @@ webkit.org/b/106405 http/tests/xmlhttprequest/remember-bad-password.html [ Failu > > webkit.org/b/107356 fast/css/sticky/sticky-top-zoomed.html [ ImageOnlyFailure ] > >+# Mac WK2 does not implement setAsynchronousSpellCheckingEnabled. >+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 ] >+ > ### END OF (1) Classified failures with bug reports > ######################################## > >diff --git a/LayoutTests/platform/mac/editing/spelling/spelling-double-clicked-word-expected.txt b/LayoutTests/platform/mac/editing/spelling/spelling-double-clicked-word-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..1f9ae9028f5d993a706d07f07e6a1151889bd624 >--- /dev/null >+++ b/LayoutTests/platform/mac/editing/spelling/spelling-double-clicked-word-expected.txt >@@ -0,0 +1,20 @@ >+Spelling should work for double-clicked misspellings. To test manually, type 'wellcome home.', double-click on 'wellcome', and context-click on the selection. The test succeeds when the context menu shows spell check suggestions. >+ >+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". >+ >+ >+PASS spellingMarkerRange.toString() is "wellcome" >+PASS window.getSelection().toString() is "" >+PASS window.getSelection().toString() is "wellcome" >+PASS spellingMarkerRange.toString() is "wellcome" >+PASS window.getSelection().toString() is "wellcome" >+FAIL contextMenuElements[contextMenuElements.length - 1] should be welcome. Was <separator>. >+PASS window.getSelection().toString() is "" >+PASS window.getSelection().toString() is "wellcome " >+PASS spellingMarkerRange.toString() is "wellcome" >+PASS window.getSelection().toString() is "wellcome " >+FAIL contextMenuElements[contextMenuElements.length - 1] should be welcome. Was <separator>. >+PASS successfullyParsed is true >+ >+TEST COMPLETE >+wellcome home. >diff --git a/LayoutTests/platform/mac/editing/spelling/spelling-double-clicked-word-with-underscores-expected.txt b/LayoutTests/platform/mac/editing/spelling/spelling-double-clicked-word-with-underscores-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..0b3691ebc9ad14f7433e47a09ea861cf66f400c7 >--- /dev/null >+++ b/LayoutTests/platform/mac/editing/spelling/spelling-double-clicked-word-with-underscores-expected.txt >@@ -0,0 +1,20 @@ >+Spelling should work for double-clicked misspelled words with underscores. To test manually, type 'wellcome_ home.', double-click on 'wellcome_', and context-click on the selection. The test succeeds when the context menu shows spell check suggestions. >+ >+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". >+ >+ >+FAIL spellingMarkerRange.toString() should be wellcome. Was wellcome_. >+PASS window.getSelection().toString() is "" >+PASS window.getSelection().toString() is "wellcome_" >+FAIL spellingMarkerRange.toString() should be wellcome. Was wellcome_. >+PASS window.getSelection().toString() is "wellcome_" >+FAIL contextMenuElements[contextMenuElements.length - 1] should be welcome. Was <separator>. >+PASS window.getSelection().toString() is "" >+PASS window.getSelection().toString() is "wellcome_ " >+FAIL spellingMarkerRange.toString() should be wellcome. Was wellcome_. >+PASS window.getSelection().toString() is "wellcome_ " >+FAIL contextMenuElements[contextMenuElements.length - 1] should be welcome. Was <separator>. >+PASS successfullyParsed is true >+ >+TEST COMPLETE >+wellcome_ home. >diff --git a/LayoutTests/platform/mac/editing/spelling/spelling-exactly-selected-multiple-words-expected.txt b/LayoutTests/platform/mac/editing/spelling/spelling-exactly-selected-multiple-words-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..b79aacf72e62bbf3f1b76f03ec3f50f8db9bfb2c >--- /dev/null >+++ b/LayoutTests/platform/mac/editing/spelling/spelling-exactly-selected-multiple-words-expected.txt >@@ -0,0 +1,10 @@ >+Spelling should work when the user selects a multi-word misspelling exactly. To test manually, enable 'Ask Google for Suggestions' in Chrome, type 'It should be upper case.', select 'upper case', and context-click on the selection.The test succeeds when the context menu shows spelling suggestions. >+ >+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". >+ >+ >+FAIL Spellcheck timed out >+PASS successfullyParsed is true >+ >+TEST COMPLETE >+It should be upper case. >diff --git a/LayoutTests/platform/mac/editing/spelling/spelling-exactly-selected-word-expected.txt b/LayoutTests/platform/mac/editing/spelling/spelling-exactly-selected-word-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..dedb46f5cc6bd89c02af50c028b640c7ef9db20f >--- /dev/null >+++ b/LayoutTests/platform/mac/editing/spelling/spelling-exactly-selected-word-expected.txt >@@ -0,0 +1,18 @@ >+Spelling should work when the user selects the misspelled word exactly. To test manually, type 'wellcome home.', select 'wellcome', and context-click on the selection. The test succeeds when the context menu shows spelling suggestions. >+ >+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". >+ >+ >+PASS spellingMarkerRange.toString() is "wellcome" >+PASS window.getSelection().toString() is "" >+PASS window.getSelection().toString() is "wellcome" >+PASS spellingMarkerRange.toString() is "wellcome" >+PASS window.getSelection().toString() is "wellcome" >+FAIL contextMenuElements[contextMenuElements.length - 1] should be welcome. Was <separator>. >+PASS window.getSelection().toString() is "home" >+PASS window.getSelection().toString() is "home" >+PASS contextMenuElements[contextMenuElements.length - 1] is "<separator>" >+PASS successfullyParsed is true >+ >+TEST COMPLETE >+wellcome home. >diff --git a/LayoutTests/platform/mac/editing/spelling/spelling-should-select-multiple-words-expected.txt b/LayoutTests/platform/mac/editing/spelling/spelling-should-select-multiple-words-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..26ccb3f609e82c213242109af14303f33659324d >--- /dev/null >+++ b/LayoutTests/platform/mac/editing/spelling/spelling-should-select-multiple-words-expected.txt >@@ -0,0 +1,10 @@ >+Spell check should select multi-word misspellings on context click. To test manually, enable 'Ask Google for Suggestions' in Chrome, type 'It should be upper case.', and context-click on the word 'upper'. The test succeeds when 'upper case' was selected after context click. >+ >+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". >+ >+ >+FAIL Spellcheck timed out >+PASS successfullyParsed is true >+ >+TEST COMPLETE >+It should be upper case. >diff --git a/LayoutTests/platform/mac/editing/spelling/spelling-should-select-single-word-expected.txt b/LayoutTests/platform/mac/editing/spelling/spelling-should-select-single-word-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..92fe36e1a0c7cb147fd09c433b2ef7344bc6940c >--- /dev/null >+++ b/LayoutTests/platform/mac/editing/spelling/spelling-should-select-single-word-expected.txt >@@ -0,0 +1,17 @@ >+Spell check selects the misspelled word on context click. To test manually, type 'wellcome home.' and context-click on 'wellcome'. The test succeeds when 'wellcome' is selected after the context click. >+ >+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". >+ >+ >+PASS spellingMarkerRange.toString() is "wellcome" >+PASS window.getSelection().toString() is "" >+PASS spellingMarkerRange.toString() is "wellcome" >+FAIL window.getSelection().toString() should be wellcome. Was . >+FAIL contextMenuElements[contextMenuElements.length - 1] should be welcome. Was <separator>. >+PASS window.getSelection().toString() is "" >+PASS window.getSelection().toString() is "" >+PASS contextMenuElements[contextMenuElements.length - 1] is "<separator>" >+PASS successfullyParsed is true >+ >+TEST COMPLETE >+wellcome home. >diff --git a/LayoutTests/platform/mac/editing/spelling/spelling-with-punctuation-selection-expected.txt b/LayoutTests/platform/mac/editing/spelling/spelling-with-punctuation-selection-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..f2404204063bcae4e1c30f6c272c91fbde49f9cf >--- /dev/null >+++ b/LayoutTests/platform/mac/editing/spelling/spelling-with-punctuation-selection-expected.txt >@@ -0,0 +1,15 @@ >+Punctuation marks should be treated as whitespace: spelling should ignore them. To test manually, type 'wellcome!', select 'wellcome!', and context-click on the selection. The test succeeds when the context menu has spell check suggestions. >+ >+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". >+ >+ >+PASS spellingMarkerRange.toString() is "wellcome" >+PASS window.getSelection().toString() is "" >+PASS window.getSelection().toString() is "wellcome!" >+PASS spellingMarkerRange.toString() is "wellcome" >+PASS window.getSelection().toString() is "wellcome!" >+FAIL contextMenuElements[contextMenuElements.length - 1] should be welcome. Was <separator>. >+PASS successfullyParsed is true >+ >+TEST COMPLETE >+wellcome! >diff --git a/LayoutTests/platform/mac/editing/spelling/spelling-with-underscore-selection-expected.txt b/LayoutTests/platform/mac/editing/spelling/spelling-with-underscore-selection-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..80f8ddecdf5c14a40d38e537e52f5519c0766c54 >--- /dev/null >+++ b/LayoutTests/platform/mac/editing/spelling/spelling-with-underscore-selection-expected.txt >@@ -0,0 +1,15 @@ >+Underscores should be treated as whitespace: spelling should ignore them. To test manually, type 'Hi, _wellcome_ home.', select '_wellcome_', and context-click on the selection. The test succeeds when the context menu has spell check suggestions. >+ >+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". >+ >+ >+FAIL spellingMarkerRange.toString() should be wellcome. Was _wellcome_. >+PASS window.getSelection().toString() is "" >+PASS window.getSelection().toString() is "_wellcome_" >+FAIL spellingMarkerRange.toString() should be wellcome. Was _wellcome_. >+PASS window.getSelection().toString() is "_wellcome_" >+FAIL contextMenuElements[contextMenuElements.length - 1] should be welcome. Was <separator>. >+PASS successfullyParsed is true >+ >+TEST COMPLETE >+Hi, _wellcome_ home. >diff --git a/LayoutTests/platform/mac/editing/spelling/spelling-with-whitespace-selection-expected.txt b/LayoutTests/platform/mac/editing/spelling/spelling-with-whitespace-selection-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..b314fb17bae5681be99201c6510229e338db3e22 >--- /dev/null >+++ b/LayoutTests/platform/mac/editing/spelling/spelling-with-whitespace-selection-expected.txt >@@ -0,0 +1,14 @@ >+Spelling should ignore whitespace. To test manually, type 'hello, wellcome home.', select ' wellcome ', and context-click on the selection. The test succeeds when the context menu has spell check suggestions. >+ >+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". >+ >+ >+PASS spellingMarkerRange.toString() is "wellcome" >+PASS window.getSelection().toString() is " wellcome " >+PASS spellingMarkerRange.toString() is "wellcome" >+PASS window.getSelection().toString() is " wellcome " >+FAIL contextMenuElements[contextMenuElements.length - 1] should be welcome. Was <separator>. >+PASS successfullyParsed is true >+ >+TEST COMPLETE >+hello, wellcome home.
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 106815
:
184278
|
184581
|
184588
|
184808
|
184825
|
185091
|
185121
|
185303
|
185537
|
185547
|
185594
|
185625