Title: [149627] trunk/Source/WebKit/blackberry
Revision
149627
Author
commit-qu...@webkit.org
Date
2013-05-06 12:36:29 -0700 (Mon, 06 May 2013)

Log Message

[BlackBerry] Do not spellcheck when composition is active.
https://bugs.webkit.org/show_bug.cgi?id=115562

Patch by Nima Ghanavatian <nghanavat...@blackberry.com> on 2013-05-06
Reviewed by Rob Buis.

Internally reviewed by Mike Fenton.

PR331344
Typing can trigger rechecking since layout changes. Ensure
extra work is only done when we need it, and that it won't
be triggered when composition is active. If the user hasn't
finished a word yet, it is likely future key events will be
arriving, so checking the string at this point is extraneous.

* WebKitSupport/InputHandler.cpp:
(BlackBerry::WebKit::InputHandler::requestCheckingOfString):

Modified Paths

Diff

Modified: trunk/Source/WebKit/blackberry/Api/WebPage.cpp (149626 => 149627)


--- trunk/Source/WebKit/blackberry/Api/WebPage.cpp	2013-05-06 19:31:37 UTC (rev 149626)
+++ trunk/Source/WebKit/blackberry/Api/WebPage.cpp	2013-05-06 19:36:29 UTC (rev 149627)
@@ -1557,8 +1557,7 @@
 void WebPagePrivate::layoutFinished()
 {
     // If a layout change has occurred, we need to invalidate any current spellcheck requests and trigger a new run.
-    m_inputHandler->stopPendingSpellCheckRequests();
-    m_inputHandler->spellCheckTextBlock();
+    m_inputHandler->stopPendingSpellCheckRequests(true /* isRestartRequired */);
 
     if (!m_contentsSizeChanged && !m_overflowExceedsContentsSize)
         return;

Modified: trunk/Source/WebKit/blackberry/ChangeLog (149626 => 149627)


--- trunk/Source/WebKit/blackberry/ChangeLog	2013-05-06 19:31:37 UTC (rev 149626)
+++ trunk/Source/WebKit/blackberry/ChangeLog	2013-05-06 19:36:29 UTC (rev 149627)
@@ -1,5 +1,24 @@
 2013-05-06  Nima Ghanavatian  <nghanavat...@blackberry.com>
 
+        [BlackBerry] Do not spellcheck when composition is active.
+        https://bugs.webkit.org/show_bug.cgi?id=115562
+
+        Reviewed by Rob Buis.
+
+        Internally reviewed by Mike Fenton.
+
+        PR331344
+        Typing can trigger rechecking since layout changes. Ensure
+        extra work is only done when we need it, and that it won't
+        be triggered when composition is active. If the user hasn't
+        finished a word yet, it is likely future key events will be
+        arriving, so checking the string at this point is extraneous.
+
+        * WebKitSupport/InputHandler.cpp:
+        (BlackBerry::WebKit::InputHandler::requestCheckingOfString):
+
+2013-05-06  Nima Ghanavatian  <nghanavat...@blackberry.com>
+
         [BlackBerry] Reduce the spellcheck checking range
         https://bugs.webkit.org/show_bug.cgi?id=115479
 

Modified: trunk/Source/WebKit/blackberry/WebKitSupport/InputHandler.cpp (149626 => 149627)


--- trunk/Source/WebKit/blackberry/WebKitSupport/InputHandler.cpp	2013-05-06 19:31:37 UTC (rev 149626)
+++ trunk/Source/WebKit/blackberry/WebKitSupport/InputHandler.cpp	2013-05-06 19:36:29 UTC (rev 149627)
@@ -623,6 +623,7 @@
 
     // Check if the field should be spellchecked.
     if (!isActiveTextEdit() || !shouldSpellCheckElement(m_currentFocusElement.get()) || requestLength < 2) {
+        SpellingLog(Platform::LogLevelWarn, "InputHandler::requestCheckingOfString request cancelled");
         spellCheckRequest->didCancel();
         return;
     }
@@ -1150,14 +1151,25 @@
     return m_spellCheckStatusConfirmed ? m_globalSpellCheckStatus : true;
 }
 
-void InputHandler::stopPendingSpellCheckRequests()
+void InputHandler::stopPendingSpellCheckRequests(bool isRestartRequired)
 {
     m_spellingHandler->setSpellCheckActive(false);
-    // Prevent response from propagating through
+    // Prevent response from propagating through.
     m_processingTransactionId = 0;
+
     // Reject requests until lastRequestSequence. This helps us clear the queue of stale requests.
-    if (SpellChecker* spellChecker = getSpellChecker())
-        m_minimumSpellCheckingRequestSequence = spellChecker->lastRequestSequence();
+    if (SpellChecker* spellChecker = getSpellChecker()) {
+        if (spellChecker->lastRequestSequence() != spellChecker->lastProcessedSequence()) {
+            SpellingLog(LogLevelInfo, "InputHandler::stopPendingSpellCheckRequests will block requests up to lastRequest=%d [lastProcessed=%d]"
+                , spellChecker->lastRequestSequence(), spellChecker->lastProcessedSequence());
+            // Prevent requests in queue from executing.
+            m_minimumSpellCheckingRequestSequence = spellChecker->lastRequestSequence();
+            if (isRestartRequired && !compositionActive()) {
+                // Create new spellcheck requests to replace those that were invalidated.
+                spellCheckTextBlock();
+            }
+        }
+    }
 }
 
 void InputHandler::redrawSpellCheckDialogIfRequired(const bool shouldMoveDialog)

Modified: trunk/Source/WebKit/blackberry/WebKitSupport/InputHandler.h (149626 => 149627)


--- trunk/Source/WebKit/blackberry/WebKitSupport/InputHandler.h	2013-05-06 19:31:37 UTC (rev 149626)
+++ trunk/Source/WebKit/blackberry/WebKitSupport/InputHandler.h	2013-05-06 19:36:29 UTC (rev 149627)
@@ -148,7 +148,7 @@
 
     void requestCheckingOfString(PassRefPtr<WebCore::SpellCheckRequest>);
     void spellCheckingRequestProcessed(int32_t transactionId, spannable_string_t*);
-    void stopPendingSpellCheckRequests();
+    void stopPendingSpellCheckRequests(bool isRestartRequired = false);
     void spellCheckTextBlock(WebCore::Element* = 0);
 
     bool shouldRequestSpellCheckingOptionsForPoint(const Platform::IntPoint& documentContentPosition, const WebCore::Element*, imf_sp_text_t&);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to