Title: [244042] trunk/Source/WebKit
Revision
244042
Author
[email protected]
Date
2019-04-08 13:50:08 -0700 (Mon, 08 Apr 2019)

Log Message

Compute touch actions for touch point from remote layer tree regions
https://bugs.webkit.org/show_bug.cgi?id=196701

Reviewed by Simon Fraser.

Add a function for finding the right layer and getting the touch actions in UI process side.

The code is not used yet.

* UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.h:
* UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.mm:
(WebKit::touchActionsForPoint):

Use the same code as overlap hit testing for collecting the candidate layers for the touch point,
taking event regions into account.
Return the touch actions from the deepest event sensitive layer hit.

(-[UIView _web_findDescendantViewAtPoint:withEvent:]):

Modernize.

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (244041 => 244042)


--- trunk/Source/WebKit/ChangeLog	2019-04-08 20:48:19 UTC (rev 244041)
+++ trunk/Source/WebKit/ChangeLog	2019-04-08 20:50:08 UTC (rev 244042)
@@ -1,3 +1,26 @@
+2019-04-08  Antti Koivisto  <[email protected]>
+
+        Compute touch actions for touch point from remote layer tree regions
+        https://bugs.webkit.org/show_bug.cgi?id=196701
+
+        Reviewed by Simon Fraser.
+
+        Add a function for finding the right layer and getting the touch actions in UI process side.
+
+        The code is not used yet.
+
+        * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.h:
+        * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.mm:
+        (WebKit::touchActionsForPoint):
+
+        Use the same code as overlap hit testing for collecting the candidate layers for the touch point,
+        taking event regions into account.
+        Return the touch actions from the deepest event sensitive layer hit.
+
+        (-[UIView _web_findDescendantViewAtPoint:withEvent:]):
+
+        Modernize.
+
 2019-04-08  Brent Fulgham  <[email protected]>
 
         Make HSTS list handling more robust against unexpected content 

Modified: trunk/Source/WebKit/UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.h (244041 => 244042)


--- trunk/Source/WebKit/UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.h	2019-04-08 20:48:19 UTC (rev 244041)
+++ trunk/Source/WebKit/UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.h	2019-04-08 20:50:08 UTC (rev 244042)
@@ -72,4 +72,12 @@
 
 @end
 
+namespace WebKit {
+
+#if ENABLE(POINTER_EVENTS)
+OptionSet<WebCore::TouchAction> touchActionsForPoint(UIView *rootView, const WebCore::IntPoint&);
+#endif
+
+}
+
 #endif // PLATFORM(IOS_FAMILY)

Modified: trunk/Source/WebKit/UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.mm (244041 => 244042)


--- trunk/Source/WebKit/UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.mm	2019-04-08 20:48:19 UTC (rev 244041)
+++ trunk/Source/WebKit/UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.mm	2019-04-08 20:50:08 UTC (rev 244042)
@@ -89,8 +89,29 @@
     return false;
 }
 
+#if ENABLE(POINTER_EVENTS)
+OptionSet<WebCore::TouchAction> touchActionsForPoint(UIView *rootView, const WebCore::IntPoint& point)
+{
+    Vector<UIView *, 16> viewsAtPoint;
+    collectDescendantViewsAtPoint(viewsAtPoint, rootView, point, nil);
+
+    if (viewsAtPoint.isEmpty())
+        return { WebCore::TouchAction::Auto };
+
+    auto *hitView = viewsAtPoint.last();
+
+    CGPoint hitViewPoint = [hitView convertPoint:point fromView:rootView];
+
+    auto* node = RemoteLayerTreeNode::forCALayer(hitView.layer);
+    if (!node)
+        return { WebCore::TouchAction::Auto };
+
+    return node->eventRegion().touchActionsForPoint(WebCore::IntPoint(hitViewPoint));
 }
+#endif
 
+}
+
 @interface UIView (WKHitTesting)
 - (UIView *)_web_findDescendantViewAtPoint:(CGPoint)point withEvent:(UIEvent *)event;
 @end
@@ -102,8 +123,7 @@
     Vector<UIView *, 16> viewsAtPoint;
     WebKit::collectDescendantViewsAtPoint(viewsAtPoint, self, point, event);
 
-    for (auto i = viewsAtPoint.size(); i--;) {
-        auto *view = viewsAtPoint[i];
+    for (auto *view : WTF::makeReversedRange(viewsAtPoint)) {
         if (!view.isUserInteractionEnabled)
             continue;
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to