Skip to content
Permalink
Browse files
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.


Canonical link: https://commits.webkit.org/210981@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@244042 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
anttijk committed Apr 8, 2019
1 parent 58e4237 commit 24686d6723636756787a6758d4b71ec1f90504e4
Showing 3 changed files with 53 additions and 2 deletions.
@@ -1,3 +1,26 @@
2019-04-08 Antti Koivisto <antti@apple.com>

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 <bfulgham@apple.com>

Make HSTS list handling more robust against unexpected content
@@ -72,4 +72,12 @@ class WebPageProxy;

@end

namespace WebKit {

#if ENABLE(POINTER_EVENTS)
OptionSet<WebCore::TouchAction> touchActionsForPoint(UIView *rootView, const WebCore::IntPoint&);
#endif

}

#endif // PLATFORM(IOS_FAMILY)
@@ -89,6 +89,27 @@ static bool isScrolledBy(WKChildScrollView* scrollView, UIView *hitView)
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)
@@ -102,8 +123,7 @@ - (UIView *)_web_findDescendantViewAtPoint:(CGPoint)point withEvent:(UIEvent *)e
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;

0 comments on commit 24686d6

Please sign in to comment.