Title: [255415] trunk/Source
Revision
255415
Author
timothy_hor...@apple.com
Date
2020-01-29 20:47:38 -0800 (Wed, 29 Jan 2020)

Log Message

REGRESSION (r255322): macCatalyst: Tapping in an input field doesn't change the selection location
https://bugs.webkit.org/show_bug.cgi?id=206978

Reviewed by Wenson Hsieh.

Source/WebCore:

* page/ChromeClient.h:
(WebCore::ChromeClient::shouldUseMouseEventForSelection):
(WebCore::ChromeClient::shouldUseMouseEventsForSelection): Deleted.
* page/EventHandler.cpp:
(WebCore::EventHandler::canMouseDownStartSelect):
(WebCore::EventHandler::handleMousePressEvent):
* page/EventHandler.h:
Plumb the event through to the ChromeClient so it can use it to make decisions.

Source/WebKit:

* WebProcess/WebCoreSupport/WebChromeClient.h:
* WebProcess/WebCoreSupport/ios/WebChromeClientIOS.mm:
(WebKit::WebChromeClient::shouldUseMouseEventForSelection):
(WebKit::WebChromeClient::shouldUseMouseEventsForSelection): Deleted.
Allow single-click events to change the selection; this is required
in order to allow WebCore to set the selection in the case that
the UITextInteraction gestures haven't yet been installed. Continue
to not allow multi-click events to change the selection, because
these are the ones that conflict with UIKit's behaviors.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (255414 => 255415)


--- trunk/Source/WebCore/ChangeLog	2020-01-30 04:15:51 UTC (rev 255414)
+++ trunk/Source/WebCore/ChangeLog	2020-01-30 04:47:38 UTC (rev 255415)
@@ -1,3 +1,19 @@
+2020-01-29  Tim Horton  <timothy_hor...@apple.com>
+
+        REGRESSION (r255322): macCatalyst: Tapping in an input field doesn't change the selection location
+        https://bugs.webkit.org/show_bug.cgi?id=206978
+
+        Reviewed by Wenson Hsieh.
+
+        * page/ChromeClient.h:
+        (WebCore::ChromeClient::shouldUseMouseEventForSelection):
+        (WebCore::ChromeClient::shouldUseMouseEventsForSelection): Deleted.
+        * page/EventHandler.cpp:
+        (WebCore::EventHandler::canMouseDownStartSelect):
+        (WebCore::EventHandler::handleMousePressEvent):
+        * page/EventHandler.h:
+        Plumb the event through to the ChromeClient so it can use it to make decisions.
+
 2020-01-29  Ryosuke Niwa  <rn...@webkit.org>
 
         REGRESSION: [Mac wk1] imported/w3c/web-platform-tests/mathml/presentation-markup/scripts/underover-parameters-3.html is a flakey failure

Modified: trunk/Source/WebCore/page/ChromeClient.h (255414 => 255415)


--- trunk/Source/WebCore/page/ChromeClient.h	2020-01-30 04:15:51 UTC (rev 255414)
+++ trunk/Source/WebCore/page/ChromeClient.h	2020-01-30 04:47:38 UTC (rev 255415)
@@ -193,7 +193,7 @@
     virtual void setCursorHiddenUntilMouseMoves(bool) = 0;
     virtual bool supportsSettingCursor() { return true; }
 
-    virtual bool shouldUseMouseEventsForSelection() { return true; }
+    virtual bool shouldUseMouseEventForSelection(const PlatformMouseEvent&) { return true; }
 
     virtual FloatSize screenSize() const { return const_cast<ChromeClient&>(*this).windowRect().size(); }
     virtual FloatSize availableScreenSize() const { return const_cast<ChromeClient&>(*this).windowRect().size(); }

Modified: trunk/Source/WebCore/page/EventHandler.cpp (255414 => 255415)


--- trunk/Source/WebCore/page/EventHandler.cpp	2020-01-30 04:15:51 UTC (rev 255414)
+++ trunk/Source/WebCore/page/EventHandler.cpp	2020-01-30 04:47:38 UTC (rev 255415)
@@ -731,10 +731,12 @@
     return handled;
 }
 
-bool EventHandler::canMouseDownStartSelect(Node* node)
+bool EventHandler::canMouseDownStartSelect(const MouseEventWithHitTestResults& event)
 {
+    auto* node = event.targetNode();
+
     if (Page* page = m_frame.page()) {
-        if (!page->chrome().client().shouldUseMouseEventsForSelection())
+        if (!page->chrome().client().shouldUseMouseEventForSelection(event.event()))
             return false;
     }
     
@@ -768,7 +770,7 @@
 
     // If we got the event back, that must mean it wasn't prevented,
     // so it's allowed to start a drag or selection if it wasn't in a scrollbar.
-    m_mouseDownMayStartSelect = canMouseDownStartSelect(event.targetNode()) && !event.scrollbar();
+    m_mouseDownMayStartSelect = canMouseDownStartSelect(event) && !event.scrollbar();
     
 #if ENABLE(DRAG_SUPPORT)
     // Careful that the drag starting logic stays in sync with eventMayStartDrag()

Modified: trunk/Source/WebCore/page/EventHandler.h (255414 => 255415)


--- trunk/Source/WebCore/page/EventHandler.h	2020-01-30 04:15:51 UTC (rev 255414)
+++ trunk/Source/WebCore/page/EventHandler.h	2020-01-30 04:47:38 UTC (rev 255415)
@@ -500,7 +500,7 @@
 
     bool shouldSendMouseEventsToInactiveWindows() const;
 
-    bool canMouseDownStartSelect(Node*);
+    bool canMouseDownStartSelect(const MouseEventWithHitTestResults&);
 
     Frame& m_frame;
 

Modified: trunk/Source/WebKit/ChangeLog (255414 => 255415)


--- trunk/Source/WebKit/ChangeLog	2020-01-30 04:15:51 UTC (rev 255414)
+++ trunk/Source/WebKit/ChangeLog	2020-01-30 04:47:38 UTC (rev 255415)
@@ -1,3 +1,20 @@
+2020-01-29  Tim Horton  <timothy_hor...@apple.com>
+
+        REGRESSION (r255322): macCatalyst: Tapping in an input field doesn't change the selection location
+        https://bugs.webkit.org/show_bug.cgi?id=206978
+
+        Reviewed by Wenson Hsieh.
+
+        * WebProcess/WebCoreSupport/WebChromeClient.h:
+        * WebProcess/WebCoreSupport/ios/WebChromeClientIOS.mm:
+        (WebKit::WebChromeClient::shouldUseMouseEventForSelection):
+        (WebKit::WebChromeClient::shouldUseMouseEventsForSelection): Deleted.
+        Allow single-click events to change the selection; this is required
+        in order to allow WebCore to set the selection in the case that
+        the UITextInteraction gestures haven't yet been installed. Continue
+        to not allow multi-click events to change the selection, because
+        these are the ones that conflict with UIKit's behaviors.
+
 2020-01-29  Commit Queue  <commit-qu...@webkit.org>
 
         Unreviewed, rolling out r254379.

Modified: trunk/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.h (255414 => 255415)


--- trunk/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.h	2020-01-30 04:15:51 UTC (rev 255414)
+++ trunk/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.h	2020-01-30 04:47:38 UTC (rev 255415)
@@ -182,7 +182,7 @@
     void didCreateEditableImage(WebCore::GraphicsLayer::EmbeddedViewID) final;
     void didDestroyEditableImage(WebCore::GraphicsLayer::EmbeddedViewID) final;
 
-    bool shouldUseMouseEventsForSelection() final;
+    bool shouldUseMouseEventForSelection(const WebCore::PlatformMouseEvent&) final;
 #endif
 
 #if ENABLE(ORIENTATION_EVENTS)

Modified: trunk/Source/WebKit/WebProcess/WebCoreSupport/ios/WebChromeClientIOS.mm (255414 => 255415)


--- trunk/Source/WebKit/WebProcess/WebCoreSupport/ios/WebChromeClientIOS.mm	2020-01-30 04:15:51 UTC (rev 255414)
+++ trunk/Source/WebKit/WebProcess/WebCoreSupport/ios/WebChromeClientIOS.mm	2020-01-30 04:47:38 UTC (rev 255415)
@@ -40,6 +40,7 @@
 #import <WebCore/ContentChangeObserver.h>
 #import <WebCore/Icon.h>
 #import <WebCore/NotImplemented.h>
+#import <WebCore/PlatformMouseEvent.h>
 #import <wtf/RefPtr.h>
 
 namespace WebKit {
@@ -181,11 +182,12 @@
 #endif
 }
 
-bool WebChromeClient::shouldUseMouseEventsForSelection()
+bool WebChromeClient::shouldUseMouseEventForSelection(const WebCore::PlatformMouseEvent& event)
 {
     // In macCatalyst, despite getting mouse events, we still want UITextInteraction and friends to own selection gestures.
+    // However, we need to allow single-clicks to set the selection, because that is how UITextInteraction is activated.
 #if HAVE(HOVER_GESTURE_RECOGNIZER)
-    return false;
+    return event.clickCount() <= 1;
 #else
     return true;
 #endif
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to