Changeset 120423 in webkit
- Timestamp:
- Jun 15, 2012 1:41:30 AM (12 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r120422 r120423 1 2012-06-15 Hironori Bono <hbono@chromium.org> 2 3 Allow platforms to choose whether to remove markers on editing 4 https://bugs.webkit.org/show_bug.cgi?id=88838 5 6 Reviewed by Hajime Morita. 7 8 This change adds a test that verifies WebKit removes a grammar marker from a 9 grammatically-incorrect word when editing the word. 10 11 * editing/spelling/grammar-edit-word-expected.txt: Added. 12 * editing/spelling/grammar-edit-word.html: Added. 13 1 14 2012-06-15 Zan Dobersek <zandobersek@gmail.com> 2 15 -
trunk/Source/WebCore/ChangeLog
r120421 r120423 1 2012-06-15 Hironori Bono <hbono@chromium.org> 2 3 Allow platforms to choose whether to remove markers on editing 4 https://bugs.webkit.org/show_bug.cgi?id=88838 5 6 Reviewed by Hajime Morita. 7 8 This change allows platforms to choose whether to remove markers on a word being 9 edited. WebKit does not remove markers when we move a selection to a markered 10 word on platforms that shouldEraseMarkersAfterChangeSelection returns false. 11 On such platforms, WebKit expects to set WTF_USE_MARKER_REMOVAL_UPON_EDITING to 12 1 so Editor::updateMarkersForWordsAffectedByEditing can remove markers. This 13 change also checks the return value of shouldEraseMarkersAfterChangeSelection so 14 platform can choose it. This change also adds grammar markers so it can also 15 remove grammar markers. 16 17 Test: editing/spelling/grammar-edit-word.html 18 19 * editing/Editor.cpp: 20 (WebCore::Editor::updateMarkersForWordsAffectedByEditing): 21 1 22 2012-06-15 Andrey Adaikin <aandrey@chromium.org> 2 23 -
trunk/Source/WebCore/editing/Editor.cpp
r120357 r120423 2204 2204 void Editor::updateMarkersForWordsAffectedByEditing(bool doNotRemoveIfSelectionAtWordBoundary) 2205 2205 { 2206 if (!m_alternativeTextController->shouldRemoveMarkersUponEditing() )2206 if (!m_alternativeTextController->shouldRemoveMarkersUponEditing() && (!textChecker() || textChecker()->shouldEraseMarkersAfterChangeSelection(TextCheckingTypeSpelling))) 2207 2207 return; 2208 2208 … … 2272 2272 m_alternativeTextController->removeDictationAlternativesForMarker(markers[i]); 2273 2273 2274 document->markers()->removeMarkers(wordRange.get(), DocumentMarker::Spelling | DocumentMarker:: CorrectionIndicator | DocumentMarker::SpellCheckingExemption | DocumentMarker::DictationAlternatives, DocumentMarkerController::RemovePartiallyOverlappingMarker);2274 document->markers()->removeMarkers(wordRange.get(), DocumentMarker::Spelling | DocumentMarker::Grammar | DocumentMarker::CorrectionIndicator | DocumentMarker::SpellCheckingExemption | DocumentMarker::DictationAlternatives, DocumentMarkerController::RemovePartiallyOverlappingMarker); 2275 2275 document->markers()->clearDescriptionOnMarkersIntersectingRange(wordRange.get(), DocumentMarker::Replacement); 2276 2276 } -
trunk/Source/WebKit/chromium/ChangeLog
r120410 r120423 1 2012-06-15 Hironori Bono <hbono@chromium.org> 2 3 Allow platforms to choose whether to remove markers on editing 4 https://bugs.webkit.org/show_bug.cgi?id=88838 5 6 Reviewed by Hajime Morita. 7 8 This change implements EditorClientImpl::checkGrammarOfString so 9 DumpRenderTree can run grammar tests. 10 11 * src/EditorClientImpl.cpp: 12 (WebKit::EditorClientImpl::isGrammarCheckingEnabled): Return true also when unified text-checking is enabled. 13 (WebKit::EditorClientImpl::shouldEraseMarkersAfterChangeSelection): ditto. 14 (WebKit::EditorClientImpl::checkGrammarOfString): Implement this function with our unified text-checker. 15 1 16 2012-06-14 Kent Tamura <tkent@chromium.org> 2 17 -
trunk/Source/WebKit/chromium/src/EditorClientImpl.cpp
r119192 r120423 171 171 { 172 172 const Frame* frame = m_webView->focusedWebCoreFrame(); 173 return frame && frame->settings() && frame->settings()->asynchronousSpellCheckingEnabled();173 return frame && frame->settings() && (frame->settings()->asynchronousSpellCheckingEnabled() || frame->settings()->unifiedTextCheckerEnabled()); 174 174 } 175 175 … … 704 704 { 705 705 const Frame* frame = m_webView->focusedWebCoreFrame(); 706 return !frame || !frame->settings() || !frame->settings()->asynchronousSpellCheckingEnabled();706 return !frame || !frame->settings() || (!frame->settings()->asynchronousSpellCheckingEnabled() && !frame->settings()->unifiedTextCheckerEnabled()); 707 707 } 708 708 … … 767 767 } 768 768 769 void EditorClientImpl::checkGrammarOfString(const UChar*, int length, 770 WTF::Vector<GrammarDetail>&, 771 int* badGrammarLocation, 772 int* badGrammarLength) 773 { 774 notImplemented(); 769 void EditorClientImpl::checkGrammarOfString(const UChar* text, int length, WTF::Vector<GrammarDetail>& details, int* badGrammarLocation, int* badGrammarLength) 770 { 775 771 if (badGrammarLocation) 776 772 *badGrammarLocation = -1; 777 773 if (badGrammarLength) 778 774 *badGrammarLength = 0; 775 776 if (!m_webView->spellCheckClient()) 777 return; 778 WebVector<WebTextCheckingResult> webResults; 779 m_webView->spellCheckClient()->checkTextOfParagraph(WebString(text, length), WebTextCheckingTypeGrammar, &webResults); 780 if (!webResults.size()) 781 return; 782 783 // Convert a list of WebTextCheckingResults to a list of GrammarDetails. If 784 // the converted vector of GrammarDetails has grammar errors, we set 785 // badGrammarLocation and badGrammarLength to tell WebKit that the input 786 // text has grammar errors. 787 for (size_t i = 0; i < webResults.size(); ++i) { 788 if (webResults[i].type == WebTextCheckingTypeGrammar) { 789 GrammarDetail detail; 790 detail.location = webResults[i].location; 791 detail.length = webResults[i].length; 792 detail.userDescription = webResults[i].replacement; 793 details.append(detail); 794 } 795 } 796 if (!details.size()) 797 return; 798 if (badGrammarLocation) 799 *badGrammarLocation = 0; 800 if (badGrammarLength) 801 *badGrammarLength = length; 779 802 } 780 803 -
trunk/Tools/ChangeLog
r120419 r120423 1 2012-06-15 Hironori Bono <hbono@chromium.org> 2 3 Allow platforms to choose whether to remove markers on editing 4 https://bugs.webkit.org/show_bug.cgi?id=88838 5 6 Reviewed by Hajime Morita. 7 8 This change implements WebViewHost::checkTextOfParagraph so DumpRenderTree can 9 run grammar tests. 10 11 * DumpRenderTree/chromium/WebViewHost.cpp: 12 (WebViewHost::checkTextOfParagraph): Implement this function with our mock spell checker and grammar checker. 13 * DumpRenderTree/chromium/WebViewHost.h: 14 (WebViewHost): Override WebSpellCheckClient::checkTextOfParagraph. 15 1 16 2012-06-15 Sheriff Bot <webkit.review.bot@gmail.com> 2 17 -
trunk/Tools/DumpRenderTree/chromium/WebViewHost.cpp
r120031 r120423 466 466 // Check the spelling of the given text. 467 467 m_spellcheck.spellCheckWord(text, &misspelledOffset, &misspelledLength); 468 } 469 470 void WebViewHost::checkTextOfParagraph(const WebString& text, WebTextCheckingTypeMask mask, WebVector<WebTextCheckingResult>* webResults) 471 { 472 Vector<WebTextCheckingResult> results; 473 if (mask & WebTextCheckingTypeSpelling) { 474 size_t offset = 0; 475 size_t length = text.length(); 476 const WebUChar* data = text.data(); 477 while (offset < length) { 478 int misspelledPosition = 0; 479 int misspelledLength = 0; 480 m_spellcheck.spellCheckWord(WebString(&data[offset], length - offset), &misspelledPosition, &misspelledLength); 481 if (!misspelledLength) 482 break; 483 WebTextCheckingResult result; 484 result.type = WebTextCheckingTypeSpelling; 485 result.location = offset + misspelledPosition; 486 result.length = misspelledLength; 487 results.append(result); 488 offset += misspelledPosition + misspelledLength; 489 } 490 } 491 if (mask & WebTextCheckingTypeGrammar) 492 MockGrammarCheck::checkGrammarOfString(text, &results); 493 webResults->assign(results); 468 494 } 469 495 -
trunk/Tools/DumpRenderTree/chromium/WebViewHost.h
r119818 r120423 137 137 // WebKit::WebSpellCheckClient 138 138 virtual void spellCheck(const WebKit::WebString&, int& offset, int& length, WebKit::WebVector<WebKit::WebString>* optionalSuggestions); 139 virtual void checkTextOfParagraph(const WebKit::WebString&, WebKit::WebTextCheckingTypeMask, WebKit::WebVector<WebKit::WebTextCheckingResult>*); 139 140 virtual void requestCheckingOfText(const WebKit::WebString&, WebKit::WebTextCheckingCompletion*); 140 141 virtual WebKit::WebString autoCorrectWord(const WebKit::WebString&);
Note: See TracChangeset
for help on using the changeset viewer.