Title: [271814] trunk/Source
Revision
271814
Author
zimmerm...@webkit.org
Date
2021-01-25 13:37:54 -0800 (Mon, 25 Jan 2021)

Log Message

Finish introduction of RenderLayerScrollableArea: remove remaining glue code from RenderLayer
https://bugs.webkit.org/show_bug.cgi?id=220851

Reviewed by Simon Fraser.

Remove the last remaining glue code from RenderLayer, that was added
in r271559 to minimize the patch size. After this patch all call sites
use RenderLayerScrollableArea directly, removing the need for proxy
methods in RenderLayer that forward to RenderLayerScrollableArea.

The decade old bug 60305 (Separate scrolling code out of RenderLayer)
is finally closed.

Covered by existing tests.

Source/WebCore:
* accessibility/AccessibilityRenderObject.cpp:
(WebCore::AccessibilityRenderObject::scrollTo const):
* editing/FrameSelection.cpp:
(WebCore::FrameSelection::revealSelection):
* html/HTMLMarqueeElement.cpp:
(WebCore::HTMLMarqueeElement::renderMarquee const):
* page/EventHandler.cpp:
(WebCore::EventHandler::selectCursor):
* page/FrameView.cpp:
(WebCore::FrameView::updateLayerPositionsAfterScrolling):
* page/SpatialNavigation.cpp:
(WebCore::scrollInDirection):
* page/ios/FrameIOS.mm:
(WebCore::Frame::overflowScrollPositionChangedForNode):
* page/mac/EventHandlerMac.mm:
(WebCore::scrollableAreaForBox):
* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::isPointInOverflowControl):
(WebCore::RenderBlock::baselinePosition const):
* rendering/RenderBlockFlow.cpp:
(WebCore::RenderBlockFlow::computeIntrinsicLogicalWidths const):
* rendering/RenderBox.cpp:
(WebCore::RenderBox::styleDidChange):
(WebCore::RenderBox::scrollLeft const):
(WebCore::RenderBox::scrollTop const):
(WebCore::setupWheelEventMonitor):
(WebCore::RenderBox::setScrollLeft):
(WebCore::RenderBox::setScrollTop):
(WebCore::RenderBox::setScrollPosition):
(WebCore::RenderBox::verticalScrollbarWidth const):
(WebCore::RenderBox::horizontalScrollbarHeight const):
(WebCore::RenderBox::scrollLayer):
(WebCore::RenderBox::logicalScroll):
(WebCore::RenderBox::panScroll):
(WebCore::RenderBox::scrollPosition const):
(WebCore::RenderBox::computeBackgroundIsKnownToBeObscured):
(WebCore::RenderBox::overflowClipRect const):
* rendering/RenderBoxModelObject.cpp:
(WebCore::RenderBoxModelObject::computeStickyPositionConstraints const):
(WebCore::RenderBoxModelObject::constrainingRectForStickyPosition const):
* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::scrollRectToVisible):
* rendering/RenderLayer.h:
* rendering/RenderLayerBacking.cpp:
(WebCore::computeOverflowTiledBackingCoverage):
(WebCore::RenderLayerBacking::computeParentGraphicsLayerRect const):
(WebCore::RenderLayerBacking::updateGeometry):
(WebCore::RenderLayerBacking::updateScrollOffset):
(WebCore::RenderLayerBacking::updateClippingStackLayerGeometry):
(WebCore::RenderLayerBacking::requiresHorizontalScrollbarLayer const):
(WebCore::RenderLayerBacking::requiresVerticalScrollbarLayer const):
(WebCore::RenderLayerBacking::requiresScrollCornerLayer const):
(WebCore::RenderLayerBacking::positionOverflowControlsLayers):
(WebCore::RenderLayerBacking::setContentsNeedDisplayInRect):
(WebCore::RenderLayerBacking::paintIntoLayer):
(WebCore::RenderLayerBacking::paintContents):
* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::updateScrollingNodeLayers):
(WebCore::RenderLayerCompositor::updateScrollingNodeForScrollingRole):
(WebCore::LegacyWebKitScrollingLayerCoordinator::updateScrollingLayer):
* rendering/RenderLayerModelObject.cpp:
(WebCore::RenderLayerModelObject::styleDidChange):
* rendering/RenderLayerScrollableArea.cpp:
(WebCore::RenderLayerScrollableArea::paintOverflowControls):
(WebCore::RenderLayerScrollableArea::scrollByRecursively):
* rendering/RenderListBox.cpp:
(WebCore::RenderListBox::hasScrollableOrRubberbandableAncestor):
* rendering/RenderMarquee.cpp:
(WebCore::RenderMarquee::start):
(WebCore::RenderMarquee::timerFired):
* rendering/RenderTextControlSingleLine.cpp:
(WebCore::RenderTextControlSingleLine::scroll):
(WebCore::RenderTextControlSingleLine::logicalScroll):
* rendering/RenderTreeAsText.cpp:

Source/WebKitLegacy/mac:
* DOM/DOMHTML.mm:
(-[DOMHTMLElement scrollXOffset]):
(-[DOMHTMLElement scrollYOffset]):
(-[DOMHTMLElement setScrollXOffset:scrollYOffset:adjustForIOSCaret:]):
* WebView/WebFrame.mm:
(-[WebFrame _scrollDOMRangeToVisible:]):
(-[WebFrame _scrollDOMRangeToVisible:withInset:]):

Source/WebKitLegacy/win:
* WebView.cpp:
(WebView::gesture):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (271813 => 271814)


--- trunk/Source/WebCore/ChangeLog	2021-01-25 21:36:49 UTC (rev 271813)
+++ trunk/Source/WebCore/ChangeLog	2021-01-25 21:37:54 UTC (rev 271814)
@@ -1,3 +1,95 @@
+2021-01-22  Nikolas Zimmermann  <nzimmerm...@igalia.com>
+
+        Finish introduction of RenderLayerScrollableArea: remove remaining glue code from RenderLayer
+        https://bugs.webkit.org/show_bug.cgi?id=220851
+
+        Reviewed by Simon Fraser.
+
+        Remove the last remaining glue code from RenderLayer, that was added
+        in r271559 to minimize the patch size. After this patch all call sites
+        use RenderLayerScrollableArea directly, removing the need for proxy
+        methods in RenderLayer that forward to RenderLayerScrollableArea.
+
+        The decade old bug 60305 (Separate scrolling code out of RenderLayer)
+        is finally closed.
+
+        Covered by existing tests.
+
+        * accessibility/AccessibilityRenderObject.cpp:
+        (WebCore::AccessibilityRenderObject::scrollTo const):
+        * editing/FrameSelection.cpp:
+        (WebCore::FrameSelection::revealSelection):
+        * html/HTMLMarqueeElement.cpp:
+        (WebCore::HTMLMarqueeElement::renderMarquee const):
+        * page/EventHandler.cpp:
+        (WebCore::EventHandler::selectCursor):
+        * page/FrameView.cpp:
+        (WebCore::FrameView::updateLayerPositionsAfterScrolling):
+        * page/SpatialNavigation.cpp:
+        (WebCore::scrollInDirection):
+        * page/ios/FrameIOS.mm:
+        (WebCore::Frame::overflowScrollPositionChangedForNode):
+        * page/mac/EventHandlerMac.mm:
+        (WebCore::scrollableAreaForBox):
+        * rendering/RenderBlock.cpp:
+        (WebCore::RenderBlock::isPointInOverflowControl):
+        (WebCore::RenderBlock::baselinePosition const):
+        * rendering/RenderBlockFlow.cpp:
+        (WebCore::RenderBlockFlow::computeIntrinsicLogicalWidths const):
+        * rendering/RenderBox.cpp:
+        (WebCore::RenderBox::styleDidChange):
+        (WebCore::RenderBox::scrollLeft const):
+        (WebCore::RenderBox::scrollTop const):
+        (WebCore::setupWheelEventMonitor):
+        (WebCore::RenderBox::setScrollLeft):
+        (WebCore::RenderBox::setScrollTop):
+        (WebCore::RenderBox::setScrollPosition):
+        (WebCore::RenderBox::verticalScrollbarWidth const):
+        (WebCore::RenderBox::horizontalScrollbarHeight const):
+        (WebCore::RenderBox::scrollLayer):
+        (WebCore::RenderBox::logicalScroll):
+        (WebCore::RenderBox::panScroll):
+        (WebCore::RenderBox::scrollPosition const):
+        (WebCore::RenderBox::computeBackgroundIsKnownToBeObscured):
+        (WebCore::RenderBox::overflowClipRect const):
+        * rendering/RenderBoxModelObject.cpp:
+        (WebCore::RenderBoxModelObject::computeStickyPositionConstraints const):
+        (WebCore::RenderBoxModelObject::constrainingRectForStickyPosition const):
+        * rendering/RenderLayer.cpp:
+        (WebCore::RenderLayer::scrollRectToVisible):
+        * rendering/RenderLayer.h:
+        * rendering/RenderLayerBacking.cpp:
+        (WebCore::computeOverflowTiledBackingCoverage):
+        (WebCore::RenderLayerBacking::computeParentGraphicsLayerRect const):
+        (WebCore::RenderLayerBacking::updateGeometry):
+        (WebCore::RenderLayerBacking::updateScrollOffset):
+        (WebCore::RenderLayerBacking::updateClippingStackLayerGeometry):
+        (WebCore::RenderLayerBacking::requiresHorizontalScrollbarLayer const):
+        (WebCore::RenderLayerBacking::requiresVerticalScrollbarLayer const):
+        (WebCore::RenderLayerBacking::requiresScrollCornerLayer const):
+        (WebCore::RenderLayerBacking::positionOverflowControlsLayers):
+        (WebCore::RenderLayerBacking::setContentsNeedDisplayInRect):
+        (WebCore::RenderLayerBacking::paintIntoLayer):
+        (WebCore::RenderLayerBacking::paintContents):
+        * rendering/RenderLayerCompositor.cpp:
+        (WebCore::RenderLayerCompositor::updateScrollingNodeLayers):
+        (WebCore::RenderLayerCompositor::updateScrollingNodeForScrollingRole):
+        (WebCore::LegacyWebKitScrollingLayerCoordinator::updateScrollingLayer):
+        * rendering/RenderLayerModelObject.cpp:
+        (WebCore::RenderLayerModelObject::styleDidChange):
+        * rendering/RenderLayerScrollableArea.cpp:
+        (WebCore::RenderLayerScrollableArea::paintOverflowControls):
+        (WebCore::RenderLayerScrollableArea::scrollByRecursively):
+        * rendering/RenderListBox.cpp:
+        (WebCore::RenderListBox::hasScrollableOrRubberbandableAncestor):
+        * rendering/RenderMarquee.cpp:
+        (WebCore::RenderMarquee::start):
+        (WebCore::RenderMarquee::timerFired):
+        * rendering/RenderTextControlSingleLine.cpp:
+        (WebCore::RenderTextControlSingleLine::scroll):
+        (WebCore::RenderTextControlSingleLine::logicalScroll):
+        * rendering/RenderTreeAsText.cpp:
+
 2021-01-25  Chris Dumez  <cdu...@apple.com>
 
         Support AbortSignal in addEventListenerOptions to unsubscribe from events

Modified: trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp (271813 => 271814)


--- trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp	2021-01-25 21:36:49 UTC (rev 271813)
+++ trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp	2021-01-25 21:37:54 UTC (rev 271814)
@@ -3924,7 +3924,9 @@
         return;
 
     // FIXME: is point a ScrollOffset or ScrollPosition? Test in RTL overflow.
-    box.layer()->ensureLayerScrollableArea()->scrollToOffset(point);
+    ASSERT(box.layer());
+    ASSERT(box.layer()->scrollableArea());
+    box.layer()->scrollableArea()->scrollToOffset(point);
 }
 
 #if ENABLE(MATHML)

Modified: trunk/Source/WebCore/editing/FrameSelection.cpp (271813 => 271814)


--- trunk/Source/WebCore/editing/FrameSelection.cpp	2021-01-25 21:36:49 UTC (rev 271813)
+++ trunk/Source/WebCore/editing/FrameSelection.cpp	2021-01-25 21:37:54 UTC (rev 271814)
@@ -2382,10 +2382,10 @@
 #if PLATFORM(IOS_FAMILY)
         if (RenderLayer* layer = start.deprecatedNode()->renderer()->enclosingLayer()) {
             if (!m_scrollingSuppressCount) {
-                auto* scrollableLayer = layer->ensureLayerScrollableArea();
-                scrollableLayer->setAdjustForIOSCaretWhenScrolling(true);
+                auto* scrollableArea = layer->ensureLayerScrollableArea();
+                scrollableArea->setAdjustForIOSCaretWhenScrolling(true);
                 layer->scrollRectToVisible(rect, insideFixed, { revealMode, alignment, alignment, ShouldAllowCrossOriginScrolling::Yes });
-                scrollableLayer->setAdjustForIOSCaretWhenScrolling(false);
+                scrollableArea->setAdjustForIOSCaretWhenScrolling(false);
                 updateAppearance();
                 if (m_document->page())
                     m_document->page()->chrome().client().notifyRevealedSelectionByScrollingFrame(*m_document->frame());

Modified: trunk/Source/WebCore/html/HTMLMarqueeElement.cpp (271813 => 271814)


--- trunk/Source/WebCore/html/HTMLMarqueeElement.cpp	2021-01-25 21:36:49 UTC (rev 271813)
+++ trunk/Source/WebCore/html/HTMLMarqueeElement.cpp	2021-01-25 21:37:54 UTC (rev 271814)
@@ -29,6 +29,7 @@
 #include "HTMLNames.h"
 #include "HTMLParserIdioms.h"
 #include "RenderLayer.h"
+#include "RenderLayerScrollableArea.h"
 #include "RenderMarquee.h"
 #include <wtf/IsoMallocInlines.h>
 
@@ -175,7 +176,10 @@
 {
     if (!renderer() || !renderer()->hasLayer())
         return nullptr;
-    return renderBoxModelObject()->layer()->marquee();
+    auto* scrollableArea = renderBoxModelObject()->layer()->scrollableArea();
+    if (!scrollableArea)
+        return nullptr;
+    return scrollableArea->marquee();
 }
 
 } // namespace WebCore

Modified: trunk/Source/WebCore/page/EventHandler.cpp (271813 => 271814)


--- trunk/Source/WebCore/page/EventHandler.cpp	2021-01-25 21:36:49 UTC (rev 271813)
+++ trunk/Source/WebCore/page/EventHandler.cpp	2021-01-25 21:37:54 UTC (rev 271814)
@@ -1493,11 +1493,10 @@
         bool inResizer = false;
         if (renderer && renderer->hasLayer()) {
             // FIXME: With right-aligned text in a box, the renderer here is usually a RenderText, which prevents showing the resize cursor: webkit.org/b/210935.
-            if (auto* layer = downcast<RenderLayerModelObject>(*renderer).layer()) {
-                inResizer = layer->isPointInResizeControl(roundedIntPoint(result.localPoint()));
-                if (inResizer)
-                    return layer->shouldPlaceBlockDirectionScrollbarOnLeft() ? southWestResizeCursor() : southEastResizeCursor();
-            }
+            auto& layerRenderer = downcast<RenderLayerModelObject>(*renderer);
+            inResizer = layerRenderer.layer()->isPointInResizeControl(roundedIntPoint(result.localPoint()));
+            if (inResizer)
+                return layerRenderer.shouldPlaceBlockDirectionScrollbarOnLeft() ? southWestResizeCursor() : southEastResizeCursor();
         }
 
         if ((editable || (renderer && renderer->isText() && node->canStartSelection())) && !inResizer && !result.scrollbar())

Modified: trunk/Source/WebCore/page/FrameView.cpp (271813 => 271814)


--- trunk/Source/WebCore/page/FrameView.cpp	2021-01-25 21:36:49 UTC (rev 271813)
+++ trunk/Source/WebCore/page/FrameView.cpp	2021-01-25 21:37:54 UTC (rev 271814)
@@ -2597,7 +2597,8 @@
     if (!layoutContext().isLayoutNested() && hasViewportConstrainedObjects()) {
         if (RenderView* renderView = this->renderView()) {
             updateWidgetPositions();
-            renderView->layer()->updateLayerPositionsAfterDocumentScroll();
+            if (auto* scrollableArea = renderView->layer()->scrollableArea())
+                scrollableArea->updateLayerPositionsAfterDocumentScroll();
         }
     }
 }

Modified: trunk/Source/WebCore/page/SpatialNavigation.cpp (271813 => 271814)


--- trunk/Source/WebCore/page/SpatialNavigation.cpp	2021-01-25 21:36:49 UTC (rev 271813)
+++ trunk/Source/WebCore/page/SpatialNavigation.cpp	2021-01-25 21:37:54 UTC (rev 271814)
@@ -395,8 +395,8 @@
             return false;
         }
 
-        if (auto* scrollableLayer = container->renderBox()->enclosingLayer()->scrollableArea())
-            scrollableLayer->scrollByRecursively(IntSize(dx, dy));
+        if (auto* scrollableArea = container->renderBox()->enclosingLayer()->scrollableArea())
+            scrollableArea->scrollByRecursively(IntSize(dx, dy));
         return true;
     }
 

Modified: trunk/Source/WebCore/page/ios/FrameIOS.mm (271813 => 271814)


--- trunk/Source/WebCore/page/ios/FrameIOS.mm	2021-01-25 21:36:49 UTC (rev 271813)
+++ trunk/Source/WebCore/page/ios/FrameIOS.mm	2021-01-25 21:37:54 UTC (rev 271814)
@@ -823,14 +823,14 @@
     auto* layer = downcast<RenderBoxModelObject>(*renderer).layer();
     if (!layer)
         return;
-    auto* scrollableLayer = layer->ensureLayerScrollableArea();
+    auto* scrollableArea = layer->ensureLayerScrollableArea();
 
-    auto oldScrollType = scrollableLayer->currentScrollType();
-    scrollableLayer->setCurrentScrollType(isUserScroll ? ScrollType::User : ScrollType::Programmatic);
-    scrollableLayer->scrollToOffsetWithoutAnimation(position);
-    scrollableLayer->setCurrentScrollType(oldScrollType);
+    auto oldScrollType = scrollableArea->currentScrollType();
+    scrollableArea->setCurrentScrollType(isUserScroll ? ScrollType::User : ScrollType::Programmatic);
+    scrollableArea->scrollToOffsetWithoutAnimation(position);
+    scrollableArea->setCurrentScrollType(oldScrollType);
 
-    scrollableLayer->didEndScroll(); // FIXME: Should we always call this?
+    scrollableArea->didEndScroll(); // FIXME: Should we always call this?
 }
 
 void Frame::resetAllGeolocationPermission()

Modified: trunk/Source/WebCore/page/mac/EventHandlerMac.mm (271813 => 271814)


--- trunk/Source/WebCore/page/mac/EventHandlerMac.mm	2021-01-25 21:36:49 UTC (rev 271813)
+++ trunk/Source/WebCore/page/mac/EventHandlerMac.mm	2021-01-25 21:37:54 UTC (rev 271814)
@@ -792,10 +792,8 @@
     if (is<RenderListBox>(box))
         return downcast<RenderListBox>(&box);
 
-    if (box.layer()) {
-        if (auto* scrollableLayer = box.layer()->scrollableArea())
-            return scrollableLayer;
-    }
+    if (auto* scrollableArea = box.layer() ? box.layer()->scrollableArea() : nullptr)
+        return scrollableArea;
 
     return nullptr;
 }

Modified: trunk/Source/WebCore/rendering/RenderBlock.cpp (271813 => 271814)


--- trunk/Source/WebCore/rendering/RenderBlock.cpp	2021-01-25 21:36:49 UTC (rev 271813)
+++ trunk/Source/WebCore/rendering/RenderBlock.cpp	2021-01-25 21:37:54 UTC (rev 271814)
@@ -2006,8 +2006,8 @@
 {
     if (!scrollsOverflow())
         return false;
-    if (auto* scrollableLayer = layer() ? layer()->scrollableArea() : nullptr)
-        return scrollableLayer->hitTestOverflowControls(result, roundedIntPoint(locationInContainer - toLayoutSize(accumulatedOffset)));
+    if (auto* scrollableArea = layer() ? layer()->scrollableArea() : nullptr)
+        return scrollableArea->hitTestOverflowControls(result, roundedIntPoint(locationInContainer - toLayoutSize(accumulatedOffset)));
     return false;
 }
 
@@ -2510,16 +2510,16 @@
             if (isWritingModeRoot() && !isRubyRun())
                 return true;
 
-            auto* scrollableLayer = layer() ? layer()->scrollableArea() : nullptr;
-            if (!scrollableLayer)
+            auto* scrollableArea = layer() ? layer()->scrollableArea() : nullptr;
+            if (!scrollableArea)
                 return false;
 
-            if (scrollableLayer->marquee())
+            if (scrollableArea->marquee())
                 return true;
 
             if (direction == HorizontalLine)
-                return scrollableLayer->verticalScrollbar() || scrollableLayer->scrollOffset().y();
-            return scrollableLayer->horizontalScrollbar() || scrollableLayer->scrollOffset().x();
+                return scrollableArea->verticalScrollbar() || scrollableArea->scrollOffset().y();
+            return scrollableArea->horizontalScrollbar() || scrollableArea->scrollOffset().x();
         };
 
         Optional<int> baselinePos = ignoreBaseline() ? Optional<int>() : inlineBlockBaseline(direction);

Modified: trunk/Source/WebCore/rendering/RenderBlockFlow.cpp (271813 => 271814)


--- trunk/Source/WebCore/rendering/RenderBlockFlow.cpp	2021-01-25 21:36:49 UTC (rev 271813)
+++ trunk/Source/WebCore/rendering/RenderBlockFlow.cpp	2021-01-25 21:37:54 UTC (rev 271814)
@@ -349,7 +349,8 @@
 
     if (!style().autoWrap() && childrenInline()) {
         // A horizontal marquee with inline children has no minimum width.
-        if (layer() && layer()->marquee() && layer()->marquee()->isHorizontal())
+        auto* scrollableArea = layer() ? layer()->scrollableArea() : nullptr;
+        if (scrollableArea && scrollableArea->marquee() && scrollableArea->marquee()->isHorizontal())
             minLogicalWidth = 0;
     }
 

Modified: trunk/Source/WebCore/rendering/RenderBox.cpp (271813 => 271814)


--- trunk/Source/WebCore/rendering/RenderBox.cpp	2021-01-25 21:36:49 UTC (rev 271813)
+++ trunk/Source/WebCore/rendering/RenderBox.cpp	2021-01-25 21:37:54 UTC (rev 271814)
@@ -320,10 +320,12 @@
     // If our zoom factor changes and we have a defined scrollLeft/Top, we need to adjust that value into the
     // new zoomed coordinate space.
     if (hasOverflowClip() && layer() && oldStyle && oldStyle->effectiveZoom() != newStyle.effectiveZoom()) {
-        ScrollPosition scrollPosition = layer()->scrollPosition();
-        float zoomScaleFactor = newStyle.effectiveZoom() / oldStyle->effectiveZoom();
-        scrollPosition.scale(zoomScaleFactor);
-        layer()->setPostLayoutScrollPosition(scrollPosition);
+        if (auto* scrollableArea = layer()->scrollableArea()) {
+            ScrollPosition scrollPosition = scrollableArea->scrollPosition();
+            float zoomScaleFactor = newStyle.effectiveZoom() / oldStyle->effectiveZoom();
+            scrollPosition.scale(zoomScaleFactor);
+            scrollableArea->setPostLayoutScrollPosition(scrollPosition);
+        }
     }
 
     // Our opaqueness might have changed without triggering layout.
@@ -572,12 +574,14 @@
 
 int RenderBox::scrollLeft() const
 {
-    return hasOverflowClip() && layer() ? layer()->scrollPosition().x() : 0;
+    auto* scrollableArea = layer() ? layer()->scrollableArea() : nullptr;
+    return (hasOverflowClip() && scrollableArea) ? scrollableArea->scrollPosition().x() : 0;
 }
 
 int RenderBox::scrollTop() const
 {
-    return hasOverflowClip() && layer() ? layer()->scrollPosition().y() : 0;
+    auto* scrollableArea = layer() ? layer()->scrollableArea() : nullptr;
+    return (hasOverflowClip() && scrollableArea) ? scrollableArea->scrollPosition().y() : 0;
 }
 
 void RenderBox::resetLogicalHeightBeforeLayoutIfNeeded()
@@ -586,14 +590,12 @@
         setLogicalHeight(0_lu);
 }
 
-static void setupWheelEventMonitor(RenderLayer& layer)
+static void setupWheelEventMonitor(RenderLayerScrollableArea& scrollableArea)
 {
-    Page& page = layer.renderer().page();
+    Page& page = scrollableArea.layer().renderer().page();
     if (!page.isMonitoringWheelEvents())
         return;
-    auto* scrollableLayer = layer.scrollableArea();
-    ASSERT(scrollableLayer);
-    scrollableLayer->scrollAnimator().setWheelEventTestMonitor(page.wheelEventTestMonitor());
+    scrollableArea.scrollAnimator().setWheelEventTestMonitor(page.wheelEventTestMonitor());
 }
 
 void RenderBox::setScrollLeft(int newLeft, const ScrollPositionChangeOptions& options)
@@ -600,8 +602,10 @@
 {
     if (!hasOverflowClip() || !layer())
         return;
-    setupWheelEventMonitor(*layer());
-    layer()->ensureLayerScrollableArea()->scrollToXPosition(newLeft, options);
+    auto* scrollableArea = layer()->scrollableArea();
+    ASSERT(scrollableArea);
+    setupWheelEventMonitor(*scrollableArea);
+    scrollableArea->scrollToXPosition(newLeft, options);
 }
 
 void RenderBox::setScrollTop(int newTop, const ScrollPositionChangeOptions& options)
@@ -608,8 +612,10 @@
 {
     if (!hasOverflowClip() || !layer())
         return;
-    setupWheelEventMonitor(*layer());
-    layer()->ensureLayerScrollableArea()->scrollToYPosition(newTop, options);
+    auto* scrollableArea = layer()->scrollableArea();
+    ASSERT(scrollableArea);
+    setupWheelEventMonitor(*scrollableArea);
+    scrollableArea->scrollToYPosition(newTop, options);
 }
 
 void RenderBox::setScrollPosition(const ScrollPosition& position, const ScrollPositionChangeOptions& options)
@@ -616,8 +622,10 @@
 {
     if (!hasOverflowClip() || !layer())
         return;
-    setupWheelEventMonitor(*layer());
-    layer()->ensureLayerScrollableArea()->setScrollPosition(position, options);
+    auto* scrollableArea = layer()->scrollableArea();
+    ASSERT(scrollableArea);
+    setupWheelEventMonitor(*scrollableArea);
+    scrollableArea->setScrollPosition(position, options);
 }
 
 void RenderBox::absoluteRects(Vector<IntRect>& rects, const LayoutPoint& accumulatedOffset) const
@@ -835,12 +843,18 @@
 
 int RenderBox::verticalScrollbarWidth() const
 {
-    return includeVerticalScrollbarSize() ? layer()->verticalScrollbarWidth() : 0;
+    auto* scrollableArea = layer() ? layer()->scrollableArea() : nullptr;
+    if (!scrollableArea)
+        return 0;
+    return includeVerticalScrollbarSize() ? scrollableArea->verticalScrollbarWidth() : 0;
 }
 
 int RenderBox::horizontalScrollbarHeight() const
 {
-    return includeHorizontalScrollbarSize() ? layer()->horizontalScrollbarHeight() : 0;
+    auto* scrollableArea = layer() ? layer()->scrollableArea() : nullptr;
+    if (!scrollableArea)
+        return 0;
+    return includeHorizontalScrollbarSize() ? scrollableArea->horizontalScrollbarHeight() : 0;
 }
 
 int RenderBox::intrinsicScrollbarLogicalWidth() const
@@ -863,8 +877,8 @@
 
 bool RenderBox::scrollLayer(ScrollDirection direction, ScrollGranularity granularity, float multiplier, Element** stopElement)
 {
-    RenderLayer* boxLayer = layer();
-    if (boxLayer && boxLayer->scroll(direction, granularity, multiplier)) {
+    auto* scrollableArea = layer() ? layer()->scrollableArea() : nullptr;
+    if (scrollableArea && scrollableArea->scroll(direction, granularity, multiplier)) {
         if (stopElement)
             *stopElement = element();
 
@@ -894,14 +908,13 @@
 {
     bool scrolled = false;
     
-    RenderLayer* l = layer();
-    if (l) {
+    if (auto* scrollableArea = layer() ? layer()->scrollableArea() : nullptr) {
 #if PLATFORM(COCOA)
         // On Mac only we reset the inline direction position when doing a document scroll (e.g., hitting Home/End).
         if (granularity == ScrollByDocument)
-            scrolled = l->scroll(logicalToPhysical(ScrollInlineDirectionBackward, isHorizontalWritingMode(), style().isFlippedBlocksWritingMode()), ScrollByDocument, multiplier);
+            scrolled = scrollableArea->scroll(logicalToPhysical(ScrollInlineDirectionBackward, isHorizontalWritingMode(), style().isFlippedBlocksWritingMode()), ScrollByDocument, multiplier);
 #endif
-        if (l->scroll(logicalToPhysical(direction, isHorizontalWritingMode(), style().isFlippedBlocksWritingMode()), granularity, multiplier))
+        if (scrollableArea->scroll(logicalToPhysical(direction, isHorizontalWritingMode(), style().isFlippedBlocksWritingMode()), granularity, multiplier))
             scrolled = true;
         
         if (scrolled) {
@@ -1027,8 +1040,8 @@
 
 void RenderBox::panScroll(const IntPoint& source)
 {
-    if (layer())
-        layer()->panScrollFromPoint(source);
+    if (auto* scrollableArea = layer() ? layer()->scrollableArea() : nullptr)
+        scrollableArea->panScrollFromPoint(source);
 }
 
 bool RenderBox::canUseOverlayScrollbars() const
@@ -1057,7 +1070,11 @@
         return { 0, 0 };
 
     ASSERT(hasLayer());
-    return layer()->scrollPosition();
+    auto* scrollableArea = layer()->scrollableArea();
+    if (!scrollableArea)
+        return { 0, 0 };
+
+    return scrollableArea->scrollPosition();
 }
 
 LayoutSize RenderBox::cachedSizeForOverflowClip() const
@@ -1621,9 +1638,10 @@
     if (!getBackgroundPaintedExtent(paintOffset, backgroundRect))
         return false;
 
-    if (hasLayer() && layer()->scrollingMayRevealBackground())
-        return false;
-
+    if (auto* scrollableArea = layer() ? layer()->scrollableArea() : nullptr) {
+        if (scrollableArea->scrollingMayRevealBackground())
+            return false;
+    }
     return foregroundIsKnownToBeOpaqueInRect(backgroundRect, backgroundObscurationTestMaxDepth);
 }
 
@@ -1940,10 +1958,10 @@
     clipRect.setSize(clipRect.size() - LayoutSize(borderLeft() + borderRight(), borderTop() + borderBottom()));
 
     // Subtract out scrollbars if we have them.
-    if (layer()) {
+    if (auto* scrollableArea = layer() ? layer()->scrollableArea() : nullptr) {
         if (shouldPlaceBlockDirectionScrollbarOnLeft())
-            clipRect.move(layer()->verticalScrollbarWidth(relevancy), 0);
-        clipRect.contract(layer()->verticalScrollbarWidth(relevancy), layer()->horizontalScrollbarHeight(relevancy));
+            clipRect.move(scrollableArea->verticalScrollbarWidth(relevancy), 0);
+        clipRect.contract(scrollableArea->verticalScrollbarWidth(relevancy), scrollableArea->horizontalScrollbarHeight(relevancy));
     }
 
     return clipRect;

Modified: trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp (271813 => 271814)


--- trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp	2021-01-25 21:36:49 UTC (rev 271813)
+++ trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp	2021-01-25 21:37:54 UTC (rev 271814)
@@ -51,6 +51,7 @@
 #include "RenderLayer.h"
 #include "RenderLayerBacking.h"
 #include "RenderLayerCompositor.h"
+#include "RenderLayerScrollableArea.h"
 #include "RenderMultiColumnFlow.h"
 #include "RenderTable.h"
 #include "RenderTableRow.h"
@@ -489,8 +490,10 @@
         FloatPoint containerLocationRelativeToScrollingAncestor = containerRectRelativeToScrollingAncestor.location() -
             FloatSize(enclosingClippingBox.borderLeft() + enclosingClippingBox.paddingLeft(),
             enclosingClippingBox.borderTop() + enclosingClippingBox.paddingTop());
-        if (&enclosingClippingBox != containingBlock)
-            containerLocationRelativeToScrollingAncestor += enclosingClippingLayer->scrollOffset();
+        if (&enclosingClippingBox != containingBlock) {
+            if (auto* scrollableArea = enclosingClippingLayer->scrollableArea())
+                containerLocationRelativeToScrollingAncestor += scrollableArea->scrollOffset();
+        }
         containerRectRelativeToScrollingAncestor.setLocation(containerLocationRelativeToScrollingAncestor);
     }
     constraints.setContainingBlockRect(containerRectRelativeToScrollingAncestor);
@@ -507,8 +510,10 @@
     if (enclosingClippingLayer) {
         stickyLocationRelativeToScrollingAncestor -= FloatSize(enclosingClippingBox.borderLeft() + enclosingClippingBox.paddingLeft(),
             enclosingClippingBox.borderTop() + enclosingClippingBox.paddingTop());
-        if (&enclosingClippingBox != containingBlock)
-            stickyLocationRelativeToScrollingAncestor += enclosingClippingLayer->scrollOffset();
+        if (&enclosingClippingBox != containingBlock) {
+            if (auto* scrollableArea = enclosingClippingLayer->scrollableArea())
+                stickyLocationRelativeToScrollingAncestor += scrollableArea->scrollOffset();
+        }
     }
     // FIXME: For now, assume that |this| is not transformed.
     stickyBoxRelativeToScrollingAnecstor.setLocation(stickyLocationRelativeToScrollingAncestor);
@@ -547,11 +552,14 @@
 
         FloatRect constrainingRect = enclosingClippingBox.localToContainerQuad(FloatRect(clipRect), &view()).boundingBox();
 
-        FloatPoint scrollOffset = FloatPoint() + enclosingClippingLayer->scrollOffset();
+        auto* scrollableArea = enclosingClippingLayer->scrollableArea();
+        FloatPoint scrollOffset;
+        if (scrollableArea)
+            scrollOffset = FloatPoint() + scrollableArea->scrollOffset();
 
         float scrollbarOffset = 0;
-        if (enclosingClippingBox.hasLayer() && enclosingClippingBox.shouldPlaceBlockDirectionScrollbarOnLeft())
-            scrollbarOffset = enclosingClippingBox.layer()->verticalScrollbarWidth(IgnoreOverlayScrollbarSize);
+        if (enclosingClippingBox.hasLayer() && enclosingClippingBox.shouldPlaceBlockDirectionScrollbarOnLeft() && scrollableArea)
+            scrollbarOffset = scrollableArea->verticalScrollbarWidth(IgnoreOverlayScrollbarSize);
 
         constrainingRect.setLocation(FloatPoint(scrollOffset.x() + scrollbarOffset, scrollOffset.y()));
         return constrainingRect;

Modified: trunk/Source/WebCore/rendering/RenderLayer.cpp (271813 => 271814)


--- trunk/Source/WebCore/rendering/RenderLayer.cpp	2021-01-25 21:36:49 UTC (rev 271813)
+++ trunk/Source/WebCore/rendering/RenderLayer.cpp	2021-01-25 21:37:54 UTC (rev 271814)
@@ -376,94 +376,6 @@
     RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(renderer().renderTreeBeingDestroyed() || !firstChild());
 }
 
-// Start of temporary glue code to help landing webkit.org/b/60305 (split RenderLayer into RenderLayer/RenderLayerScrollableArea)
-ScrollOffset RenderLayer::scrollOffset() const
-{
-    if (m_scrollableArea)
-        return m_scrollableArea->scrollOffset();
-    return { 0, 0 };
-}
-
-bool RenderLayer::shouldPlaceBlockDirectionScrollbarOnLeft() const
-{
-    return renderer().shouldPlaceBlockDirectionScrollbarOnLeft();
-}
-
-RenderMarquee* RenderLayer::marquee() const
-{
-    if (m_scrollableArea)
-        return m_scrollableArea->marquee();
-    return nullptr;
-}
-
-void RenderLayer::updateLayerPositionsAfterDocumentScroll()
-{
-    if (m_scrollableArea)
-        m_scrollableArea->updateLayerPositionsAfterDocumentScroll();
-}
-
-void RenderLayer::setPostLayoutScrollPosition(Optional<ScrollPosition> position)
-{
-    if (m_scrollableArea)
-        m_scrollableArea->setPostLayoutScrollPosition(position);
-}
-
-void RenderLayer::panScrollFromPoint(const IntPoint& point)
-{
-    if (m_scrollableArea)
-        m_scrollableArea->panScrollFromPoint(point);
-}
-
-ScrollPosition RenderLayer::scrollPosition() const
-{
-    if (m_scrollableArea)
-        return m_scrollableArea->scrollPosition();
-    return ScrollPosition();
-}
-
-bool RenderLayer::scrollingMayRevealBackground() const
-{
-    if (m_scrollableArea)
-        return m_scrollableArea->scrollingMayRevealBackground();
-    return false;
-}
-
-bool RenderLayer::hasScrollableHorizontalOverflow() const
-{
-    if (m_scrollableArea)
-        return m_scrollableArea->hasScrollableHorizontalOverflow();
-    return false;
-}
-
-bool RenderLayer::hasScrollableVerticalOverflow() const
-{
-    if (m_scrollableArea)
-        return m_scrollableArea->hasScrollableVerticalOverflow();
-    return false;
-}
-
-int RenderLayer::verticalScrollbarWidth(OverlayScrollbarSizeRelevancy relevancy) const
-{
-    if (m_scrollableArea)
-        return m_scrollableArea->verticalScrollbarWidth(relevancy);
-    return 0;
-}
-
-int RenderLayer::horizontalScrollbarHeight(OverlayScrollbarSizeRelevancy relevancy) const
-{
-    if (m_scrollableArea)
-        return m_scrollableArea->horizontalScrollbarHeight(relevancy);
-    return 0;
-}
-
-bool RenderLayer::scroll(ScrollDirection direction, ScrollGranularity granularity, float multiplier)
-{
-    if (m_scrollableArea)
-        return m_scrollableArea->scroll(direction, granularity, multiplier);
-    return false;
-}
-// End of temporary glue code
-
 void RenderLayer::addChild(RenderLayer& child, RenderLayer* beforeChild)
 {
     RenderLayer* prevSibling = beforeChild ? beforeChild->previousSibling() : lastChild();
@@ -2480,7 +2392,7 @@
     };
 
     if (allowsCurrentScroll()) {
-        auto* scrollableLayer = ensureLayerScrollableArea();
+        auto* scrollableArea = ensureLayerScrollableArea();
 
         // Don't scroll to reveal an overflow layer that is restricted by the -webkit-line-clamp property.
         // This will prevent us from revealing text hidden by the slider in Safari RSS.
@@ -2495,13 +2407,13 @@
         if (box->shouldPlaceBlockDirectionScrollbarOnLeft()) {
             // For direction: rtl; writing-mode: horizontal-tb box, the scroll bar is on the left side. The visible rect
             // starts from the right side of scroll bar. So the x of localExposeRect should start from the same position too.
-            localExposeRect.moveBy(LayoutPoint(-scrollableLayer->verticalScrollbarWidth(), 0));
+            localExposeRect.moveBy(LayoutPoint(-scrollableArea->verticalScrollbarWidth(), 0));
         }
         LayoutRect layerBounds(0_lu, 0_lu, box->clientWidth(), box->clientHeight());
         expandScrollRectToVisibleTargetRectToIncludeScrollPadding(box, layerBounds, localExposeRect);
         LayoutRect revealRect = getRectToExpose(layerBounds, localExposeRect, insideFixed, options.alignX, options.alignY);
 
-        if (auto result = scrollableLayer->updateScrollPosition(scrollPositionChangeOptionsForElement(box->element()), revealRect, localExposeRect))
+        if (auto result = scrollableArea->updateScrollPosition(scrollPositionChangeOptionsForElement(box->element()), revealRect, localExposeRect))
             newRect = result.value();
     } else if (!parentLayer) {
         HTMLFrameOwnerElement* ownerElement = renderer().document().ownerElement();

Modified: trunk/Source/WebCore/rendering/RenderLayer.h (271813 => 271814)


--- trunk/Source/WebCore/rendering/RenderLayer.h	2021-01-25 21:36:49 UTC (rev 271813)
+++ trunk/Source/WebCore/rendering/RenderLayer.h	2021-01-25 21:37:54 UTC (rev 271814)
@@ -159,22 +159,6 @@
     WEBCORE_EXPORT RenderLayerScrollableArea* scrollableArea() const;
     WEBCORE_EXPORT RenderLayerScrollableArea* ensureLayerScrollableArea();
 
-    // Start of temporary glue code to help landing webkit.org/b/60305 (split RenderLayer into RenderLayer/RenderLayerScrollableArea)
-    WEBCORE_EXPORT ScrollOffset scrollOffset() const;
-    bool shouldPlaceBlockDirectionScrollbarOnLeft() const;
-    RenderMarquee* marquee() const;
-    void updateLayerPositionsAfterDocumentScroll();
-    void setPostLayoutScrollPosition(Optional<ScrollPosition>);
-    void panScrollFromPoint(const IntPoint&);
-    ScrollPosition scrollPosition() const;
-    bool scrollingMayRevealBackground() const;
-    bool hasScrollableHorizontalOverflow() const;
-    bool hasScrollableVerticalOverflow() const;
-    int verticalScrollbarWidth(OverlayScrollbarSizeRelevancy = IgnoreOverlayScrollbarSize) const;
-    int horizontalScrollbarHeight(OverlayScrollbarSizeRelevancy = IgnoreOverlayScrollbarSize) const;
-    bool scroll(ScrollDirection, ScrollGranularity, float multiplier = 1);
-    // End of temporary glue code
-
 #if PLATFORM(IOS_FAMILY)
     // Called before the renderer's widget (if any) has been nulled out.
     void willBeDestroyed();

Modified: trunk/Source/WebCore/rendering/RenderLayerBacking.cpp (271813 => 271814)


--- trunk/Source/WebCore/rendering/RenderLayerBacking.cpp	2021-01-25 21:36:49 UTC (rev 271813)
+++ trunk/Source/WebCore/rendering/RenderLayerBacking.cpp	2021-01-25 21:37:54 UTC (rev 271814)
@@ -419,11 +419,13 @@
     TiledBacking::TileCoverage tileCoverage = TiledBacking::CoverageForVisibleArea;
     bool useMinimalTilesDuringLiveResize = frameView.inLiveResize();
     if (!useMinimalTilesDuringLiveResize) {
-        if (layer.hasScrollableHorizontalOverflow())
-            tileCoverage |= TiledBacking::CoverageForHorizontalScrolling;
+        if (auto* scrollableArea = layer.scrollableArea()) {
+            if (scrollableArea->hasScrollableHorizontalOverflow())
+                tileCoverage |= TiledBacking::CoverageForHorizontalScrolling;
 
-        if (layer.hasScrollableVerticalOverflow())
-            tileCoverage |= TiledBacking::CoverageForVerticalScrolling;
+            if (scrollableArea->hasScrollableVerticalOverflow())
+                tileCoverage |= TiledBacking::CoverageForVerticalScrolling;
+        }
     }
     return tileCoverage;
 }
@@ -1229,9 +1231,12 @@
     }
 
     if (compositedAncestor->hasCompositedScrollableOverflow()) {
+        auto* scrollableArea = compositedAncestor->scrollableArea();
+        ASSERT(scrollableArea);
+
         LayoutRect ancestorCompositedBounds = ancestorBacking->compositedBounds();
         LayoutRect scrollContainerBox = scrollContainerLayerBox(ancestorRenderBox);
-        ScrollOffset scrollOffset = compositedAncestor->scrollOffset();
+        ScrollOffset scrollOffset = scrollableArea->scrollOffset();
         parentGraphicsLayerRect = LayoutRect((scrollContainerBox.location() - toLayoutSize(ancestorCompositedBounds.location()) - toLayoutSize(scrollOffset)), scrollContainerBox.size());
     }
 
@@ -1368,7 +1373,10 @@
         m_scrollContainerLayer->setPosition(FloatPoint(scrollContainerBox.location() - parentLayerBounds.location()));
         m_scrollContainerLayer->setSize(roundedIntSize(LayoutSize(scrollContainerBox.width(), scrollContainerBox.height())));
 
-        ScrollOffset scrollOffset = m_owningLayer.scrollOffset();
+        auto* scrollableArea = m_owningLayer.scrollableArea();
+        ASSERT(scrollableArea);
+
+        ScrollOffset scrollOffset = scrollableArea->scrollOffset();
         updateScrollOffset(scrollOffset);
 
         FloatSize oldScrollingLayerOffset = m_scrollContainerLayer->offsetFromRenderer();
@@ -1382,7 +1390,9 @@
 
         bool paddingBoxOffsetChanged = oldScrollingLayerOffset != m_scrollContainerLayer->offsetFromRenderer();
 
-        IntSize scrollSize(m_owningLayer.scrollWidth(), m_owningLayer.scrollHeight());
+        IntSize scrollSize;
+        if (scrollableArea)
+            scrollSize = IntSize(scrollableArea->scrollWidth(), scrollableArea->scrollHeight());
         if (scrollSize != m_scrolledContentsLayer->size() || paddingBoxOffsetChanged)
             m_scrolledContentsLayer->setNeedsDisplay();
 
@@ -1491,17 +1501,17 @@
 
 void RenderLayerBacking::updateScrollOffset(ScrollOffset scrollOffset)
 {
-    auto* scrollableLayer = m_owningLayer.scrollableArea();
-    ASSERT(scrollableLayer);
+    auto* scrollableArea = m_owningLayer.scrollableArea();
+    ASSERT(scrollableArea);
 
-    if (scrollableLayer->currentScrollType() == ScrollType::User) {
+    if (scrollableArea->currentScrollType() == ScrollType::User) {
         // If scrolling is happening externally, we don't want to touch the layer bounds origin here because that will cause jitter.
         setLocationOfScrolledContents(scrollOffset, ScrollingLayerPositionAction::Sync);
-        scrollableLayer->setRequiresScrollPositionReconciliation(true);
+        scrollableArea->setRequiresScrollPositionReconciliation(true);
     } else {
         // Note that we implement the contents offset via the bounds origin on this layer, rather than a position on the sublayer.
         setLocationOfScrolledContents(scrollOffset, ScrollingLayerPositionAction::Set);
-        scrollableLayer->setRequiresScrollPositionReconciliation(false);
+        scrollableArea->setRequiresScrollPositionReconciliation(false);
     }
 
     ASSERT(m_scrolledContentsLayer->position().isZero());
@@ -1913,7 +1923,9 @@
         entry.clippingLayer->setSize(snappedClippingLayerRect.size());
 
         if (entry.clipData.isOverflowScroll) {
-            ScrollOffset scrollOffset = entry.clipData.clippingLayer ? entry.clipData.clippingLayer->scrollOffset() : ScrollOffset();
+            ScrollOffset scrollOffset;
+            if (auto* scrollableArea = entry.clipData.clippingLayer ? entry.clipData.clippingLayer->scrollableArea() : nullptr)
+                scrollOffset = scrollableArea->scrollOffset();
 
             entry.clippingLayer->setBoundsOrigin(scrollOffset);
             lastClipLayerRect.moveBy(-scrollOffset);
@@ -2015,16 +2027,15 @@
 
 bool RenderLayerBacking::requiresHorizontalScrollbarLayer() const
 {
-    if (auto* scrollableLayer = m_owningLayer.scrollableArea())
-        return requiresLayerForScrollbar(scrollableLayer->horizontalScrollbar());
+    if (auto* scrollableArea = m_owningLayer.scrollableArea())
+        return requiresLayerForScrollbar(scrollableArea->horizontalScrollbar());
     return false;
-
 }
 
 bool RenderLayerBacking::requiresVerticalScrollbarLayer() const
 {
-    if (auto* scrollableLayer = m_owningLayer.scrollableArea())
-        return requiresLayerForScrollbar(scrollableLayer->verticalScrollbar());
+    if (auto* scrollableArea = m_owningLayer.scrollableArea())
+        return requiresLayerForScrollbar(scrollableArea->verticalScrollbar());
     return false;
 }
 
@@ -2033,16 +2044,16 @@
     if (!is<RenderBox>(m_owningLayer.renderer()))
         return false;
 
-    auto cornerRect = m_owningLayer.overflowControlsRects().scrollCornerOrResizerRect();
-    if (cornerRect.isEmpty())
+    auto* scrollableArea = m_owningLayer.scrollableArea();
+    if (!scrollableArea)
         return false;
 
-    auto* scrollableLayer = m_owningLayer.scrollableArea();
-    if (!scrollableLayer)
+    auto cornerRect = scrollableArea->overflowControlsRects().scrollCornerOrResizerRect();
+    if (cornerRect.isEmpty())
         return false;
 
-    auto verticalScrollbar = scrollableLayer->verticalScrollbar();
-    auto scrollbar = verticalScrollbar ? verticalScrollbar : scrollableLayer->horizontalScrollbar();
+    auto verticalScrollbar = scrollableArea->verticalScrollbar();
+    auto scrollbar = verticalScrollbar ? verticalScrollbar : scrollableArea->horizontalScrollbar();
     return requiresLayerForScrollbar(scrollbar);
 }
 
@@ -2091,8 +2102,8 @@
 
 void RenderLayerBacking::positionOverflowControlsLayers()
 {
-    auto* scrollableLayer = m_owningLayer.scrollableArea();
-    if (!scrollableLayer || !scrollableLayer->hasScrollbars())
+    auto* scrollableArea = m_owningLayer.scrollableArea();
+    if (!scrollableArea || !scrollableArea->hasScrollbars())
         return;
     // FIXME: Should do device-pixel snapping.
     auto box = renderBox();
@@ -2113,16 +2124,15 @@
     };
 
     // These rects are relative to the borderBoxRect.
-    auto rects = m_owningLayer.overflowControlsRects();
-
+    auto rects = scrollableArea->overflowControlsRects();
     if (auto* layer = layerForHorizontalScrollbar()) {
         positionScrollbarLayer(*layer, rects.horizontalScrollbar, paddingBoxInset);
-        layer->setDrawsContent(scrollableLayer->horizontalScrollbar() && !layer->usesContentsLayer());
+        layer->setDrawsContent(scrollableArea->horizontalScrollbar() && !layer->usesContentsLayer());
     }
 
     if (auto* layer = layerForVerticalScrollbar()) {
         positionScrollbarLayer(*layer, rects.verticalScrollbar, paddingBoxInset);
-        layer->setDrawsContent(scrollableLayer->verticalScrollbar() && !layer->usesContentsLayer());
+        layer->setDrawsContent(scrollableArea->verticalScrollbar() && !layer->usesContentsLayer());
     }
 
     if (auto* layer = layerForScrollCorner()) {
@@ -3101,7 +3111,10 @@
 
     if (m_scrolledContentsLayer && m_scrolledContentsLayer->drawsContent()) {
         FloatRect layerDirtyRect = pixelSnappedRectForPainting;
-        layerDirtyRect.move(-m_scrolledContentsLayer->offsetFromRenderer() + toLayoutSize(m_owningLayer.scrollOffset()) - m_subpixelOffsetFromRenderer);
+        ScrollOffset scrollOffset;
+        if (auto* scrollableArea = m_owningLayer.scrollableArea())
+            scrollOffset = scrollableArea->scrollOffset();
+        layerDirtyRect.move(-m_scrolledContentsLayer->offsetFromRenderer() + toLayoutSize(scrollOffset) - m_subpixelOffsetFromRenderer);
         m_scrolledContentsLayer->setNeedsDisplayInRect(layerDirtyRect, shouldClip);
     }
 }
@@ -3147,8 +3160,8 @@
         if (&layer == &m_owningLayer) {
             layer.paintLayerContents(context, paintingInfo, paintFlags);
 
-            auto* scrollableLayer = layer.scrollableArea();
-            if (scrollableLayer && scrollableLayer->containsDirtyOverlayScrollbars() && !eventRegionContext)
+            auto* scrollableArea = layer.scrollableArea();
+            if (scrollableArea && scrollableArea->containsDirtyOverlayScrollbars() && !eventRegionContext)
                 layer.paintLayerContents(context, paintingInfo, paintFlags | RenderLayer::PaintLayerFlag::PaintingOverlayScrollbars);
         } else
             layer.paintLayerWithEffects(context, paintingInfo, paintFlags);
@@ -3434,26 +3447,26 @@
             paintDebugOverlays(graphicsLayer, context);
 
     } else if (graphicsLayer == layerForHorizontalScrollbar()) {
-        auto* scrollableLayer = m_owningLayer.scrollableArea();
-        ASSERT(scrollableLayer);
+        auto* scrollableArea = m_owningLayer.scrollableArea();
+        ASSERT(scrollableArea);
 
-        paintScrollbar(scrollableLayer->horizontalScrollbar(), context, dirtyRect);
+        paintScrollbar(scrollableArea->horizontalScrollbar(), context, dirtyRect);
     } else if (graphicsLayer == layerForVerticalScrollbar()) {
-        auto* scrollableLayer = m_owningLayer.scrollableArea();
-        ASSERT(scrollableLayer);
+        auto* scrollableArea = m_owningLayer.scrollableArea();
+        ASSERT(scrollableArea);
 
-        paintScrollbar(scrollableLayer->verticalScrollbar(), context, dirtyRect);
+        paintScrollbar(scrollableArea->verticalScrollbar(), context, dirtyRect);
     } else if (graphicsLayer == layerForScrollCorner()) {
-        auto* scrollableLayer = m_owningLayer.scrollableArea();
-        ASSERT(scrollableLayer);
+        auto* scrollableArea = m_owningLayer.scrollableArea();
+        ASSERT(scrollableArea);
 
-        auto cornerRect = m_owningLayer.overflowControlsRects().scrollCornerOrResizerRect();
+        auto cornerRect = scrollableArea->overflowControlsRects().scrollCornerOrResizerRect();
         GraphicsContextStateSaver stateSaver(context);
         context.translate(-cornerRect.location());
         LayoutRect transformedClip = LayoutRect(clip);
         transformedClip.moveBy(cornerRect.location());
-        scrollableLayer->paintScrollCorner(context, IntPoint(), snappedIntRect(transformedClip));
-        scrollableLayer->paintResizer(context, IntPoint(), transformedClip);
+        scrollableArea->paintScrollCorner(context, IntPoint(), snappedIntRect(transformedClip));
+        scrollableArea->paintResizer(context, IntPoint(), transformedClip);
     }
 #ifndef NDEBUG
     renderer().page().setIsPainting(false);

Modified: trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp (271813 => 271814)


--- trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp	2021-01-25 21:36:49 UTC (rev 271813)
+++ trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp	2021-01-25 21:37:54 UTC (rev 271814)
@@ -4669,8 +4669,8 @@
 
 void RenderLayerCompositor::updateScrollingNodeLayers(ScrollingNodeID nodeID, RenderLayer& layer, ScrollingCoordinator& scrollingCoordinator)
 {
-    auto* scrollableLayer = layer.scrollableArea();
-    ASSERT(scrollableLayer);
+    auto* scrollableArea = layer.scrollableArea();
+    ASSERT(scrollableArea);
 
     if (layer.isRenderViewLayer()) {
         FrameView& frameView = m_renderView.frameView();
@@ -4683,7 +4683,7 @@
         scrollingCoordinator.setNodeLayers(nodeID, { backing.graphicsLayer(),
             backing.scrollContainerLayer(), backing.scrolledContentsLayer(),
             nullptr, nullptr, nullptr,
-            scrollableLayer->layerForHorizontalScrollbar(), scrollableLayer->layerForVerticalScrollbar() });
+            scrollableArea->layerForHorizontalScrollbar(), scrollableArea->layerForVerticalScrollbar() });
     }
 }
 
@@ -4722,8 +4722,8 @@
             updateScrollingNodeLayers(newNodeID, layer, *scrollingCoordinator);
 
         if (changes & ScrollingNodeChangeFlags::LayerGeometry && treeState.parentNodeID) {
-            if (auto* scrollableLayer = layer.scrollableArea())
-                scrollingCoordinator->setScrollingNodeScrollableAreaGeometry(newNodeID, *scrollableLayer);
+            if (auto* scrollableArea = layer.scrollableArea())
+                scrollingCoordinator->setScrollingNodeScrollableAreaGeometry(newNodeID, *scrollableArea);
         }
     }
 
@@ -5038,14 +5038,14 @@
     auto* backing = layer.backing();
     ASSERT(backing);
 
-    auto* scrollableLayer = layer.scrollableArea();
-    ASSERT(scrollableLayer);
+    auto* scrollableArea = layer.scrollableArea();
+    ASSERT(scrollableArea);
 
-    bool allowHorizontalScrollbar = !scrollableLayer->horizontalScrollbarHiddenByStyle();
-    bool allowVerticalScrollbar = !scrollableLayer->verticalScrollbarHiddenByStyle();
+    bool allowHorizontalScrollbar = !scrollableArea->horizontalScrollbarHiddenByStyle();
+    bool allowVerticalScrollbar = !scrollableArea->verticalScrollbarHiddenByStyle();
 
     m_chromeClient.addOrUpdateScrollingLayer(layer.renderer().element(), backing->scrollContainerLayer()->platformLayer(), backing->scrolledContentsLayer()->platformLayer(),
-        scrollableLayer->reachableTotalContentsSize(), allowHorizontalScrollbar, allowVerticalScrollbar);
+        scrollableArea->reachableTotalContentsSize(), allowHorizontalScrollbar, allowVerticalScrollbar);
 }
 
 void LegacyWebKitScrollingLayerCoordinator::registerAllScrollingLayers()

Modified: trunk/Source/WebCore/rendering/RenderLayerModelObject.cpp (271813 => 271814)


--- trunk/Source/WebCore/rendering/RenderLayerModelObject.cpp	2021-01-25 21:36:49 UTC (rev 271813)
+++ trunk/Source/WebCore/rendering/RenderLayerModelObject.cpp	2021-01-25 21:37:54 UTC (rev 271814)
@@ -184,9 +184,10 @@
 #if ENABLE(CSS_SCROLL_SNAP)
     if (oldStyle && scrollSnapContainerRequiresUpdateForStyleUpdate(*oldStyle, newStyle)) {
         if (RenderLayer* renderLayer = layer()) {
-            auto* scrollableLayer = renderLayer->ensureLayerScrollableArea();
-            scrollableLayer->updateSnapOffsets();
-            scrollableLayer->updateScrollSnapState();
+            if (auto* scrollableArea = renderLayer->scrollableArea()) {
+                scrollableArea->updateSnapOffsets();
+                scrollableArea->updateScrollSnapState();
+            }
         } else if (isBody() || isDocumentElementRenderer()) {
             FrameView& frameView = view().frameView();
             frameView.updateSnapOffsets();
@@ -204,9 +205,10 @@
         if (scrollSnapBox && scrollSnapBox->layer()) {
             const RenderStyle& style = scrollSnapBox->style();
             if (style.scrollSnapType().strictness != ScrollSnapStrictness::None) {
-                auto* scrollableLayer = scrollSnapBox->layer()->ensureLayerScrollableArea();
-                scrollableLayer->updateSnapOffsets();
-                scrollableLayer->updateScrollSnapState();
+                if (auto* scrollableArea = scrollSnapBox->layer()->scrollableArea()) {
+                    scrollableArea->updateSnapOffsets();
+                    scrollableArea->updateScrollSnapState();
+                }
                 if (scrollSnapBox->isBody() || scrollSnapBox->isDocumentElementRenderer())
                     scrollSnapBox->view().frameView().updateScrollingCoordinatorScrollSnapProperties();
             }

Modified: trunk/Source/WebCore/rendering/RenderLayerScrollableArea.cpp (271813 => 271814)


--- trunk/Source/WebCore/rendering/RenderLayerScrollableArea.cpp	2021-01-25 21:36:49 UTC (rev 271813)
+++ trunk/Source/WebCore/rendering/RenderLayerScrollableArea.cpp	2021-01-25 21:37:54 UTC (rev 271814)
@@ -1262,8 +1262,8 @@
         if (!paintingRoot)
             paintingRoot = renderer.view().layer();
 
-        if (auto* scrollableLayer = paintingRoot->scrollableArea())
-            scrollableLayer->setContainsDirtyOverlayScrollbars(true);
+        if (auto* scrollableArea = paintingRoot->scrollableArea())
+            scrollableArea->setContainsDirtyOverlayScrollbars(true);
         return;
     }
 
@@ -1762,8 +1762,8 @@
         if (!remainingScrollOffset.isZero() && renderer.parent()) {
             // FIXME: This skips scrollable frames.
             if (auto* enclosingScrollableLayer = m_layer.enclosingScrollableLayer(IncludeSelfOrNot::ExcludeSelf, CrossFrameBoundaries::Yes)) {
-                if (auto* scrollableLayer = enclosingScrollableLayer->scrollableArea())
-                    scrollableLayer->scrollByRecursively(remainingScrollOffset, scrolledArea);
+                if (auto* scrollableArea = enclosingScrollableLayer->scrollableArea())
+                    scrollableArea->scrollByRecursively(remainingScrollOffset, scrolledArea);
             }
 
             renderer.frame().eventHandler().updateAutoscrollRenderer();

Modified: trunk/Source/WebCore/rendering/RenderListBox.cpp (271813 => 271814)


--- trunk/Source/WebCore/rendering/RenderListBox.cpp	2021-01-25 21:36:49 UTC (rev 271813)
+++ trunk/Source/WebCore/rendering/RenderListBox.cpp	2021-01-25 21:37:54 UTC (rev 271814)
@@ -897,8 +897,8 @@
 
 bool RenderListBox::hasScrollableOrRubberbandableAncestor()
 {
-    if (auto* scrollableLayer = enclosingLayer() ? enclosingLayer()->scrollableArea() : nullptr)
-        return scrollableLayer->hasScrollableOrRubberbandableAncestor();
+    if (auto* scrollableArea = enclosingLayer() ? enclosingLayer()->scrollableArea() : nullptr)
+        return scrollableArea->hasScrollableOrRubberbandableAncestor();
     return false;
 }
 

Modified: trunk/Source/WebCore/rendering/RenderMarquee.cpp (271813 => 271814)


--- trunk/Source/WebCore/rendering/RenderMarquee.cpp	2021-01-25 21:36:49 UTC (rev 271813)
+++ trunk/Source/WebCore/rendering/RenderMarquee.cpp	2021-01-25 21:37:54 UTC (rev 271814)
@@ -174,15 +174,15 @@
     if (m_timer.isActive() || m_layer->renderer().style().marqueeIncrement().isZero())
         return;
 
-    auto* scrollableLayer = m_layer->scrollableArea();
-    ASSERT(scrollableLayer);
+    auto* scrollableArea = m_layer->scrollableArea();
+    ASSERT(scrollableArea);
 
     auto details = ScrollPositionChangeOptions::createProgrammaticUnclamped();
     if (!m_suspended && !m_stopped) {
         if (isHorizontal())
-            scrollableLayer->scrollToOffset(ScrollOffset(m_start, 0), details);
+            scrollableArea->scrollToOffset(ScrollOffset(m_start, 0), details);
         else
-            scrollableLayer->scrollToOffset(ScrollOffset(0, m_start), details);
+            scrollableArea->scrollToOffset(ScrollOffset(0, m_start), details);
     } else {
         m_suspended = false;
         m_stopped = false;
@@ -251,15 +251,15 @@
     if (m_layer->renderer().view().needsLayout())
         return;
 
-    auto* scrollableLayer = m_layer->scrollableArea();
-    ASSERT(scrollableLayer);
+    auto* scrollableArea = m_layer->scrollableArea();
+    ASSERT(scrollableArea);
 
     if (m_reset) {
         m_reset = false;
         if (isHorizontal())
-            scrollableLayer->scrollToXOffset(m_start);
+            scrollableArea->scrollToXOffset(m_start);
         else
-            scrollableLayer->scrollToYOffset(m_start);
+            scrollableArea->scrollToYOffset(m_start);
         return;
     }
     
@@ -282,7 +282,7 @@
         bool positive = range > 0;
         int clientSize = (isHorizontal() ? roundToInt(m_layer->renderBox()->clientWidth()) : roundToInt(m_layer->renderBox()->clientHeight()));
         int increment = abs(intValueForLength(m_layer->renderer().style().marqueeIncrement(), clientSize));
-        int currentPos = (isHorizontal() ? m_layer->scrollOffset().x() : m_layer->scrollOffset().y());
+        int currentPos = (isHorizontal() ? scrollableArea->scrollOffset().x() : scrollableArea->scrollOffset().y());
         newPos =  currentPos + (addIncrement ? increment : -increment);
         if (positive)
             newPos = std::min(newPos, endPoint);
@@ -299,9 +299,9 @@
     }
     
     if (isHorizontal())
-        scrollableLayer->scrollToXOffset(newPos);
+        scrollableArea->scrollToXOffset(newPos);
     else
-        scrollableLayer->scrollToYOffset(newPos);
+        scrollableArea->scrollToYOffset(newPos);
 }
 
 } // namespace WebCore

Modified: trunk/Source/WebCore/rendering/RenderTextControlSingleLine.cpp (271813 => 271814)


--- trunk/Source/WebCore/rendering/RenderTextControlSingleLine.cpp	2021-01-25 21:36:49 UTC (rev 271813)
+++ trunk/Source/WebCore/rendering/RenderTextControlSingleLine.cpp	2021-01-25 21:37:54 UTC (rev 271814)
@@ -34,6 +34,7 @@
 #include "HitTestResult.h"
 #include "LocalizedStrings.h"
 #include "RenderLayer.h"
+#include "RenderLayerScrollableArea.h"
 #include "RenderScrollbar.h"
 #include "RenderTheme.h"
 #include "RenderView.h"
@@ -397,11 +398,11 @@
 
 bool RenderTextControlSingleLine::scroll(ScrollDirection direction, ScrollGranularity granularity, float multiplier, Element** stopElement, RenderBox* startBox, const IntPoint& wheelEventAbsolutePoint)
 {
-    RenderTextControlInnerBlock* renderer = innerTextElement()->renderer();
+    auto* renderer = innerTextElement()->renderer();
     if (!renderer)
         return false;
-    RenderLayer* layer = renderer->layer();
-    if (layer && layer->scroll(direction, granularity, multiplier))
+    auto* scrollableArea = renderer->layer() ? renderer->layer()->scrollableArea() : nullptr;
+    if (scrollableArea && scrollableArea->scroll(direction, granularity, multiplier))
         return true;
     return RenderBlockFlow::scroll(direction, granularity, multiplier, stopElement, startBox, wheelEventAbsolutePoint);
 }
@@ -408,8 +409,9 @@
 
 bool RenderTextControlSingleLine::logicalScroll(ScrollLogicalDirection direction, ScrollGranularity granularity, float multiplier, Element** stopElement)
 {
-    RenderLayer* layer = innerTextElement()->renderer()->layer();
-    if (layer && layer->scroll(logicalToPhysical(direction, style().isHorizontalWritingMode(), style().isFlippedBlocksWritingMode()), granularity, multiplier))
+    auto* layer = innerTextElement()->renderer()->layer();
+    auto* scrollableArea = layer ? layer->scrollableArea() : nullptr;
+    if (scrollableArea && scrollableArea->scroll(logicalToPhysical(direction, style().isHorizontalWritingMode(), style().isFlippedBlocksWritingMode()), granularity, multiplier))
         return true;
     return RenderBlockFlow::logicalScroll(direction, granularity, multiplier, stopElement);
 }

Modified: trunk/Source/WebCore/rendering/RenderTreeAsText.cpp (271813 => 271814)


--- trunk/Source/WebCore/rendering/RenderTreeAsText.cpp	2021-01-25 21:36:49 UTC (rev 271813)
+++ trunk/Source/WebCore/rendering/RenderTreeAsText.cpp	2021-01-25 21:37:54 UTC (rev 271814)
@@ -658,14 +658,16 @@
     }
 
     if (layer.renderer().hasOverflowClip()) {
-        if (layer.scrollOffset().x())
-            ts << " scrollX " << layer.scrollOffset().x();
-        if (layer.scrollOffset().y())
-            ts << " scrollY " << layer.scrollOffset().y();
-        if (layer.renderBox() && roundToInt(layer.renderBox()->clientWidth()) != layer.scrollWidth())
-            ts << " scrollWidth " << layer.scrollWidth();
-        if (layer.renderBox() && roundToInt(layer.renderBox()->clientHeight()) != layer.scrollHeight())
-            ts << " scrollHeight " << layer.scrollHeight();
+        if (auto* scrollableArea = layer.scrollableArea()) {
+            if (scrollableArea->scrollOffset().x())
+                ts << " scrollX " << scrollableArea->scrollOffset().x();
+            if (scrollableArea->scrollOffset().y())
+                ts << " scrollY " << scrollableArea->scrollOffset().y();
+            if (layer.renderBox() && roundToInt(layer.renderBox()->clientWidth()) != scrollableArea->scrollWidth())
+                ts << " scrollWidth " << scrollableArea->scrollWidth();
+            if (layer.renderBox() && roundToInt(layer.renderBox()->clientHeight()) != scrollableArea->scrollHeight())
+                ts << " scrollHeight " << scrollableArea->scrollHeight();
+        }
 #if PLATFORM(MAC)
         ScrollbarTheme& scrollbarTheme = ScrollbarTheme::theme();
         if (!scrollbarTheme.isMockTheme() && layer.scrollableArea() && layer.scrollableArea()->hasVerticalScrollbar()) {

Modified: trunk/Source/WebKitLegacy/mac/ChangeLog (271813 => 271814)


--- trunk/Source/WebKitLegacy/mac/ChangeLog	2021-01-25 21:36:49 UTC (rev 271813)
+++ trunk/Source/WebKitLegacy/mac/ChangeLog	2021-01-25 21:37:54 UTC (rev 271814)
@@ -1,3 +1,28 @@
+2021-01-22  Nikolas Zimmermann  <nzimmerm...@igalia.com>
+
+        Finish introduction of RenderLayerScrollableArea: remove remaining glue code from RenderLayer
+        https://bugs.webkit.org/show_bug.cgi?id=220851
+
+        Reviewed by Simon Fraser.
+
+        Remove the last remaining glue code from RenderLayer, that was added
+        in r271559 to minimize the patch size. After this patch all call sites
+        use RenderLayerScrollableArea directly, removing the need for proxy
+        methods in RenderLayer that forward to RenderLayerScrollableArea.
+
+        The decade old bug 60305 (Separate scrolling code out of RenderLayer)
+        is finally closed.
+
+        Covered by existing tests.
+
+        * DOM/DOMHTML.mm:
+        (-[DOMHTMLElement scrollXOffset]):
+        (-[DOMHTMLElement scrollYOffset]):
+        (-[DOMHTMLElement setScrollXOffset:scrollYOffset:adjustForIOSCaret:]):
+        * WebView/WebFrame.mm:
+        (-[WebFrame _scrollDOMRangeToVisible:]):
+        (-[WebFrame _scrollDOMRangeToVisible:withInset:]):
+
 2021-01-25  Chris Dumez  <cdu...@apple.com>
 
         Support AbortSignal in addEventListenerOptions to unsubscribe from events

Modified: trunk/Source/WebKitLegacy/mac/DOM/DOMHTML.mm (271813 => 271814)


--- trunk/Source/WebKitLegacy/mac/DOM/DOMHTML.mm	2021-01-25 21:36:49 UTC (rev 271813)
+++ trunk/Source/WebKitLegacy/mac/DOM/DOMHTML.mm	2021-01-25 21:37:54 UTC (rev 271814)
@@ -78,7 +78,14 @@
     if (!is<WebCore::RenderBox>(*renderer) || !renderer->hasOverflowClip())
         return 0;
 
-    return downcast<WebCore::RenderBox>(*renderer).layer()->scrollOffset().x();
+    auto* layer = downcast<WebCore::RenderBox>(*renderer).layer();
+    if (!layer)
+        return 0;
+    auto* scrollableArea = layer->scrollableArea();
+    if (!scrollableArea)
+        return 0;
+
+    return scrollableArea->scrollOffset().x();
 }
 
 - (int)scrollYOffset
@@ -92,7 +99,14 @@
     if (!is<WebCore::RenderBox>(*renderer) || !renderer->hasOverflowClip())
         return 0;
 
-    return downcast<WebCore::RenderBox>(*renderer).layer()->scrollOffset().y();
+    auto* layer = downcast<WebCore::RenderBox>(*renderer).layer();
+    if (!layer)
+        return 0;
+    auto* scrollableArea = layer->scrollableArea();
+    if (!scrollableArea)
+        return 0;
+
+    return scrollableArea->scrollOffset().y();
 }
 
 - (void)setScrollXOffset:(int)x scrollYOffset:(int)y
@@ -112,18 +126,18 @@
         return;
 
     auto* layer = downcast<WebCore::RenderBox>(*renderer).layer();
-    ASSERT(layer);
+    if (!layer)
+        return;
+    auto* scrollableArea = layer->ensureLayerScrollableArea();
 
-    auto* scrollableLayer = layer->ensureLayerScrollableArea();
-
     if (adjustForIOSCaret)
-        scrollableLayer->setAdjustForIOSCaretWhenScrolling(true);
+        scrollableArea->setAdjustForIOSCaretWhenScrolling(true);
 
     auto scrollPositionChangeOptions = WebCore::ScrollPositionChangeOptions::createProgrammatic();
     scrollPositionChangeOptions.clamping = WebCore::ScrollClamping::Unclamped;
-    scrollableLayer->scrollToOffset(WebCore::ScrollOffset(x, y), scrollPositionChangeOptions);
+    scrollableArea->scrollToOffset(WebCore::ScrollOffset(x, y), scrollPositionChangeOptions);
     if (adjustForIOSCaret)
-        scrollableLayer->setAdjustForIOSCaretWhenScrolling(false);
+        scrollableArea->setAdjustForIOSCaretWhenScrolling(false);
 }
 
 - (void)absolutePosition:(int *)x :(int *)y :(int *)w :(int *)h

Modified: trunk/Source/WebKitLegacy/mac/WebView/WebFrame.mm (271813 => 271814)


--- trunk/Source/WebKitLegacy/mac/WebView/WebFrame.mm	2021-01-25 21:36:49 UTC (rev 271813)
+++ trunk/Source/WebKitLegacy/mac/WebView/WebFrame.mm	2021-01-25 21:37:54 UTC (rev 271814)
@@ -742,10 +742,10 @@
 #else
         auto* layer = startNode->renderer()->enclosingLayer();
         if (layer) {
-            auto* scrollableLayer = layer->ensureLayerScrollableArea();
-            scrollableLayer->setAdjustForIOSCaretWhenScrolling(true);
+            auto* scrollableArea = layer->ensureLayerScrollableArea();
+            scrollableArea->setAdjustForIOSCaretWhenScrolling(true);
             startNode->renderer()->scrollRectToVisible(WebCore::enclosingIntRect(rangeRect), insideFixed, { WebCore::SelectionRevealMode::Reveal, WebCore::ScrollAlignment::alignToEdgeIfNeeded, WebCore::ScrollAlignment::alignToEdgeIfNeeded, WebCore::ShouldAllowCrossOriginScrolling::Yes });
-            scrollableLayer->setAdjustForIOSCaretWhenScrolling(false);
+            scrollableArea->setAdjustForIOSCaretWhenScrolling(false);
             _private->coreFrame->selection().setCaretRectNeedsUpdate();
             _private->coreFrame->selection().updateAppearance();
         }
@@ -763,10 +763,10 @@
     if (startNode && startNode->renderer()) {
         auto* layer = startNode->renderer()->enclosingLayer();
         if (layer) {
-            auto* scrollableLayer = layer->ensureLayerScrollableArea();
-            scrollableLayer->setAdjustForIOSCaretWhenScrolling(true);
+            auto* scrollableArea = layer->ensureLayerScrollableArea();
+            scrollableArea->setAdjustForIOSCaretWhenScrolling(true);
             startNode->renderer()->scrollRectToVisible(WebCore::enclosingIntRect(rangeRect), insideFixed, { WebCore::SelectionRevealMode::Reveal, WebCore::ScrollAlignment::alignToEdgeIfNeeded, WebCore::ScrollAlignment::alignToEdgeIfNeeded, WebCore::ShouldAllowCrossOriginScrolling::Yes});
-            scrollableLayer->setAdjustForIOSCaretWhenScrolling(false);
+            scrollableArea->setAdjustForIOSCaretWhenScrolling(false);
 
             auto coreFrame = core(self);
             if (coreFrame) {

Modified: trunk/Source/WebKitLegacy/win/ChangeLog (271813 => 271814)


--- trunk/Source/WebKitLegacy/win/ChangeLog	2021-01-25 21:36:49 UTC (rev 271813)
+++ trunk/Source/WebKitLegacy/win/ChangeLog	2021-01-25 21:37:54 UTC (rev 271814)
@@ -1,3 +1,23 @@
+2021-01-22  Nikolas Zimmermann  <nzimmerm...@igalia.com>
+
+        Finish introduction of RenderLayerScrollableArea: remove remaining glue code from RenderLayer
+        https://bugs.webkit.org/show_bug.cgi?id=220851
+
+        Reviewed by Simon Fraser.
+
+        Remove the last remaining glue code from RenderLayer, that was added
+        in r271559 to minimize the patch size. After this patch all call sites
+        use RenderLayerScrollableArea directly, removing the need for proxy
+        methods in RenderLayer that forward to RenderLayerScrollableArea.
+
+        The decade old bug 60305 (Separate scrolling code out of RenderLayer)
+        is finally closed.
+
+        Covered by existing tests.
+
+        * WebView.cpp:
+        (WebView::gesture):
+
 2021-01-18  Nikolas Zimmermann  <nzimmerm...@igalia.com>
 
         Continue removing glue code from RenderLayer that was recently added in r271559

Modified: trunk/Source/WebKitLegacy/win/WebView.cpp (271813 => 271814)


--- trunk/Source/WebKitLegacy/win/WebView.cpp	2021-01-25 21:36:49 UTC (rev 271813)
+++ trunk/Source/WebKitLegacy/win/WebView.cpp	2021-01-25 21:37:54 UTC (rev 271814)
@@ -2039,18 +2039,18 @@
         float scaleFactor = deviceScaleFactor();
         IntSize logicalScrollDelta(-deltaX * scaleFactor, -deltaY * scaleFactor);
 
-        RenderLayer* scrollableLayer = nullptr;
+        RenderLayer* scrollableArea = nullptr;
         if (m_gestureTargetNode && m_gestureTargetNode->renderer()) {
             if (auto* layer = m_gestureTargetNode->renderer()->enclosingLayer())
-                scrollableLayer = layer->enclosingScrollableLayer(IncludeSelfOrNot::ExcludeSelf, CrossFrameBoundaries::Yes);
+                scrollableArea = layer->enclosingScrollableLayer(IncludeSelfOrNot::ExcludeSelf, CrossFrameBoundaries::Yes);
         }
 
-        if (!scrollableLayer) {
+        if (!scrollableArea) {
             // We might directly hit the document without hitting any nodes
             coreFrame->view()->scrollBy(logicalScrollDelta);
             scrolledArea = coreFrame->view();
         } else
-            scrollableLayer->ensureLayerScrollableArea()->scrollByRecursively(logicalScrollDelta, &scrolledArea);
+            scrollableArea->ensureLayerScrollableArea()->scrollByRecursively(logicalScrollDelta, &scrolledArea);
 
         if (!(UpdatePanningFeedbackPtr() && BeginPanningFeedbackPtr() && EndPanningFeedbackPtr())) {
             CloseGestureInfoHandlePtr()(gestureHandle);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to