Title: [259445] trunk/Source/WebCore
Revision
259445
Author
simon.fra...@apple.com
Date
2020-04-03 00:04:45 -0700 (Fri, 03 Apr 2020)

Log Message

Flesh out enclosingScrollableArea() implementations
https://bugs.webkit.org/show_bug.cgi?id=209953

Reviewed by Timothy Hatcher.

enclosingScrollableArea() is a virtual function on ScrollableArea. It's currently
only called in an unused iOS WebKit1 code path, but will soon be used for scroll
latching, so flesh out implementations.

Will be tested by future scroll latching tests.

* page/FrameView.cpp:
(WebCore::FrameView::enclosingScrollableArea const):
* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::enclosingScrollableArea const):
* rendering/RenderListBox.cpp:
(WebCore::RenderListBox::enclosingScrollableArea const):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (259444 => 259445)


--- trunk/Source/WebCore/ChangeLog	2020-04-03 05:57:17 UTC (rev 259444)
+++ trunk/Source/WebCore/ChangeLog	2020-04-03 07:04:45 UTC (rev 259445)
@@ -1,3 +1,23 @@
+2020-04-03  Simon Fraser  <simon.fra...@apple.com>
+
+        Flesh out enclosingScrollableArea() implementations
+        https://bugs.webkit.org/show_bug.cgi?id=209953
+
+        Reviewed by Timothy Hatcher.
+
+        enclosingScrollableArea() is a virtual function on ScrollableArea. It's currently
+        only called in an unused iOS WebKit1 code path, but will soon be used for scroll
+        latching, so flesh out implementations.
+
+        Will be tested by future scroll latching tests.
+
+        * page/FrameView.cpp:
+        (WebCore::FrameView::enclosingScrollableArea const):
+        * rendering/RenderLayer.cpp:
+        (WebCore::RenderLayer::enclosingScrollableArea const):
+        * rendering/RenderListBox.cpp:
+        (WebCore::RenderListBox::enclosingScrollableArea const):
+
 2020-04-02  Simon Fraser  <simon.fra...@apple.com>
 
         Rename widgetDidHandleWheelEvent back to passWheelEventToWidget and make some functions private

Modified: trunk/Source/WebCore/page/FrameView.cpp (259444 => 259445)


--- trunk/Source/WebCore/page/FrameView.cpp	2020-04-03 05:57:17 UTC (rev 259444)
+++ trunk/Source/WebCore/page/FrameView.cpp	2020-04-03 07:04:45 UTC (rev 259445)
@@ -3800,8 +3800,22 @@
 
 ScrollableArea* FrameView::enclosingScrollableArea() const
 {
-    // FIXME: Walk up the frame tree and look for a scrollable parent frame or RenderLayer.
-    return nullptr;
+    if (frame().isMainFrame())
+        return nullptr;
+
+    auto* ownerElement = frame().ownerElement();
+    if (!ownerElement)
+        return nullptr;
+
+    auto* ownerRenderer = ownerElement->renderer();
+    if (!ownerRenderer)
+        return nullptr;
+
+    auto* layer = ownerRenderer->enclosingLayer();
+    if (!layer)
+        return nullptr;
+
+    return layer->enclosingScrollableLayer(IncludeSelfOrNot::IncludeSelf, CrossFrameBoundaries::No);
 }
 
 IntRect FrameView::scrollableAreaBoundingBox(bool*) const

Modified: trunk/Source/WebCore/rendering/RenderLayer.cpp (259444 => 259445)


--- trunk/Source/WebCore/rendering/RenderLayer.cpp	2020-04-03 05:57:17 UTC (rev 259444)
+++ trunk/Source/WebCore/rendering/RenderLayer.cpp	2020-04-03 07:04:45 UTC (rev 259445)
@@ -3598,12 +3598,10 @@
 
 ScrollableArea* RenderLayer::enclosingScrollableArea() const
 {
-    if (RenderLayer* scrollableLayer = enclosingScrollableLayer(IncludeSelfOrNot::ExcludeSelf, CrossFrameBoundaries::Yes))
+    if (auto* scrollableLayer = enclosingScrollableLayer(IncludeSelfOrNot::ExcludeSelf, CrossFrameBoundaries::No))
         return scrollableLayer;
 
-    // FIXME: We should return the frame view here (or possibly an ancestor frame view,
-    // if the frame view isn't scrollable.
-    return nullptr;
+    return &renderer().view().frameView();
 }
 
 bool RenderLayer::isScrollableOrRubberbandable()

Modified: trunk/Source/WebCore/rendering/RenderListBox.cpp (259444 => 259445)


--- trunk/Source/WebCore/rendering/RenderListBox.cpp	2020-04-03 05:57:17 UTC (rev 259444)
+++ trunk/Source/WebCore/rendering/RenderListBox.cpp	2020-04-03 07:04:45 UTC (rev 259445)
@@ -878,8 +878,11 @@
 
 ScrollableArea* RenderListBox::enclosingScrollableArea() const
 {
-    // FIXME: Return a RenderLayer that's scrollable.
-    return nullptr;
+    auto* layer = enclosingLayer();
+    if (!layer)
+        return nullptr;
+
+    return layer->enclosingScrollableLayer(IncludeSelfOrNot::ExcludeSelf, CrossFrameBoundaries::No);
 }
 
 bool RenderListBox::isScrollableOrRubberbandable()
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to