⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 244042 in webkit


Ignore:
Timestamp:
Apr 8, 2019, 1:50:08 PM (7 years ago)
Author:
Antti Koivisto
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.

Location:
trunk/Source/WebKit
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/ChangeLog

    r244035 r244042  
     12019-04-08  Antti Koivisto  <antti@apple.com>
     2
     3        Compute touch actions for touch point from remote layer tree regions
     4        https://bugs.webkit.org/show_bug.cgi?id=196701
     5
     6        Reviewed by Simon Fraser.
     7
     8        Add a function for finding the right layer and getting the touch actions in UI process side.
     9
     10        The code is not used yet.
     11
     12        * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.h:
     13        * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.mm:
     14        (WebKit::touchActionsForPoint):
     15
     16        Use the same code as overlap hit testing for collecting the candidate layers for the touch point,
     17        taking event regions into account.
     18        Return the touch actions from the deepest event sensitive layer hit.
     19
     20        (-[UIView _web_findDescendantViewAtPoint:withEvent:]):
     21
     22        Modernize.
     23
    1242019-04-08  Brent Fulgham  <bfulgham@apple.com>
    225
  • trunk/Source/WebKit/UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.h

    r243134 r244042  
    7373@end
    7474
     75namespace WebKit {
     76
     77#if ENABLE(POINTER_EVENTS)
     78OptionSet<WebCore::TouchAction> touchActionsForPoint(UIView *rootView, const WebCore::IntPoint&);
     79#endif
     80
     81}
     82
    7583#endif // PLATFORM(IOS_FAMILY)
  • trunk/Source/WebKit/UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.mm

    r243380 r244042  
    9090}
    9191
     92#if ENABLE(POINTER_EVENTS)
     93OptionSet<WebCore::TouchAction> touchActionsForPoint(UIView *rootView, const WebCore::IntPoint& point)
     94{
     95    Vector<UIView *, 16> viewsAtPoint;
     96    collectDescendantViewsAtPoint(viewsAtPoint, rootView, point, nil);
     97
     98    if (viewsAtPoint.isEmpty())
     99        return { WebCore::TouchAction::Auto };
     100
     101    auto *hitView = viewsAtPoint.last();
     102
     103    CGPoint hitViewPoint = [hitView convertPoint:point fromView:rootView];
     104
     105    auto* node = RemoteLayerTreeNode::forCALayer(hitView.layer);
     106    if (!node)
     107        return { WebCore::TouchAction::Auto };
     108
     109    return node->eventRegion().touchActionsForPoint(WebCore::IntPoint(hitViewPoint));
     110}
     111#endif
     112
    92113}
    93114
     
    103124    WebKit::collectDescendantViewsAtPoint(viewsAtPoint, self, point, event);
    104125
    105     for (auto i = viewsAtPoint.size(); i--;) {
    106         auto *view = viewsAtPoint[i];
     126    for (auto *view : WTF::makeReversedRange(viewsAtPoint)) {
    107127        if (!view.isUserInteractionEnabled)
    108128            continue;
Note: See TracChangeset for help on using the changeset viewer.