Title: [122018] releases/WebKitGTK/webkit-1.8
Revision
122018
Author
[email protected]
Date
2012-07-06 13:18:51 -0700 (Fri, 06 Jul 2012)

Log Message

Merge 114605 - Split SpellChecker::didCheck() to SpellChecker::didCheckSucceeded() and SpellChecker::didCheckCanceled()
https://bugs.webkit.org/show_bug.cgi?id=83748

Reviewed by Ryosuke Niwa.

Source/WebCore:

The current SpellChecker::didCheck() does not delete existing markers. It causes
a problem that it leaves misspelled markers when a spellchecker client finishes
checking text successfully. This change splits this function to didCheckSucceeded()
and  didCheckCanceled() so the SpellChecker class can delete existing markers
when its client finishes checking text successfully. (We do not have to erase
existing markers when the client needs to cancel a text-check request.)

Test: platform/chromium/editing/spelling/delete-misspelled-word.html

* WebCore.exp.in: Replaced SpellChecker::didCheck with SpellChecker::didCheckSucceeded.
* editing/SpellChecker.cpp:
(WebCore::SpellChecker::didCheckSucceeded): Added.
(WebCore):
(WebCore::SpellChecker::didCheckCanceled): Added.
* editing/SpellChecker.h:
(SpellChecker): Added didCheckSucceeded and didCheckCanceled. Also changed didCheck to a private function.

Source/WebKit/chromium:

This change adds a new API WebTextCheckingCompletion::didCancelCheckingText(),
which encapsulates SpellChecker::didCheckCanceled() and implements it so
Chromium can use it.

* public/WebTextCheckingCompletion.h:
(WebKit::WebTextCheckingCompletion::didCancelCheckingText):
* src/WebTextCheckingCompletionImpl.cpp:
(WebKit::WebTextCheckingCompletionImpl::didFinishCheckingText):
(WebKit):
(WebKit::WebTextCheckingCompletionImpl::didCancelCheckingText):
* src/WebTextCheckingCompletionImpl.h:
(WebTextCheckingCompletionImpl):

Source/WebKit/mac:

This change replaces a call for SpellChecker::didCheck() with one for
SpellChecker::didCheckSucceeded() because didCheck has been split into
didCheckSucceeded(0 and didCheckCanceled().

* WebCoreSupport/WebEditorClient.mm:
(-[WebEditorSpellCheckResponder perform]): Replaced didCheck with didCheckSucceeded.

Tools:

This change replaces a call for SpellChecker::didCheck() with one for
SpellChecker::didCheckCenceled() because didCheck() has been split into
didCheckSucceeded() and didCheckCanceled().

* DumpRenderTree/chromium/WebViewHost.cpp:
(WebViewHost::requestCheckingOfText): Replaced didCheck with didCheckCanceled.

LayoutTests:

The current SpellChecker::didCheck() does not delete existing markers. It causes
a problem that it leaves misspelled markers when a spellchecker client finishes
checking text successfully. This change splits this function to didCheckSucceeded()
and  didCheckCanceled() so the SpellChecker class can delete existing markers
when its client finishes checking text successfully. (We do not have to erase
existing markers when the client needs to cancel a text-check request.)

* platform/chromium/editing/spelling/delete-misspelled-word-expected.txt: Added.
* platform/chromium/editing/spelling/delete-misspelled-word.html: Added.


Conflicts:

	Source/WebKit/chromium/src/WebTextCheckingCompletionImpl.cpp

Modified Paths

Added Paths

Diff

Modified: releases/WebKitGTK/webkit-1.8/LayoutTests/ChangeLog (122017 => 122018)


--- releases/WebKitGTK/webkit-1.8/LayoutTests/ChangeLog	2012-07-06 20:05:38 UTC (rev 122017)
+++ releases/WebKitGTK/webkit-1.8/LayoutTests/ChangeLog	2012-07-06 20:18:51 UTC (rev 122018)
@@ -1,3 +1,20 @@
+2012-04-18  Hironori Bono  <[email protected]>
+
+        Split SpellChecker::didCheck() to SpellChecker::didCheckSucceeded() and SpellChecker::didCheckCanceled()
+        https://bugs.webkit.org/show_bug.cgi?id=83748
+
+        Reviewed by Ryosuke Niwa.
+
+        The current SpellChecker::didCheck() does not delete existing markers. It causes
+        a problem that it leaves misspelled markers when a spellchecker client finishes
+        checking text successfully. This change splits this function to didCheckSucceeded()
+        and  didCheckCanceled() so the SpellChecker class can delete existing markers
+        when its client finishes checking text successfully. (We do not have to erase
+        existing markers when the client needs to cancel a text-check request.)
+
+        * platform/chromium/editing/spelling/delete-misspelled-word-expected.txt: Added.
+        * platform/chromium/editing/spelling/delete-misspelled-word.html: Added.
+
 2012-04-03  Hironori Bono  <[email protected]>
 
         Prevent spellchecking text pasted to an element having spellchecking disabled

Added: releases/WebKitGTK/webkit-1.8/LayoutTests/platform/chromium/editing/spelling/delete-misspelled-word-expected.txt (0 => 122018)


--- releases/WebKitGTK/webkit-1.8/LayoutTests/platform/chromium/editing/spelling/delete-misspelled-word-expected.txt	                        (rev 0)
+++ releases/WebKitGTK/webkit-1.8/LayoutTests/platform/chromium/editing/spelling/delete-misspelled-word-expected.txt	2012-07-06 20:18:51 UTC (rev 122018)
@@ -0,0 +1,14 @@
+Test if Chrome spellchecks a word again when changing a misspelled word.To test manually, type a misspelled word "zz " and type a backspace key twice.This test succeeds when "z" is not marked as misspelled.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS insertText("z"); insertText("z"); insertText(" "); internals.hasSpellingMarker(document, 0, 2) is true
+Enable asynchronous spellchecking, delete two characters, and insert a space
+PASS internals.hasSpellingMarker(document, 0, 1) is false
+PASS successfullyParsed is true
+
+TEST COMPLETE
+z 
+
+
Property changes on: releases/WebKitGTK/webkit-1.8/LayoutTests/platform/chromium/editing/spelling/delete-misspelled-word-expected.txt
___________________________________________________________________

Added: svn:eol-style

Added: releases/WebKitGTK/webkit-1.8/LayoutTests/platform/chromium/editing/spelling/delete-misspelled-word.html (0 => 122018)


--- releases/WebKitGTK/webkit-1.8/LayoutTests/platform/chromium/editing/spelling/delete-misspelled-word.html	                        (rev 0)
+++ releases/WebKitGTK/webkit-1.8/LayoutTests/platform/chromium/editing/spelling/delete-misspelled-word.html	2012-07-06 20:18:51 UTC (rev 122018)
@@ -0,0 +1,47 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src="" language="_javascript_" type="text/_javascript_"></script>
+<title>Testing moving cursor to a misspelled word</title> 
+</head> 
+<body>
+<div id="src" contenteditable="true" spellcheck="true"></div><br/>
+<script language="_javascript_">
+description('Test if Chrome spellchecks a word again when changing a misspelled word.' +
+            'To test manually, type a misspelled word "zz " and type a backspace key twice.' +
+            'This test succeeds when "z" is not marked as misspelled.');
+
+jsTestIsAsync = true;
+
+var node = document.getElementById('src');
+node.focus();
+function insertText(text) {
+    document.execCommand("InsertText", false, text);
+}
+shouldBeTrue('insertText("z"); insertText("z"); insertText(" "); internals.hasSpellingMarker(document, 0, 2)');
+
+debug('Enable asynchronous spellchecking, delete two characters, and insert a space');
+layoutTestController.setAsynchronousSpellCheckingEnabled(true);
+internals.settings.setUnifiedTextCheckingEnabled(true);
+
+layoutTestController.execCommand("DeleteBackward");
+layoutTestController.execCommand("DeleteBackward");
+document.execCommand("InsertText", false, ' ');
+
+var retryCount = 10;
+function verifyMarker() {
+    var hasMarker = internals.hasSpellingMarker(document, 0, 1);
+    if (hasMarker && --retryCount > 0) {
+        window.setTimeout(verifyMarker, sleepPeriod);
+        return;
+    }
+    shouldBeFalse('internals.hasSpellingMarker(document, 0, 1)');
+    internals.settings.setUnifiedTextCheckingEnabled(false);
+    layoutTestController.setAsynchronousSpellCheckingEnabled(false);
+    finishJSTest();
+}
+window.setTimeout(verifyMarker, 1);
+</script>
+<script src=""
+</body>
+</html>
Property changes on: releases/WebKitGTK/webkit-1.8/LayoutTests/platform/chromium/editing/spelling/delete-misspelled-word.html
___________________________________________________________________

Added: svn:eol-style

Modified: releases/WebKitGTK/webkit-1.8/Source/WebCore/ChangeLog (122017 => 122018)


--- releases/WebKitGTK/webkit-1.8/Source/WebCore/ChangeLog	2012-07-06 20:05:38 UTC (rev 122017)
+++ releases/WebKitGTK/webkit-1.8/Source/WebCore/ChangeLog	2012-07-06 20:18:51 UTC (rev 122018)
@@ -1,3 +1,27 @@
+2012-04-18  Hironori Bono  <[email protected]>
+
+        Split SpellChecker::didCheck() to SpellChecker::didCheckSucceeded() and SpellChecker::didCheckCanceled()
+        https://bugs.webkit.org/show_bug.cgi?id=83748
+
+        Reviewed by Ryosuke Niwa.
+
+        The current SpellChecker::didCheck() does not delete existing markers. It causes
+        a problem that it leaves misspelled markers when a spellchecker client finishes
+        checking text successfully. This change splits this function to didCheckSucceeded()
+        and  didCheckCanceled() so the SpellChecker class can delete existing markers
+        when its client finishes checking text successfully. (We do not have to erase
+        existing markers when the client needs to cancel a text-check request.)
+
+        Test: platform/chromium/editing/spelling/delete-misspelled-word.html
+
+        * WebCore.exp.in: Replaced SpellChecker::didCheck with SpellChecker::didCheckSucceeded.
+        * editing/SpellChecker.cpp:
+        (WebCore::SpellChecker::didCheckSucceeded): Added.
+        (WebCore):
+        (WebCore::SpellChecker::didCheckCanceled): Added.
+        * editing/SpellChecker.h:
+        (SpellChecker): Added didCheckSucceeded and didCheckCanceled. Also changed didCheck to a private function.
+
 2012-04-03  Hironori Bono  <[email protected]>
 
         Prevent spellchecking text pasted to an element having spellchecking disabled

Modified: releases/WebKitGTK/webkit-1.8/Source/WebCore/WebCore.exp.in (122017 => 122018)


--- releases/WebKitGTK/webkit-1.8/Source/WebCore/WebCore.exp.in	2012-07-06 20:05:38 UTC (rev 122017)
+++ releases/WebKitGTK/webkit-1.8/Source/WebCore/WebCore.exp.in	2012-07-06 20:18:51 UTC (rev 122018)
@@ -293,7 +293,7 @@
 __ZN7WebCore12SharedBufferC1EPKhi
 __ZN7WebCore12SharedBufferC1Ev
 __ZN7WebCore12SharedBufferD1Ev
-__ZN7WebCore12SpellChecker8didCheckEiRKN3WTF6VectorINS_18TextCheckingResultELm0EEE
+__ZN7WebCore12SpellChecker17didCheckSucceededEiRKN3WTF6VectorINS_18TextCheckingResultELm0EEE
 __ZN7WebCore12TextEncodingC1ERKN3WTF6StringE
 __ZN7WebCore12TextIterator11rangeLengthEPKNS_5RangeEb
 __ZN7WebCore12TextIterator26rangeFromLocationAndLengthEPNS_7ElementEiib

Modified: releases/WebKitGTK/webkit-1.8/Source/WebCore/editing/SpellChecker.cpp (122017 => 122018)


--- releases/WebKitGTK/webkit-1.8/Source/WebCore/editing/SpellChecker.cpp	2012-07-06 20:05:38 UTC (rev 122017)
+++ releases/WebKitGTK/webkit-1.8/Source/WebCore/editing/SpellChecker.cpp	2012-07-06 20:18:51 UTC (rev 122018)
@@ -188,5 +188,24 @@
         m_timerToProcessQueuedRequest.startOneShot(0);
 }
 
+void SpellChecker::didCheckSucceeded(int sequence, const Vector<TextCheckingResult>& results)
+{
+    if (m_processingRequest->sequence() == sequence) {
+        unsigned markers = 0;
+        if (m_processingRequest->mask() & TextCheckingTypeSpelling)
+            markers |= DocumentMarker::Spelling;
+        if (m_processingRequest->mask() & TextCheckingTypeGrammar)
+            markers |= DocumentMarker::Grammar;
+        if (markers)
+            m_frame->document()->markers()->removeMarkers(m_processingRequest->checkingRange().get(), markers);
+    }
+    didCheck(sequence, results);
+}
 
+void SpellChecker::didCheckCanceled(int sequence)
+{
+    Vector<TextCheckingResult> results;
+    didCheck(sequence, results);
+}
+
 } // namespace WebCore

Modified: releases/WebKitGTK/webkit-1.8/Source/WebCore/editing/SpellChecker.h (122017 => 122018)


--- releases/WebKitGTK/webkit-1.8/Source/WebCore/editing/SpellChecker.h	2012-07-06 20:05:38 UTC (rev 122017)
+++ releases/WebKitGTK/webkit-1.8/Source/WebCore/editing/SpellChecker.h	2012-07-06 20:18:51 UTC (rev 122018)
@@ -81,7 +81,8 @@
     bool isCheckable(Range*) const;
 
     void requestCheckingFor(PassRefPtr<SpellCheckRequest>);
-    void didCheck(int sequence, const Vector<TextCheckingResult>&);
+    void didCheckSucceeded(int sequence, const Vector<TextCheckingResult>&);
+    void didCheckCanceled(int sequence);
 
     int lastRequestSequence() const
     {
@@ -101,6 +102,7 @@
     void timerFiredToProcessQueuedRequest(Timer<SpellChecker>*);
     void invokeRequest(PassRefPtr<SpellCheckRequest>);
     void enqueueRequest(PassRefPtr<SpellCheckRequest>);
+    void didCheck(int sequence, const Vector<TextCheckingResult>&);
 
     Frame* m_frame;
     int m_lastRequestSequence;

Modified: releases/WebKitGTK/webkit-1.8/Source/WebKit/chromium/ChangeLog (122017 => 122018)


--- releases/WebKitGTK/webkit-1.8/Source/WebKit/chromium/ChangeLog	2012-07-06 20:05:38 UTC (rev 122017)
+++ releases/WebKitGTK/webkit-1.8/Source/WebKit/chromium/ChangeLog	2012-07-06 20:18:51 UTC (rev 122018)
@@ -1,3 +1,23 @@
+2012-04-18  Hironori Bono  <[email protected]>
+
+        Split SpellChecker::didCheck() to SpellChecker::didCheckSucceeded() and SpellChecker::didCheckCanceled()
+        https://bugs.webkit.org/show_bug.cgi?id=83748
+
+        Reviewed by Ryosuke Niwa.
+
+        This change adds a new API WebTextCheckingCompletion::didCancelCheckingText(),
+        which encapsulates SpellChecker::didCheckCanceled() and implements it so
+        Chromium can use it.
+
+        * public/WebTextCheckingCompletion.h:
+        (WebKit::WebTextCheckingCompletion::didCancelCheckingText):
+        * src/WebTextCheckingCompletionImpl.cpp:
+        (WebKit::WebTextCheckingCompletionImpl::didFinishCheckingText):
+        (WebKit):
+        (WebKit::WebTextCheckingCompletionImpl::didCancelCheckingText):
+        * src/WebTextCheckingCompletionImpl.h:
+        (WebTextCheckingCompletionImpl):
+
 2012-02-24  Shinya Kawanaka  <[email protected]>
 
         SpellCheckRequest needs to know the context where the spellcheck happened.

Modified: releases/WebKitGTK/webkit-1.8/Source/WebKit/chromium/public/WebTextCheckingCompletion.h (122017 => 122018)


--- releases/WebKitGTK/webkit-1.8/Source/WebKit/chromium/public/WebTextCheckingCompletion.h	2012-07-06 20:05:38 UTC (rev 122017)
+++ releases/WebKitGTK/webkit-1.8/Source/WebKit/chromium/public/WebTextCheckingCompletion.h	2012-07-06 20:18:51 UTC (rev 122018)
@@ -42,6 +42,7 @@
 class WebTextCheckingCompletion {
 public:
     virtual void didFinishCheckingText(const WebVector<WebTextCheckingResult>&) = 0;
+    virtual void didCancelCheckingText() { };
 protected:
     ~WebTextCheckingCompletion() { }
 };

Modified: releases/WebKitGTK/webkit-1.8/Source/WebKit/chromium/src/WebTextCheckingCompletionImpl.cpp (122017 => 122018)


--- releases/WebKitGTK/webkit-1.8/Source/WebKit/chromium/src/WebTextCheckingCompletionImpl.cpp	2012-07-06 20:05:38 UTC (rev 122017)
+++ releases/WebKitGTK/webkit-1.8/Source/WebKit/chromium/src/WebTextCheckingCompletionImpl.cpp	2012-07-06 20:18:51 UTC (rev 122018)
@@ -60,6 +60,11 @@
     delete this;
 }
 
+void WebTextCheckingCompletionImpl::didCancelCheckingText()
+{
+    m_spellChecker->didCheckCanceled(m_identifier);
+}
+
 void WebTextCheckingCompletionImpl::invalidate()
 {
     m_spellChecker = 0;

Modified: releases/WebKitGTK/webkit-1.8/Source/WebKit/chromium/src/WebTextCheckingCompletionImpl.h (122017 => 122018)


--- releases/WebKitGTK/webkit-1.8/Source/WebKit/chromium/src/WebTextCheckingCompletionImpl.h	2012-07-06 20:05:38 UTC (rev 122017)
+++ releases/WebKitGTK/webkit-1.8/Source/WebKit/chromium/src/WebTextCheckingCompletionImpl.h	2012-07-06 20:18:51 UTC (rev 122018)
@@ -51,6 +51,7 @@
     }
 
     virtual void didFinishCheckingText(const WebVector<WebTextCheckingResult>&);
+    virtual void didCancelCheckingText();
 
     void invalidate();
     WebCore::SpellChecker* spellChecker() const { return m_spellChecker; }

Modified: releases/WebKitGTK/webkit-1.8/Source/WebKit/mac/ChangeLog (122017 => 122018)


--- releases/WebKitGTK/webkit-1.8/Source/WebKit/mac/ChangeLog	2012-07-06 20:05:38 UTC (rev 122017)
+++ releases/WebKitGTK/webkit-1.8/Source/WebKit/mac/ChangeLog	2012-07-06 20:18:51 UTC (rev 122018)
@@ -1,3 +1,17 @@
+2012-04-18  Hironori Bono  <[email protected]>
+
+        Split SpellChecker::didCheck() to SpellChecker::didCheckSucceeded() and SpellChecker::didCheckCanceled()
+        https://bugs.webkit.org/show_bug.cgi?id=83748
+
+        Reviewed by Ryosuke Niwa.
+
+        This change replaces a call for SpellChecker::didCheck() with one for
+        SpellChecker::didCheckSucceeded() because didCheck has been split into
+        didCheckSucceeded(0 and didCheckCanceled().
+
+        * WebCoreSupport/WebEditorClient.mm:
+        (-[WebEditorSpellCheckResponder perform]): Replaced didCheck with didCheckSucceeded.
+
 2012-02-24  Shinya Kawanaka  <[email protected]>
 
         SpellCheckRequest needs to know the context where the spellcheck happened.

Modified: releases/WebKitGTK/webkit-1.8/Source/WebKit/mac/WebCoreSupport/WebEditorClient.mm (122017 => 122018)


--- releases/WebKitGTK/webkit-1.8/Source/WebKit/mac/WebCoreSupport/WebEditorClient.mm	2012-07-06 20:05:38 UTC (rev 122017)
+++ releases/WebKitGTK/webkit-1.8/Source/WebKit/mac/WebCoreSupport/WebEditorClient.mm	2012-07-06 20:18:51 UTC (rev 122018)
@@ -966,7 +966,7 @@
 
 - (void)perform
 {
-    _sender->didCheck(_sequence, core(_results.get(), _types));
+    _sender->didCheckSucceeded(_sequence, core(_results.get(), _types));
 }
 
 @end

Modified: releases/WebKitGTK/webkit-1.8/Tools/ChangeLog (122017 => 122018)


--- releases/WebKitGTK/webkit-1.8/Tools/ChangeLog	2012-07-06 20:05:38 UTC (rev 122017)
+++ releases/WebKitGTK/webkit-1.8/Tools/ChangeLog	2012-07-06 20:18:51 UTC (rev 122018)
@@ -1,3 +1,17 @@
+2012-04-18  Hironori Bono  <[email protected]>
+
+        Split SpellChecker::didCheck() to SpellChecker::didCheckSucceeded() and SpellChecker::didCheckCanceled()
+        https://bugs.webkit.org/show_bug.cgi?id=83748
+
+        Reviewed by Ryosuke Niwa.
+
+        This change replaces a call for SpellChecker::didCheck() with one for
+        SpellChecker::didCheckCenceled() because didCheck() has been split into
+        didCheckSucceeded() and didCheckCanceled().
+
+        * DumpRenderTree/chromium/WebViewHost.cpp:
+        (WebViewHost::requestCheckingOfText): Replaced didCheck with didCheckCanceled.
+
 2012-05-03  Philippe Normand  <[email protected]>
 
         Unreviewed, fix another call to join(), similar to the ones landed

Modified: releases/WebKitGTK/webkit-1.8/Tools/DumpRenderTree/chromium/WebViewHost.cpp (122017 => 122018)


--- releases/WebKitGTK/webkit-1.8/Tools/DumpRenderTree/chromium/WebViewHost.cpp	2012-07-06 20:05:38 UTC (rev 122017)
+++ releases/WebKitGTK/webkit-1.8/Tools/DumpRenderTree/chromium/WebViewHost.cpp	2012-07-06 20:18:51 UTC (rev 122018)
@@ -450,7 +450,7 @@
 {
     if (text.isEmpty()) {
         if (completion)
-            completion->didFinishCheckingText(Vector<WebTextCheckingResult>());
+            completion->didCancelCheckingText();
         return;
     }
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to