Title: [253731] trunk/Source
Revision
253731
Author
[email protected]
Date
2019-12-18 18:21:35 -0800 (Wed, 18 Dec 2019)

Log Message

macCatalyst: Cursor should update when the platform deems it necessary
https://bugs.webkit.org/show_bug.cgi?id=205429
<rdar://problem/57983076>

Reviewed by Wenson Hsieh.

* Shared/ios/InteractionInformationAtPosition.h:
* Shared/ios/InteractionInformationAtPosition.mm:
(WebKit::InteractionInformationAtPosition::encode const):
(WebKit::InteractionInformationAtPosition::decode):
* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::positionInformation):
Expose the current cursor and caret size on position information so
that macCatalyst UIKit can retrieve it out-of-band (in addition to
setting it when we do a hit-test, like in r253636).

* page/EventHandler.h:
Expose selectCursor for WebKit's use.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (253730 => 253731)


--- trunk/Source/WebCore/ChangeLog	2019-12-19 02:01:22 UTC (rev 253730)
+++ trunk/Source/WebCore/ChangeLog	2019-12-19 02:21:35 UTC (rev 253731)
@@ -1,3 +1,14 @@
+2019-12-18  Tim Horton  <[email protected]>
+
+        macCatalyst: Cursor should update when the platform deems it necessary
+        https://bugs.webkit.org/show_bug.cgi?id=205429
+        <rdar://problem/57983076>
+
+        Reviewed by Wenson Hsieh.
+
+        * page/EventHandler.h:
+        Expose selectCursor for WebKit's use.
+
 2019-12-18  Antoine Quint  <[email protected]>
 
         Animations stop if new tab opened (and closed)

Modified: trunk/Source/WebCore/page/EventHandler.h (253730 => 253731)


--- trunk/Source/WebCore/page/EventHandler.h	2019-12-19 02:01:22 UTC (rev 253730)
+++ trunk/Source/WebCore/page/EventHandler.h	2019-12-19 02:21:35 UTC (rev 253731)
@@ -341,6 +341,8 @@
     WEBCORE_EXPORT void cancelSelectionAutoscroll();
 #endif
 
+    WEBCORE_EXPORT Optional<Cursor> selectCursor(const HitTestResult&, bool shiftKey);
+
 private:
 #if ENABLE(DRAG_SUPPORT)
     static DragState& dragState();
@@ -371,7 +373,6 @@
 
     bool internalKeyEvent(const PlatformKeyboardEvent&);
 
-    Optional<Cursor> selectCursor(const HitTestResult&, bool shiftKey);
     void updateCursor(FrameView&, const HitTestResult&, bool shiftKey);
 
     void hoverTimerFired();

Modified: trunk/Source/WebKit/ChangeLog (253730 => 253731)


--- trunk/Source/WebKit/ChangeLog	2019-12-19 02:01:22 UTC (rev 253730)
+++ trunk/Source/WebKit/ChangeLog	2019-12-19 02:21:35 UTC (rev 253731)
@@ -1,3 +1,21 @@
+2019-12-18  Tim Horton  <[email protected]>
+
+        macCatalyst: Cursor should update when the platform deems it necessary
+        https://bugs.webkit.org/show_bug.cgi?id=205429
+        <rdar://problem/57983076>
+
+        Reviewed by Wenson Hsieh.
+
+        * Shared/ios/InteractionInformationAtPosition.h:
+        * Shared/ios/InteractionInformationAtPosition.mm:
+        (WebKit::InteractionInformationAtPosition::encode const):
+        (WebKit::InteractionInformationAtPosition::decode):
+        * WebProcess/WebPage/ios/WebPageIOS.mm:
+        (WebKit::WebPage::positionInformation):
+        Expose the current cursor and caret size on position information so
+        that macCatalyst UIKit can retrieve it out-of-band (in addition to
+        setting it when we do a hit-test, like in r253636.
+
 2019-12-18  Alex Christensen  <[email protected]>
 
         Add ObjC version of WKBundleFrameIsMainFrame

Modified: trunk/Source/WebKit/Shared/ios/InteractionInformationAtPosition.h (253730 => 253731)


--- trunk/Source/WebKit/Shared/ios/InteractionInformationAtPosition.h	2019-12-19 02:01:22 UTC (rev 253730)
+++ trunk/Source/WebKit/Shared/ios/InteractionInformationAtPosition.h	2019-12-19 02:21:35 UTC (rev 253731)
@@ -30,6 +30,7 @@
 #include "ArgumentCoders.h"
 #include "InteractionInformationRequest.h"
 #include "ShareableBitmap.h"
+#include <WebCore/Cursor.h>
 #include <WebCore/ElementContext.h>
 #include <WebCore/IntPoint.h>
 #include <WebCore/ScrollTypes.h>
@@ -83,6 +84,10 @@
     String textBefore;
     String textAfter;
 
+    float caretHeight { 0 };
+
+    Optional<WebCore::Cursor> cursor;
+
     WebCore::TextIndicatorData linkIndicator;
 #if ENABLE(DATA_DETECTION)
     String dataDetectorIdentifier;

Modified: trunk/Source/WebKit/Shared/ios/InteractionInformationAtPosition.mm (253730 => 253731)


--- trunk/Source/WebKit/Shared/ios/InteractionInformationAtPosition.mm	2019-12-19 02:01:22 UTC (rev 253730)
+++ trunk/Source/WebKit/Shared/ios/InteractionInformationAtPosition.mm	2019-12-19 02:21:35 UTC (rev 253731)
@@ -68,6 +68,8 @@
 #endif
     encoder << textBefore;
     encoder << textAfter;
+    encoder << caretHeight;
+    encoder << cursor;
     encoder << linkIndicator;
 
     ShareableBitmap::Handle handle;
@@ -158,6 +160,12 @@
     
     if (!decoder.decode(result.textAfter))
         return false;
+
+    if (!decoder.decode(result.caretHeight))
+        return false;
+
+    if (!decoder.decode(result.cursor))
+        return false;
     
     Optional<WebCore::TextIndicatorData> linkIndicator;
     decoder >> linkIndicator;

Modified: trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm (253730 => 253731)


--- trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm	2019-12-19 02:01:22 UTC (rev 253730)
+++ trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm	2019-12-19 02:21:35 UTC (rev 253731)
@@ -2759,6 +2759,16 @@
     info.adjustedPointForNodeRespondingToClickEvents = adjustedPoint;
     info.nodeAtPositionHasDoubleClickHandler = m_page->mainFrame().nodeRespondingToDoubleClickEvent(request.point, adjustedPoint);
 
+    auto& eventHandler = m_page->mainFrame().eventHandler();
+    HitTestResult hitTestResult = eventHandler.hitTestResultAtPoint(request.point, HitTestRequest::ReadOnly | HitTestRequest::AllowFrameScrollbars);
+    info.cursor = eventHandler.selectCursor(hitTestResult, false);
+    if (auto* frame = hitTestResult.innerNodeFrame()) {
+        if (auto* frameView = frame->view()) {
+            VisiblePosition position = frame->visiblePositionForPoint(request.point);
+            info.caretHeight = frameView->contentsToRootView(position.absoluteCaretBounds()).height();
+        }
+    }
+
 #if ENABLE(DATA_INTERACTION)
     info.hasSelectionAtPosition = m_page->hasSelectionAtPosition(adjustedPoint);
 #endif
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to