Title: [149685] trunk/Source/WebKit/blackberry
Revision
149685
Author
[email protected]
Date
2013-05-07 11:52:12 -0700 (Tue, 07 May 2013)

Log Message

[BlackBerry] Maintain touch event state throughout processing
https://bugs.webkit.org/show_bug.cgi?id=115663

Patch by Nima Ghanavatian <[email protected]> on 2013-05-07
Reviewed by Rob Buis.

Internally reviewed by Otto Cheung and Genevieve Mak.

PR 297691
By maintaining our touch event state, we can get a better idea
of what triggered an update to selection and respond appropriately.
On touch press we set userTouchTriggered to give the UI thread
some context.

* Api/WebPage.cpp:
(BlackBerry::WebKit::WebPagePrivate::WebPagePrivate):
(BlackBerry::WebKit::WebPagePrivate::handleMouseEvent):
(BlackBerry::WebKit::WebPage::setExtraPluginDirectory):
* Api/WebPage_p.h:
(WebPagePrivate):
* WebKitSupport/SelectionHandler.cpp:
(BlackBerry::WebKit::SelectionHandler::selectionPositionChanged):

Modified Paths

Diff

Modified: trunk/Source/WebKit/blackberry/Api/WebPage.cpp (149684 => 149685)


--- trunk/Source/WebKit/blackberry/Api/WebPage.cpp	2013-05-07 18:42:52 UTC (rev 149684)
+++ trunk/Source/WebKit/blackberry/Api/WebPage.cpp	2013-05-07 18:52:12 UTC (rev 149685)
@@ -3933,6 +3933,9 @@
 
         // Fat fingers can deal with shadow content.
         node = lastFatFingersResult.node(FatFingersResult::ShadowContentNotAllowed);
+
+        // Save mouse event state for later. This allows us to know why some responses have occurred, namely selection changes.
+        m_touchEventHandler->m_userTriggeredTouchPressOnTextInput = mouseEvent.type() == WebCore::PlatformEvent::MousePressed && lastFatFingersResult.isTextInput();
     }
 
     if (!node) {

Modified: trunk/Source/WebKit/blackberry/ChangeLog (149684 => 149685)


--- trunk/Source/WebKit/blackberry/ChangeLog	2013-05-07 18:42:52 UTC (rev 149684)
+++ trunk/Source/WebKit/blackberry/ChangeLog	2013-05-07 18:52:12 UTC (rev 149685)
@@ -1,5 +1,29 @@
 2013-05-07  Nima Ghanavatian  <[email protected]>
 
+        [BlackBerry] Maintain touch event state throughout processing
+        https://bugs.webkit.org/show_bug.cgi?id=115663
+
+        Reviewed by Rob Buis.
+
+        Internally reviewed by Otto Cheung and Genevieve Mak.
+
+        PR 297691
+        By maintaining our touch event state, we can get a better idea
+        of what triggered an update to selection and respond appropriately.
+        On touch press we set userTouchTriggered to give the UI thread
+        some context.
+
+        * Api/WebPage.cpp:
+        (BlackBerry::WebKit::WebPagePrivate::WebPagePrivate):
+        (BlackBerry::WebKit::WebPagePrivate::handleMouseEvent):
+        (BlackBerry::WebKit::WebPage::setExtraPluginDirectory):
+        * Api/WebPage_p.h:
+        (WebPagePrivate):
+        * WebKitSupport/SelectionHandler.cpp:
+        (BlackBerry::WebKit::SelectionHandler::selectionPositionChanged):
+
+2013-05-07  Nima Ghanavatian  <[email protected]>
+
         [BlackBerry] Read-only fields should not get keyboard focus
         https://bugs.webkit.org/show_bug.cgi?id=115725
 

Modified: trunk/Source/WebKit/blackberry/WebKitSupport/SelectionHandler.cpp (149684 => 149685)


--- trunk/Source/WebKit/blackberry/WebKitSupport/SelectionHandler.cpp	2013-05-07 18:42:52 UTC (rev 149684)
+++ trunk/Source/WebKit/blackberry/WebKitSupport/SelectionHandler.cpp	2013-05-07 18:52:12 UTC (rev 149685)
@@ -1152,7 +1152,7 @@
         return;
     }
 
-    notifyCaretPositionChangedIfNeeded();
+    notifyCaretPositionChangedIfNeeded(m_webPage->m_touchEventHandler->m_userTriggeredTouchPressOnTextInput);
 
     // Enter selection mode if selection type is RangeSelection, and disable selection if
     // selection is active and becomes caret selection.
@@ -1267,28 +1267,26 @@
 }
 
 
-void SelectionHandler::notifyCaretPositionChangedIfNeeded(bool userTouchTriggered)
+void SelectionHandler::notifyCaretPositionChangedIfNeeded(bool userTouchTriggeredOnTextField)
 {
     m_didSuppressCaretPositionChangedNotification = false;
 
     if (m_caretActive || (m_webPage->m_inputHandler->isInputMode() && m_webPage->focusedOrMainFrame()->selection()->isCaret())) {
         // This may update the caret to no longer be active.
-        caretPositionChanged(userTouchTriggered);
+        caretPositionChanged(userTouchTriggeredOnTextField);
     }
 }
 
-void SelectionHandler::caretPositionChanged(bool userTouchTriggered)
+void SelectionHandler::caretPositionChanged(bool userTouchTriggeredOnTextField)
 {
     SelectionLog(Platform::LogLevelInfo, "SelectionHandler::caretPositionChanged");
 
-    bool isFatFingerOnTextField = userTouchTriggered && m_webPage->m_touchEventHandler->lastFatFingersResult().isTextInput();
-
     WebCore::IntRect caretLocation;
     // If the input field is not active, we must be turning off the caret.
     if (!m_webPage->m_inputHandler->isInputMode() && m_caretActive) {
         m_caretActive = false;
         // Send an empty caret change to turn off the caret.
-        m_webPage->m_client->notifyCaretChanged(caretLocation, isFatFingerOnTextField);
+        m_webPage->m_client->notifyCaretChanged(caretLocation, userTouchTriggeredOnTextField);
         return;
     }
 
@@ -1327,7 +1325,7 @@
         Platform::IntRect(nodeBoundingBox).toString().c_str(),
         m_webPage->m_inputHandler->elementText().isEmpty() ? ", empty text field" : "");
 
-    m_webPage->m_client->notifyCaretChanged(caretLocation, isFatFingerOnTextField, isSingleLineInput, nodeBoundingBox, m_webPage->m_inputHandler->elementText().isEmpty());
+    m_webPage->m_client->notifyCaretChanged(caretLocation, userTouchTriggeredOnTextField, isSingleLineInput, nodeBoundingBox, m_webPage->m_inputHandler->elementText().isEmpty());
 }
 
 bool SelectionHandler::selectionContains(const WebCore::IntPoint& point)

Modified: trunk/Source/WebKit/blackberry/WebKitSupport/SelectionHandler.h (149684 => 149685)


--- trunk/Source/WebKit/blackberry/WebKitSupport/SelectionHandler.h	2013-05-07 18:42:52 UTC (rev 149684)
+++ trunk/Source/WebKit/blackberry/WebKitSupport/SelectionHandler.h	2013-05-07 18:52:12 UTC (rev 149685)
@@ -85,7 +85,7 @@
     WebCore::IntRect selectionViewportRect() const;
 
 private:
-    void notifyCaretPositionChangedIfNeeded(bool userTouchTriggered = true);
+    void notifyCaretPositionChangedIfNeeded(bool userTouchTriggeredOnTextField);
     void caretPositionChanged(bool userTouchTriggered);
     void regionForTextQuads(WTF::Vector<WebCore::FloatQuad>&, BlackBerry::Platform::IntRectRegion&, bool shouldClipToVisibleContent = true) const;
     WebCore::IntRect clippingRectForVisibleContent() const;

Modified: trunk/Source/WebKit/blackberry/WebKitSupport/TouchEventHandler.h (149684 => 149685)


--- trunk/Source/WebKit/blackberry/WebKitSupport/TouchEventHandler.h	2013-05-07 18:42:52 UTC (rev 149684)
+++ trunk/Source/WebKit/blackberry/WebKitSupport/TouchEventHandler.h	2013-05-07 18:52:12 UTC (rev 149685)
@@ -47,6 +47,9 @@
 
     void drawTapHighlight();
 
+    // This value should reset to false on MouseReleased
+    bool m_userTriggeredTouchPressOnTextInput;
+
 private:
     void handleFatFingerPressed(bool shiftActive = false, bool altActive = false, bool ctrlActive = false);
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to