Title: [248466] branches/safari-608.1-branch/Source
Revision
248466
Author
[email protected]
Date
2019-08-09 08:53:59 -0700 (Fri, 09 Aug 2019)

Log Message

Cherry-pick r248447. rdar://problem/54109873

    Add to InteractionInformationAtPosition information about whether the element is in a subscrollable region
    https://bugs.webkit.org/show_bug.cgi?id=200374
    rdar://problem/54095519

    Reviewed by Tim Horton.
    Source/WebCore:

    Add to InteractionInformationAtPosition a ScrollingNodeID which represents the enclosing scrolling
    node that affects the targeted element's position. We use this to find a UIScrollView in the UI process.

    The entrypoint to finding the enclosing scrolling node is ScrollingCoordinator::scrollableContainerNodeID(),
    which calls RenderLayerCompositor::asyncScrollableContainerNodeID() to look for a scrolling ancestor in
    the current frame, and then looks for an enclosing scrollable frame, or a scrolling ancestor in
    the enclosing frame.

    There's a bit of subtlety in RenderLayerCompositor::asyncScrollableContainerNodeID() because if you're asking
    for the node that scrolls the renderer, if the renderer itself has a layer and is scrollable, you want
    its enclosing scroller.

    * page/scrolling/AsyncScrollingCoordinator.cpp:
    (WebCore::AsyncScrollingCoordinator::scrollableContainerNodeID const):
    * page/scrolling/AsyncScrollingCoordinator.h:
    * page/scrolling/ScrollingCoordinator.cpp:
    (WebCore::scrollableContainerNodeID const):
    * page/scrolling/ScrollingCoordinator.h:
    * rendering/RenderLayer.h:
    * rendering/RenderLayerCompositor.cpp:
    (WebCore::RenderLayerCompositor::asyncScrollableContainerNodeID):
    * rendering/RenderLayerCompositor.h:

    Source/WebKit:

    Add InteractionInformationAtPosition.containerScrollingNodeID and initialize it in elementPositionInformation()
    by asking the scrolling coordinator.

    Also add a way to get from a ScrollingNodeID to a UIScrollView to RemoteScrollingCoordinatorProxy,
    which gets the scrolling node and asks the delegate for the UIView.

    * Shared/ios/InteractionInformationAtPosition.h:
    * Shared/ios/InteractionInformationAtPosition.mm:
    (WebKit::InteractionInformationAtPosition::encode const):
    (WebKit::InteractionInformationAtPosition::decode):
    * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.h:
    * UIProcess/RemoteLayerTree/ios/RemoteScrollingCoordinatorProxyIOS.mm:
    (WebKit::RemoteScrollingCoordinatorProxy::scrollViewForScrollingNodeID const):
    * UIProcess/RemoteLayerTree/ios/ScrollingTreeOverflowScrollingNodeIOS.h:
    * UIProcess/RemoteLayerTree/ios/ScrollingTreeOverflowScrollingNodeIOS.mm:
    (WebKit::ScrollingTreeOverflowScrollingNodeIOS::scrollView const):
    * UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.h:
    * WebProcess/WebPage/ios/WebPageIOS.mm:
    (WebKit::elementPositionInformation):

    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@248447 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Modified Paths

Diff

Modified: branches/safari-608.1-branch/Source/WebCore/ChangeLog (248465 => 248466)


--- branches/safari-608.1-branch/Source/WebCore/ChangeLog	2019-08-09 14:54:33 UTC (rev 248465)
+++ branches/safari-608.1-branch/Source/WebCore/ChangeLog	2019-08-09 15:53:59 UTC (rev 248466)
@@ -1,64 +1,122 @@
-2019-08-08  Kocsen Chung  <[email protected]>
+2019-08-09  Kocsen Chung  <[email protected]>
 
-        Cherry-pick r248438. rdar://problem/54093226
+        Cherry-pick r248447. rdar://problem/54109873
 
-    [iOS] Position image information should respect the image orientation
-    https://bugs.webkit.org/show_bug.cgi?id=200487
+    Add to InteractionInformationAtPosition information about whether the element is in a subscrollable region
+    https://bugs.webkit.org/show_bug.cgi?id=200374
+    rdar://problem/54095519
     
-    Patch by Said Abou-Hallawa <[email protected]> on 2019-08-08
-    Reviewed by Simon Fraser.
-    
+    Reviewed by Tim Horton.
     Source/WebCore:
     
-    Re-factor CachedImage::imageSizeForRenderer() into another overriding
-    function which does not scale the imageSize. Therefore the new function
-    returns FloatSize while the original function returns LayoutSize.
+    Add to InteractionInformationAtPosition a ScrollingNodeID which represents the enclosing scrolling
+    node that affects the targeted element's position. We use this to find a UIScrollView in the UI process.
     
-    * loader/cache/CachedImage.cpp:
-    (WebCore::CachedImage::imageSizeForRenderer const):
-    * loader/cache/CachedImage.h:
-    * rendering/RenderElement.h:
+    The entrypoint to finding the enclosing scrolling node is ScrollingCoordinator::scrollableContainerNodeID(),
+    which calls RenderLayerCompositor::asyncScrollableContainerNodeID() to look for a scrolling ancestor in
+    the current frame, and then looks for an enclosing scrollable frame, or a scrolling ancestor in
+    the enclosing frame.
     
+    There's a bit of subtlety in RenderLayerCompositor::asyncScrollableContainerNodeID() because if you're asking
+    for the node that scrolls the renderer, if the renderer itself has a layer and is scrollable, you want
+    its enclosing scroller.
+    
+    * page/scrolling/AsyncScrollingCoordinator.cpp:
+    (WebCore::AsyncScrollingCoordinator::scrollableContainerNodeID const):
+    * page/scrolling/AsyncScrollingCoordinator.h:
+    * page/scrolling/ScrollingCoordinator.cpp:
+    (WebCore::scrollableContainerNodeID const):
+    * page/scrolling/ScrollingCoordinator.h:
+    * rendering/RenderLayer.h:
+    * rendering/RenderLayerCompositor.cpp:
+    (WebCore::RenderLayerCompositor::asyncScrollableContainerNodeID):
+    * rendering/RenderLayerCompositor.h:
+    
     Source/WebKit:
     
-    imagePositionInformation() should respect the image orientation when
-    drawing an Image to a ShareableBitmap context.
+    Add InteractionInformationAtPosition.containerScrollingNodeID and initialize it in elementPositionInformation()
+    by asking the scrolling coordinator.
     
-    boundsPositionInformation() already takes care of the image orientation
-    because it gets RenderImage::enclosingBoundingBox().
+    Also add a way to get from a ScrollingNodeID to a UIScrollView to RemoteScrollingCoordinatorProxy,
+    which gets the scrolling node and asks the delegate for the UIView.
     
+    * Shared/ios/InteractionInformationAtPosition.h:
+    * Shared/ios/InteractionInformationAtPosition.mm:
+    (WebKit::InteractionInformationAtPosition::encode const):
+    (WebKit::InteractionInformationAtPosition::decode):
+    * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.h:
+    * UIProcess/RemoteLayerTree/ios/RemoteScrollingCoordinatorProxyIOS.mm:
+    (WebKit::RemoteScrollingCoordinatorProxy::scrollViewForScrollingNodeID const):
+    * UIProcess/RemoteLayerTree/ios/ScrollingTreeOverflowScrollingNodeIOS.h:
+    * UIProcess/RemoteLayerTree/ios/ScrollingTreeOverflowScrollingNodeIOS.mm:
+    (WebKit::ScrollingTreeOverflowScrollingNodeIOS::scrollView const):
+    * UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.h:
     * WebProcess/WebPage/ios/WebPageIOS.mm:
-    (WebKit::imagePositionInformation):
+    (WebKit::elementPositionInformation):
     
-    Tools:
-    
-    Add an API test to verify the position image information is drawn rotated
-    because of respecting its image orientation.
-    
-    * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
-    * TestWebKitAPI/Tests/WebKitCocoa/WKRequestActivatedElementInfo.mm:
-    (TestWebKitAPI::TEST):
-    * TestWebKitAPI/Tests/WebKitCocoa/exif-orientation-8-llo.jpg: Added.
-    * TestWebKitAPI/Tests/WebKitCocoa/img-with-rotated-image.html: Added.
-    
-    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@248438 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@248447 268f45cc-cd09-0410-ab3c-d52691b4dbfc
 
-    2019-08-08  Said Abou-Hallawa  <[email protected]>
+    2019-08-08  Kocsen Chung  <[email protected]>
 
-            [iOS] Position image information should respect the image orientation
-            https://bugs.webkit.org/show_bug.cgi?id=200487
+            Cherry-pick r248438. rdar://problem/54093226
 
-            Reviewed by Simon Fraser.
+        [iOS] Position image information should respect the image orientation
+        https://bugs.webkit.org/show_bug.cgi?id=200487
 
-            Re-factor CachedImage::imageSizeForRenderer() into another overriding
-            function which does not scale the imageSize. Therefore the new function
-            returns FloatSize while the original function returns LayoutSize.
+        Patch by Said Abou-Hallawa <[email protected]> on 2019-08-08
+        Reviewed by Simon Fraser.
 
-            * loader/cache/CachedImage.cpp:
-            (WebCore::CachedImage::imageSizeForRenderer const):
-            * loader/cache/CachedImage.h:
-            * rendering/RenderElement.h:
+        Source/WebCore:
 
+        Re-factor CachedImage::imageSizeForRenderer() into another overriding
+        function which does not scale the imageSize. Therefore the new function
+        returns FloatSize while the original function returns LayoutSize.
+
+        * loader/cache/CachedImage.cpp:
+        (WebCore::CachedImage::imageSizeForRenderer const):
+        * loader/cache/CachedImage.h:
+        * rendering/RenderElement.h:
+
+        Source/WebKit:
+
+        imagePositionInformation() should respect the image orientation when
+        drawing an Image to a ShareableBitmap context.
+
+        boundsPositionInformation() already takes care of the image orientation
+        because it gets RenderImage::enclosingBoundingBox().
+
+        * WebProcess/WebPage/ios/WebPageIOS.mm:
+        (WebKit::imagePositionInformation):
+
+        Tools:
+
+        Add an API test to verify the position image information is drawn rotated
+        because of respecting its image orientation.
+
+        * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
+        * TestWebKitAPI/Tests/WebKitCocoa/WKRequestActivatedElementInfo.mm:
+        (TestWebKitAPI::TEST):
+        * TestWebKitAPI/Tests/WebKitCocoa/exif-orientation-8-llo.jpg: Added.
+        * TestWebKitAPI/Tests/WebKitCocoa/img-with-rotated-image.html: Added.
+
+        git-svn-id: https://svn.webkit.org/repository/webkit/trunk@248438 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+        2019-08-08  Said Abou-Hallawa  <[email protected]>
+
+                [iOS] Position image information should respect the image orientation
+                https://bugs.webkit.org/show_bug.cgi?id=200487
+
+                Reviewed by Simon Fraser.
+
+                Re-factor CachedImage::imageSizeForRenderer() into another overriding
+                function which does not scale the imageSize. Therefore the new function
+                returns FloatSize while the original function returns LayoutSize.
+
+                * loader/cache/CachedImage.cpp:
+                (WebCore::CachedImage::imageSizeForRenderer const):
+                * loader/cache/CachedImage.h:
+                * rendering/RenderElement.h:
+
 2019-08-08  Alan Coon  <[email protected]>
 
         Cherry-pick r248410. rdar://problem/54084738
@@ -378,6 +436,37 @@
 
             Reviewed by Darin Adler.
 
+2019-08-08  Simon Fraser  <[email protected]>
+
+        Add to InteractionInformationAtPosition information about whether the element is in a subscrollable region
+        https://bugs.webkit.org/show_bug.cgi?id=200374
+        rdar://problem/54095519
+
+        Reviewed by Tim Horton.
+
+        Add to InteractionInformationAtPosition a ScrollingNodeID which represents the enclosing scrolling
+        node that affects the targeted element's position. We use this to find a UIScrollView in the UI process.
+        
+        The entrypoint to finding the enclosing scrolling node is ScrollingCoordinator::scrollableContainerNodeID(),
+        which calls RenderLayerCompositor::asyncScrollableContainerNodeID() to look for a scrolling ancestor in
+        the current frame, and then looks for an enclosing scrollable frame, or a scrolling ancestor in
+        the enclosing frame.
+        
+        There's a bit of subtlety in RenderLayerCompositor::asyncScrollableContainerNodeID() because if you're asking
+        for the node that scrolls the renderer, if the renderer itself has a layer and is scrollable, you want
+        its enclosing scroller.
+
+        * page/scrolling/AsyncScrollingCoordinator.cpp:
+        (WebCore::AsyncScrollingCoordinator::scrollableContainerNodeID const):
+        * page/scrolling/AsyncScrollingCoordinator.h:
+        * page/scrolling/ScrollingCoordinator.cpp:
+        (WebCore::scrollableContainerNodeID const):
+        * page/scrolling/ScrollingCoordinator.h:
+        * rendering/RenderLayer.h:
+        * rendering/RenderLayerCompositor.cpp:
+        (WebCore::RenderLayerCompositor::asyncScrollableContainerNodeID):
+        * rendering/RenderLayerCompositor.h:
+
             We normally prevent page caching if there were any pending subresource loads when navigating,
             to avoid caching partial / broken content. However, this should not apply to Ping / Beacon
             loads since those do not impact page rendering and can outlive the page.

Modified: branches/safari-608.1-branch/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.cpp (248465 => 248466)


--- branches/safari-608.1-branch/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.cpp	2019-08-09 14:54:33 UTC (rev 248465)
+++ branches/safari-608.1-branch/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.cpp	2019-08-09 15:53:59 UTC (rev 248466)
@@ -37,6 +37,8 @@
 #include "Logging.h"
 #include "Page.h"
 #include "PerformanceLoggingClient.h"
+#include "RenderLayerCompositor.h"
+#include "RenderView.h"
 #include "ScrollAnimator.h"
 #include "ScrollingConstraints.h"
 #include "ScrollingStateFixedNode.h"
@@ -784,6 +786,28 @@
     return settings.asyncFrameScrollingEnabled() || settings.asyncOverflowScrollingEnabled();
 }
 
+ScrollingNodeID AsyncScrollingCoordinator::scrollableContainerNodeID(const RenderObject& renderer) const
+{
+    if (auto overflowScrollingNodeID = renderer.view().compositor().asyncScrollableContainerNodeID(renderer))
+        return overflowScrollingNodeID;
+
+    // If we're in a scrollable frame, return that.
+    auto* frameView = renderer.frame().view();
+    if (!frameView)
+        return 0;
+
+    if (auto scrollingNodeID = frameView->scrollingNodeID())
+        return scrollingNodeID;
+
+    // Otherwise, look for a scrollable element in the containing frame.
+    if (auto* ownerElement = renderer.document().ownerElement()) {
+        if (auto* frameRenderer = ownerElement->renderer())
+            return scrollableContainerNodeID(*frameRenderer);
+    }
+
+    return 0;
+}
+
 String AsyncScrollingCoordinator::scrollingStateTreeAsText(ScrollingStateTreeAsTextBehavior behavior) const
 {
     if (m_scrollingStateTree->rootStateNode()) {

Modified: branches/safari-608.1-branch/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.h (248465 => 248466)


--- branches/safari-608.1-branch/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.h	2019-08-09 14:54:33 UTC (rev 248465)
+++ branches/safari-608.1-branch/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.h	2019-08-09 15:53:59 UTC (rev 248466)
@@ -91,6 +91,8 @@
     
     bool asyncFrameOrOverflowScrollingEnabled() const;
 
+    WEBCORE_EXPORT ScrollingNodeID scrollableContainerNodeID(const RenderObject&) const override;
+
     WEBCORE_EXPORT void frameViewLayoutUpdated(FrameView&) override;
     WEBCORE_EXPORT void frameViewRootLayerDidChange(FrameView&) override;
     WEBCORE_EXPORT void frameViewVisualViewportChanged(FrameView&) override;

Modified: branches/safari-608.1-branch/Source/WebCore/page/scrolling/ScrollingCoordinator.cpp (248465 => 248466)


--- branches/safari-608.1-branch/Source/WebCore/page/scrolling/ScrollingCoordinator.cpp	2019-08-09 14:54:33 UTC (rev 248465)
+++ branches/safari-608.1-branch/Source/WebCore/page/scrolling/ScrollingCoordinator.cpp	2019-08-09 15:53:59 UTC (rev 248466)
@@ -96,6 +96,11 @@
     return layer.hasCompositedScrollableOverflow();
 }
 
+ScrollingNodeID ScrollingCoordinator::scrollableContainerNodeID(const RenderObject&) const
+{
+    return 0;
+}
+
 EventTrackingRegions ScrollingCoordinator::absoluteEventTrackingRegionsForFrame(const Frame& frame) const
 {
     auto* renderView = frame.contentRenderer();

Modified: branches/safari-608.1-branch/Source/WebCore/page/scrolling/ScrollingCoordinator.h (248465 => 248466)


--- branches/safari-608.1-branch/Source/WebCore/page/scrolling/ScrollingCoordinator.h	2019-08-09 14:54:33 UTC (rev 248465)
+++ branches/safari-608.1-branch/Source/WebCore/page/scrolling/ScrollingCoordinator.h	2019-08-09 15:53:59 UTC (rev 248466)
@@ -59,6 +59,7 @@
 class GraphicsLayer;
 class Page;
 class Region;
+class RenderObject;
 class RenderLayer;
 class ScrollableArea;
 class ViewportConstraints;
@@ -83,6 +84,9 @@
     // Return whether this scrolling coordinator handles scrolling for the given overflow scroll layer.
     WEBCORE_EXPORT virtual bool coordinatesScrollingForOverflowLayer(const RenderLayer&) const;
 
+    // Returns the ScrollingNodeID of the innermost scrolling node that scrolls the renderer.
+    WEBCORE_EXPORT virtual ScrollingNodeID scrollableContainerNodeID(const RenderObject&) const;
+
     // Should be called whenever the given frame view has been laid out.
     virtual void frameViewLayoutUpdated(FrameView&) { }
 

Modified: branches/safari-608.1-branch/Source/WebCore/rendering/RenderLayerCompositor.cpp (248465 => 248466)


--- branches/safari-608.1-branch/Source/WebCore/rendering/RenderLayerCompositor.cpp	2019-08-09 14:54:33 UTC (rev 248465)
+++ branches/safari-608.1-branch/Source/WebCore/rendering/RenderLayerCompositor.cpp	2019-08-09 15:53:59 UTC (rev 248466)
@@ -2708,6 +2708,37 @@
     return newStack;
 }
 
+// Note that this returns the ScrollingNodeID of the scroller this layer is embedded in, not the layer's own ScrollingNodeID if it has one.
+ScrollingNodeID RenderLayerCompositor::asyncScrollableContainerNodeID(const RenderObject& renderer)
+{
+    auto* enclosingLayer = renderer.enclosingLayer();
+    if (!enclosingLayer)
+        return 0;
+    
+    auto layerScrollingNodeID = [](const RenderLayer& layer) -> ScrollingNodeID {
+        if (layer.isComposited())
+            return layer.backing()->scrollingNodeIDForRole(ScrollCoordinationRole::Scrolling);
+        return 0;
+    };
+
+    // If the renderer is inside the layer, we care about the layer's scrollability. Otherwise, we let traverseAncestorLayers look at ancestors.
+    if (!renderer.hasLayer()) {
+        if (auto scrollingNodeID = layerScrollingNodeID(*enclosingLayer))
+            return scrollingNodeID;
+    }
+
+    ScrollingNodeID containerScrollingNodeID = 0;
+    traverseAncestorLayers(*enclosingLayer, [&](const RenderLayer& ancestorLayer, bool isContainingBlockChain, bool /*isPaintOrderAncestor*/) {
+        if (isContainingBlockChain && ancestorLayer.hasCompositedScrollableOverflow()) {
+            containerScrollingNodeID = layerScrollingNodeID(ancestorLayer);
+            return AncestorTraversal::Stop;
+        }
+        return AncestorTraversal::Continue;
+    });
+
+    return containerScrollingNodeID;
+}
+
 // Return true if the given layer is a stacking context and has compositing child
 // layers that it needs to clip. In this case we insert a clipping GraphicsLayer
 // into the hierarchy between this layer and its children in the z-order hierarchy.

Modified: branches/safari-608.1-branch/Source/WebCore/rendering/RenderLayerCompositor.h (248465 => 248466)


--- branches/safari-608.1-branch/Source/WebCore/rendering/RenderLayerCompositor.h	2019-08-09 14:54:33 UTC (rev 248465)
+++ branches/safari-608.1-branch/Source/WebCore/rendering/RenderLayerCompositor.h	2019-08-09 15:53:59 UTC (rev 248466)
@@ -214,6 +214,10 @@
 
     bool updateAncestorClippingStack(const RenderLayer&, const RenderLayer* compositingAncestor) const;
 
+    // Returns the ScrollingNodeID for the containing async-scrollable layer that scrolls this renderer's border box.
+    // May return 0 for position-fixed content.
+    static ScrollingNodeID asyncScrollableContainerNodeID(const RenderObject&);
+
     // Whether layer's backing needs a graphics layer to clip z-order children of the given layer.
     static bool clipsCompositingDescendants(const RenderLayer&);
 

Modified: branches/safari-608.1-branch/Source/WebKit/ChangeLog (248465 => 248466)


--- branches/safari-608.1-branch/Source/WebKit/ChangeLog	2019-08-09 14:54:33 UTC (rev 248465)
+++ branches/safari-608.1-branch/Source/WebKit/ChangeLog	2019-08-09 15:53:59 UTC (rev 248466)
@@ -1,50 +1,108 @@
-2019-08-08  Kocsen Chung  <[email protected]>
+2019-08-09  Kocsen Chung  <[email protected]>
 
-        Cherry-pick r248039. rdar://problem/54087592
+        Cherry-pick r248447. rdar://problem/54109873
 
-    [iOS 13] Safari crashes when closing a tab with a focused element if the unified field has focus
-    https://bugs.webkit.org/show_bug.cgi?id=200291
-    <rdar://problem/53717946>
+    Add to InteractionInformationAtPosition information about whether the element is in a subscrollable region
+    https://bugs.webkit.org/show_bug.cgi?id=200374
+    rdar://problem/54095519
     
-    Reviewed by Megan Gardner.
+    Reviewed by Tim Horton.
+    Source/WebCore:
     
-    Source/WebKit:
+    Add to InteractionInformationAtPosition a ScrollingNodeID which represents the enclosing scrolling
+    node that affects the targeted element's position. We use this to find a UIScrollView in the UI process.
     
-    Makes -requestAutocorrectionContextWithCompletionHandler: robust in the case where the web page has been closed,
-    and there is no Connection object to use when waiting for a sync IPC response.
+    The entrypoint to finding the enclosing scrolling node is ScrollingCoordinator::scrollableContainerNodeID(),
+    which calls RenderLayerCompositor::asyncScrollableContainerNodeID() to look for a scrolling ancestor in
+    the current frame, and then looks for an enclosing scrollable frame, or a scrolling ancestor in
+    the enclosing frame.
     
-    Test: AutocorrectionTests.RequestAutocorrectionContextAfterClosingPage
+    There's a bit of subtlety in RenderLayerCompositor::asyncScrollableContainerNodeID() because if you're asking
+    for the node that scrolls the renderer, if the renderer itself has a layer and is scrollable, you want
+    its enclosing scroller.
     
-    * UIProcess/ios/WKContentViewInteraction.mm:
-    (-[WKContentView requestAutocorrectionContextWithCompletionHandler:]):
+    * page/scrolling/AsyncScrollingCoordinator.cpp:
+    (WebCore::AsyncScrollingCoordinator::scrollableContainerNodeID const):
+    * page/scrolling/AsyncScrollingCoordinator.h:
+    * page/scrolling/ScrollingCoordinator.cpp:
+    (WebCore::scrollableContainerNodeID const):
+    * page/scrolling/ScrollingCoordinator.h:
+    * rendering/RenderLayer.h:
+    * rendering/RenderLayerCompositor.cpp:
+    (WebCore::RenderLayerCompositor::asyncScrollableContainerNodeID):
+    * rendering/RenderLayerCompositor.h:
     
-    Tools:
+    Source/WebKit:
     
-    Add an API test to exercise the scenario of synchronously requesting the autocorrection context immediately
-    after closing the web view, while the web view's content view isn't the first responder.
+    Add InteractionInformationAtPosition.containerScrollingNodeID and initialize it in elementPositionInformation()
+    by asking the scrolling coordinator.
     
-    * TestWebKitAPI/Tests/ios/AutocorrectionTestsIOS.mm:
-    * TestWebKitAPI/ios/UIKitSPI.h:
+    Also add a way to get from a ScrollingNodeID to a UIScrollView to RemoteScrollingCoordinatorProxy,
+    which gets the scrolling node and asks the delegate for the UIView.
     
+    * Shared/ios/InteractionInformationAtPosition.h:
+    * Shared/ios/InteractionInformationAtPosition.mm:
+    (WebKit::InteractionInformationAtPosition::encode const):
+    (WebKit::InteractionInformationAtPosition::decode):
+    * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.h:
+    * UIProcess/RemoteLayerTree/ios/RemoteScrollingCoordinatorProxyIOS.mm:
+    (WebKit::RemoteScrollingCoordinatorProxy::scrollViewForScrollingNodeID const):
+    * UIProcess/RemoteLayerTree/ios/ScrollingTreeOverflowScrollingNodeIOS.h:
+    * UIProcess/RemoteLayerTree/ios/ScrollingTreeOverflowScrollingNodeIOS.mm:
+    (WebKit::ScrollingTreeOverflowScrollingNodeIOS::scrollView const):
+    * UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.h:
+    * WebProcess/WebPage/ios/WebPageIOS.mm:
+    (WebKit::elementPositionInformation):
     
-    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@248039 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@248447 268f45cc-cd09-0410-ab3c-d52691b4dbfc
 
-    2019-07-31  Wenson Hsieh  <[email protected]>
+    2019-08-08  Kocsen Chung  <[email protected]>
 
-            [iOS 13] Safari crashes when closing a tab with a focused element if the unified field has focus
-            https://bugs.webkit.org/show_bug.cgi?id=200291
-            <rdar://problem/53717946>
+            Cherry-pick r248039. rdar://problem/54087592
 
-            Reviewed by Megan Gardner.
+        [iOS 13] Safari crashes when closing a tab with a focused element if the unified field has focus
+        https://bugs.webkit.org/show_bug.cgi?id=200291
+        <rdar://problem/53717946>
 
-            Makes -requestAutocorrectionContextWithCompletionHandler: robust in the case where the web page has been closed,
-            and there is no Connection object to use when waiting for a sync IPC response.
+        Reviewed by Megan Gardner.
 
-            Test: AutocorrectionTests.RequestAutocorrectionContextAfterClosingPage
+        Source/WebKit:
 
-            * UIProcess/ios/WKContentViewInteraction.mm:
-            (-[WKContentView requestAutocorrectionContextWithCompletionHandler:]):
+        Makes -requestAutocorrectionContextWithCompletionHandler: robust in the case where the web page has been closed,
+        and there is no Connection object to use when waiting for a sync IPC response.
 
+        Test: AutocorrectionTests.RequestAutocorrectionContextAfterClosingPage
+
+        * UIProcess/ios/WKContentViewInteraction.mm:
+        (-[WKContentView requestAutocorrectionContextWithCompletionHandler:]):
+
+        Tools:
+
+        Add an API test to exercise the scenario of synchronously requesting the autocorrection context immediately
+        after closing the web view, while the web view's content view isn't the first responder.
+
+        * TestWebKitAPI/Tests/ios/AutocorrectionTestsIOS.mm:
+        * TestWebKitAPI/ios/UIKitSPI.h:
+
+
+        git-svn-id: https://svn.webkit.org/repository/webkit/trunk@248039 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+        2019-07-31  Wenson Hsieh  <[email protected]>
+
+                [iOS 13] Safari crashes when closing a tab with a focused element if the unified field has focus
+                https://bugs.webkit.org/show_bug.cgi?id=200291
+                <rdar://problem/53717946>
+
+                Reviewed by Megan Gardner.
+
+                Makes -requestAutocorrectionContextWithCompletionHandler: robust in the case where the web page has been closed,
+                and there is no Connection object to use when waiting for a sync IPC response.
+
+                Test: AutocorrectionTests.RequestAutocorrectionContextAfterClosingPage
+
+                * UIProcess/ios/WKContentViewInteraction.mm:
+                (-[WKContentView requestAutocorrectionContextWithCompletionHandler:]):
+
 2019-08-08  Kocsen Chung  <[email protected]>
 
         Cherry-pick r248456. rdar://problem/54109878
@@ -310,6 +368,34 @@
             would then destroy them on the main thread when the WebResourceLoadStatisticsStore is destroyed on the
             main thread.
 
+2019-08-08  Simon Fraser  <[email protected]>
+
+        Add to InteractionInformationAtPosition information about whether the element is in a subscrollable region
+        https://bugs.webkit.org/show_bug.cgi?id=200374
+        rdar://problem/54095519
+
+        Reviewed by Tim Horton.
+        
+        Add InteractionInformationAtPosition.containerScrollingNodeID and initialize it in elementPositionInformation()
+        by asking the scrolling coordinator.
+        
+        Also add a way to get from a ScrollingNodeID to a UIScrollView to RemoteScrollingCoordinatorProxy,
+        which gets the scrolling node and asks the delegate for the UIView.
+
+        * Shared/ios/InteractionInformationAtPosition.h:
+        * Shared/ios/InteractionInformationAtPosition.mm:
+        (WebKit::InteractionInformationAtPosition::encode const):
+        (WebKit::InteractionInformationAtPosition::decode):
+        * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.h:
+        * UIProcess/RemoteLayerTree/ios/RemoteScrollingCoordinatorProxyIOS.mm:
+        (WebKit::RemoteScrollingCoordinatorProxy::scrollViewForScrollingNodeID const):
+        * UIProcess/RemoteLayerTree/ios/ScrollingTreeOverflowScrollingNodeIOS.h:
+        * UIProcess/RemoteLayerTree/ios/ScrollingTreeOverflowScrollingNodeIOS.mm:
+        (WebKit::ScrollingTreeOverflowScrollingNodeIOS::scrollView const):
+        * UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.h:
+        * WebProcess/WebPage/ios/WebPageIOS.mm:
+        (WebKit::elementPositionInformation):
+
             * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
             (WebKit::WebResourceLoadStatisticsStore::flushAndDestroyPersistentStore):
 

Modified: branches/safari-608.1-branch/Source/WebKit/Shared/ios/InteractionInformationAtPosition.h (248465 => 248466)


--- branches/safari-608.1-branch/Source/WebKit/Shared/ios/InteractionInformationAtPosition.h	2019-08-09 14:54:33 UTC (rev 248465)
+++ branches/safari-608.1-branch/Source/WebKit/Shared/ios/InteractionInformationAtPosition.h	2019-08-09 15:53:59 UTC (rev 248466)
@@ -31,6 +31,7 @@
 #include "InteractionInformationRequest.h"
 #include "ShareableBitmap.h"
 #include <WebCore/IntPoint.h>
+#include <WebCore/ScrollTypes.h>
 #include <WebCore/SelectionRect.h>
 #include <WebCore/TextIndicator.h>
 #include <wtf/URL.h>
@@ -61,6 +62,7 @@
     bool isAttachment { false };
     bool isAnimatedImage { false };
     bool isElement { false };
+    WebCore::ScrollingNodeID containerScrollingNodeID { 0 };
 #if ENABLE(DATA_DETECTION)
     bool isDataDetectorLink { false };
 #endif

Modified: branches/safari-608.1-branch/Source/WebKit/Shared/ios/InteractionInformationAtPosition.mm (248465 => 248466)


--- branches/safari-608.1-branch/Source/WebKit/Shared/ios/InteractionInformationAtPosition.mm	2019-08-09 14:54:33 UTC (rev 248465)
+++ branches/safari-608.1-branch/Source/WebKit/Shared/ios/InteractionInformationAtPosition.mm	2019-08-09 15:53:59 UTC (rev 248466)
@@ -56,6 +56,7 @@
     encoder << isAttachment;
     encoder << isAnimatedImage;
     encoder << isElement;
+    encoder << containerScrollingNodeID;
     encoder << adjustedPointForNodeRespondingToClickEvents;
     encoder << url;
     encoder << imageURL;
@@ -125,6 +126,9 @@
     if (!decoder.decode(result.isElement))
         return false;
 
+    if (!decoder.decode(result.containerScrollingNodeID))
+        return false;
+
     if (!decoder.decode(result.adjustedPointForNodeRespondingToClickEvents))
         return false;
 

Modified: branches/safari-608.1-branch/Source/WebKit/UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.h (248465 => 248466)


--- branches/safari-608.1-branch/Source/WebKit/UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.h	2019-08-09 14:54:33 UTC (rev 248465)
+++ branches/safari-608.1-branch/Source/WebKit/UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.h	2019-08-09 15:53:59 UTC (rev 248466)
@@ -34,6 +34,8 @@
 #include <wtf/Noncopyable.h>
 #include <wtf/RefPtr.h>
 
+OBJC_CLASS UIScrollView;
+
 namespace WebCore {
 class FloatPoint;
 class PlatformWheelEvent;
@@ -87,6 +89,8 @@
     bool hasScrollableMainFrame() const;
 
 #if PLATFORM(IOS_FAMILY)
+    UIScrollView *scrollViewForScrollingNodeID(WebCore::ScrollingNodeID) const;
+
     WebCore::FloatRect currentLayoutViewport() const;
     void scrollingTreeNodeWillStartPanGesture();
     void scrollingTreeNodeWillStartScroll();

Modified: branches/safari-608.1-branch/Source/WebKit/UIProcess/RemoteLayerTree/ios/RemoteScrollingCoordinatorProxyIOS.mm (248465 => 248466)


--- branches/safari-608.1-branch/Source/WebKit/UIProcess/RemoteLayerTree/ios/RemoteScrollingCoordinatorProxyIOS.mm	2019-08-09 14:54:33 UTC (rev 248465)
+++ branches/safari-608.1-branch/Source/WebKit/UIProcess/RemoteLayerTree/ios/RemoteScrollingCoordinatorProxyIOS.mm	2019-08-09 15:53:59 UTC (rev 248466)
@@ -31,6 +31,7 @@
 
 #import "RemoteLayerTreeHost.h"
 #import "RemoteLayerTreeNode.h"
+#import "ScrollingTreeOverflowScrollingNodeIOS.h"
 #import "WebPageProxy.h"
 #import <UIKit/UIView.h>
 #import <WebCore/ScrollingStateFrameScrollingNode.h>
@@ -52,6 +53,17 @@
 namespace WebKit {
 using namespace WebCore;
 
+UIScrollView *RemoteScrollingCoordinatorProxy::scrollViewForScrollingNodeID(WebCore::ScrollingNodeID nodeID) const
+{
+    auto* treeNode = m_scrollingTree->nodeForID(nodeID);
+    if (!is<ScrollingTreeOverflowScrollingNode>(treeNode))
+        return nil;
+
+    auto* scrollingNode = downcast<ScrollingTreeOverflowScrollingNode>(treeNode);
+    // All ScrollingTreeOverflowScrollingNodes are ScrollingTreeOverflowScrollingNodeIOS on iOS.
+    return static_cast<ScrollingTreeOverflowScrollingNodeIOS*>(scrollingNode)->scrollView();
+}
+
 void RemoteScrollingCoordinatorProxy::connectStateNodeLayers(ScrollingStateTree& stateTree, const RemoteLayerTreeHost& layerTreeHost)
 {
     for (auto& currNode : stateTree.nodeMap().values()) {

Modified: branches/safari-608.1-branch/Source/WebKit/UIProcess/RemoteLayerTree/ios/ScrollingTreeOverflowScrollingNodeIOS.h (248465 => 248466)


--- branches/safari-608.1-branch/Source/WebKit/UIProcess/RemoteLayerTree/ios/ScrollingTreeOverflowScrollingNodeIOS.h	2019-08-09 14:54:33 UTC (rev 248465)
+++ branches/safari-608.1-branch/Source/WebKit/UIProcess/RemoteLayerTree/ios/ScrollingTreeOverflowScrollingNodeIOS.h	2019-08-09 15:53:59 UTC (rev 248466)
@@ -29,6 +29,8 @@
 
 #include <WebCore/ScrollingTreeOverflowScrollingNode.h>
 
+OBJC_CLASS UIScrollView;
+
 namespace WebKit {
 
 class ScrollingTreeScrollingNodeDelegateIOS;
@@ -38,6 +40,8 @@
     static Ref<ScrollingTreeOverflowScrollingNodeIOS> create(WebCore::ScrollingTree&, WebCore::ScrollingNodeID);
     virtual ~ScrollingTreeOverflowScrollingNodeIOS();
 
+    UIScrollView* scrollView() const;
+
 private:
     ScrollingTreeOverflowScrollingNodeIOS(WebCore::ScrollingTree&, WebCore::ScrollingNodeID);
 

Modified: branches/safari-608.1-branch/Source/WebKit/UIProcess/RemoteLayerTree/ios/ScrollingTreeOverflowScrollingNodeIOS.mm (248465 => 248466)


--- branches/safari-608.1-branch/Source/WebKit/UIProcess/RemoteLayerTree/ios/ScrollingTreeOverflowScrollingNodeIOS.mm	2019-08-09 14:54:33 UTC (rev 248465)
+++ branches/safari-608.1-branch/Source/WebKit/UIProcess/RemoteLayerTree/ios/ScrollingTreeOverflowScrollingNodeIOS.mm	2019-08-09 15:53:59 UTC (rev 248466)
@@ -51,6 +51,11 @@
 {
 }
 
+UIScrollView* ScrollingTreeOverflowScrollingNodeIOS::scrollView() const
+{
+    return m_scrollingNodeDelegate->scrollView();
+}
+
 void ScrollingTreeOverflowScrollingNodeIOS::commitStateBeforeChildren(const WebCore::ScrollingStateNode& stateNode)
 {
     if (stateNode.hasChangedProperty(ScrollingStateScrollingNode::ScrollContainerLayer))

Modified: branches/safari-608.1-branch/Source/WebKit/UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.h (248465 => 248466)


--- branches/safari-608.1-branch/Source/WebKit/UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.h	2019-08-09 14:54:33 UTC (rev 248465)
+++ branches/safari-608.1-branch/Source/WebKit/UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.h	2019-08-09 15:53:59 UTC (rev 248466)
@@ -74,10 +74,9 @@
 #endif
 
     UIScrollView *findActingScrollParent(UIScrollView *);
+    UIScrollView *scrollView() const;
 
 private:
-    UIScrollView *scrollView() const;
-
     RetainPtr<CALayer> m_scrollLayer;
     RetainPtr<CALayer> m_scrolledContentsLayer;
     RetainPtr<WKScrollingNodeScrollViewDelegate> m_scrollViewDelegate;

Modified: branches/safari-608.1-branch/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm (248465 => 248466)


--- branches/safari-608.1-branch/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm	2019-08-09 14:54:33 UTC (rev 248465)
+++ branches/safari-608.1-branch/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm	2019-08-09 15:53:59 UTC (rev 248466)
@@ -2710,6 +2710,14 @@
 #endif
     }
 
+    auto* elementForScrollTesting = linkElement ? linkElement : &element;
+    if (auto* renderer = elementForScrollTesting->renderer()) {
+#if ENABLE(ASYNC_SCROLLING)
+        if (auto* scrollingCoordinator = page.scrollingCoordinator())
+            info.containerScrollingNodeID = scrollingCoordinator->scrollableContainerNodeID(*renderer);
+#endif
+    }
+
     if (auto* renderer = element.renderer()) {
         if (renderer->isRenderImage())
             imagePositionInformation(page, element, request, info);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to