Title: [271598] trunk/Source
Revision
271598
Author
[email protected]
Date
2021-01-19 03:02:44 -0800 (Tue, 19 Jan 2021)

Log Message

Continue removing glue code from RenderLayer that was recently added in r271559
https://bugs.webkit.org/show_bug.cgi?id=220715

Reviewed by Adrian Perez de Castro.

Follow-up on patch adressing the removal of the glue code that
forwards calls from RenderLayer to RenderLayerScrollableArea (see
webkit.org/b/60305).

Covered by existing tests.

Source/WebCore:

* page/SpatialNavigation.cpp:
(WebCore::scrollInDirection):
* rendering/RenderBox.cpp:
(WebCore::setupWheelEventMonitor):
(WebCore::RenderBox::setScrollLeft):
(WebCore::RenderBox::setScrollTop):
(WebCore::RenderBox::setScrollPosition):
* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::currentScrollType const): Deleted.
(WebCore::RenderLayer::scrollAnimator const): Deleted.
(WebCore::RenderLayer::scrollToXPosition): Deleted.
(WebCore::RenderLayer::scrollToYPosition): Deleted.
(WebCore::RenderLayer::setScrollPosition): Deleted.
(WebCore::RenderLayer::scrollByRecursively): Deleted.
(WebCore::RenderLayer::setRequiresScrollPositionReconciliation): Deleted.
(WebCore::RenderLayer::hasScrollableOrRubberbandableAncestor): Deleted.
(WebCore::RenderLayer::reachableTotalContentsSize const): Deleted.
(WebCore::RenderLayer::horizontalScrollbarHiddenByStyle const): Deleted.
(WebCore::RenderLayer::verticalScrollbarHiddenByStyle const): Deleted.
* rendering/RenderLayer.h:
* rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::updateScrollOffset):
* rendering/RenderLayerCompositor.cpp:
(WebCore::LegacyWebKitScrollingLayerCoordinator::updateScrollingLayer):
* rendering/RenderLayerScrollableArea.cpp:
(WebCore::RenderLayerScrollableArea::scrollByRecursively):
* rendering/RenderListBox.cpp:
(WebCore::RenderListBox::hasScrollableOrRubberbandableAncestor):

Source/WebKitLegacy/win:

* WebView.cpp:
(WebView::gesture):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (271597 => 271598)


--- trunk/Source/WebCore/ChangeLog	2021-01-19 09:07:51 UTC (rev 271597)
+++ trunk/Source/WebCore/ChangeLog	2021-01-19 11:02:44 UTC (rev 271598)
@@ -1,3 +1,45 @@
+2021-01-18  Nikolas Zimmermann  <[email protected]>
+
+        Continue removing glue code from RenderLayer that was recently added in r271559
+        https://bugs.webkit.org/show_bug.cgi?id=220715
+
+        Reviewed by Adrian Perez de Castro.
+
+        Follow-up on patch adressing the removal of the glue code that
+        forwards calls from RenderLayer to RenderLayerScrollableArea (see
+        webkit.org/b/60305).
+
+        Covered by existing tests.
+
+        * page/SpatialNavigation.cpp:
+        (WebCore::scrollInDirection):
+        * rendering/RenderBox.cpp:
+        (WebCore::setupWheelEventMonitor):
+        (WebCore::RenderBox::setScrollLeft):
+        (WebCore::RenderBox::setScrollTop):
+        (WebCore::RenderBox::setScrollPosition):
+        * rendering/RenderLayer.cpp:
+        (WebCore::RenderLayer::currentScrollType const): Deleted.
+        (WebCore::RenderLayer::scrollAnimator const): Deleted.
+        (WebCore::RenderLayer::scrollToXPosition): Deleted.
+        (WebCore::RenderLayer::scrollToYPosition): Deleted.
+        (WebCore::RenderLayer::setScrollPosition): Deleted.
+        (WebCore::RenderLayer::scrollByRecursively): Deleted.
+        (WebCore::RenderLayer::setRequiresScrollPositionReconciliation): Deleted.
+        (WebCore::RenderLayer::hasScrollableOrRubberbandableAncestor): Deleted.
+        (WebCore::RenderLayer::reachableTotalContentsSize const): Deleted.
+        (WebCore::RenderLayer::horizontalScrollbarHiddenByStyle const): Deleted.
+        (WebCore::RenderLayer::verticalScrollbarHiddenByStyle const): Deleted.
+        * rendering/RenderLayer.h:
+        * rendering/RenderLayerBacking.cpp:
+        (WebCore::RenderLayerBacking::updateScrollOffset):
+        * rendering/RenderLayerCompositor.cpp:
+        (WebCore::LegacyWebKitScrollingLayerCoordinator::updateScrollingLayer):
+        * rendering/RenderLayerScrollableArea.cpp:
+        (WebCore::RenderLayerScrollableArea::scrollByRecursively):
+        * rendering/RenderListBox.cpp:
+        (WebCore::RenderListBox::hasScrollableOrRubberbandableAncestor):
+
 2021-01-18  Andres Gonzalez  <[email protected]>
 
         Apple Mail AX, VoiceOver: When composing a new email message, moving VO focus to the message body field does not bring keyboard focus along.

Modified: trunk/Source/WebCore/page/SpatialNavigation.cpp (271597 => 271598)


--- trunk/Source/WebCore/page/SpatialNavigation.cpp	2021-01-19 09:07:51 UTC (rev 271597)
+++ trunk/Source/WebCore/page/SpatialNavigation.cpp	2021-01-19 11:02:44 UTC (rev 271598)
@@ -41,6 +41,7 @@
 #include "Page.h"
 #include "RenderInline.h"
 #include "RenderLayer.h"
+#include "RenderLayerScrollableArea.h"
 #include "Settings.h"
 
 namespace WebCore {
@@ -394,7 +395,8 @@
             return false;
         }
 
-        container->renderBox()->enclosingLayer()->scrollByRecursively(IntSize(dx, dy));
+        if (auto* scrollableLayer = container->renderBox()->enclosingLayer()->scrollableArea())
+            scrollableLayer->scrollByRecursively(IntSize(dx, dy));
         return true;
     }
 

Modified: trunk/Source/WebCore/rendering/RenderBox.cpp (271597 => 271598)


--- trunk/Source/WebCore/rendering/RenderBox.cpp	2021-01-19 09:07:51 UTC (rev 271597)
+++ trunk/Source/WebCore/rendering/RenderBox.cpp	2021-01-19 11:02:44 UTC (rev 271598)
@@ -63,6 +63,7 @@
 #include "RenderIterator.h"
 #include "RenderLayer.h"
 #include "RenderLayerCompositor.h"
+#include "RenderLayerScrollableArea.h"
 #include "RenderLayoutState.h"
 #include "RenderMultiColumnFlow.h"
 #include "RenderTableCell.h"
@@ -590,7 +591,9 @@
     Page& page = layer.renderer().page();
     if (!page.isMonitoringWheelEvents())
         return;
-    layer.scrollAnimator().setWheelEventTestMonitor(page.wheelEventTestMonitor());
+    auto* scrollableLayer = layer.scrollableArea();
+    ASSERT(scrollableLayer);
+    scrollableLayer->scrollAnimator().setWheelEventTestMonitor(page.wheelEventTestMonitor());
 }
 
 void RenderBox::setScrollLeft(int newLeft, const ScrollPositionChangeOptions& options)
@@ -598,7 +601,7 @@
     if (!hasOverflowClip() || !layer())
         return;
     setupWheelEventMonitor(*layer());
-    layer()->scrollToXPosition(newLeft, options);
+    layer()->ensureLayerScrollableArea()->scrollToXPosition(newLeft, options);
 }
 
 void RenderBox::setScrollTop(int newTop, const ScrollPositionChangeOptions& options)
@@ -606,7 +609,7 @@
     if (!hasOverflowClip() || !layer())
         return;
     setupWheelEventMonitor(*layer());
-    layer()->scrollToYPosition(newTop, options);
+    layer()->ensureLayerScrollableArea()->scrollToYPosition(newTop, options);
 }
 
 void RenderBox::setScrollPosition(const ScrollPosition& position, const ScrollPositionChangeOptions& options)
@@ -614,7 +617,7 @@
     if (!hasOverflowClip() || !layer())
         return;
     setupWheelEventMonitor(*layer());
-    layer()->setScrollPosition(position, options);
+    layer()->ensureLayerScrollableArea()->setScrollPosition(position, options);
 }
 
 void RenderBox::absoluteRects(Vector<IntRect>& rects, const LayoutPoint& accumulatedOffset) const

Modified: trunk/Source/WebCore/rendering/RenderLayer.cpp (271597 => 271598)


--- trunk/Source/WebCore/rendering/RenderLayer.cpp	2021-01-19 09:07:51 UTC (rev 271597)
+++ trunk/Source/WebCore/rendering/RenderLayer.cpp	2021-01-19 11:02:44 UTC (rev 271598)
@@ -377,18 +377,6 @@
 }
 
 // Start of temporary glue code to help landing webkit.org/b/60305 (split RenderLayer into RenderLayer/RenderLayerScrollableArea)
-ScrollType RenderLayer::currentScrollType() const
-{
-    if (m_scrollableArea)
-        return m_scrollableArea->currentScrollType();
-    return ScrollType::User;
-}
-
-ScrollAnimator& RenderLayer::scrollAnimator() const
-{
-    return const_cast<RenderLayer*>(this)->ensureLayerScrollableArea()->scrollAnimator();
-}
-
 ScrollOffset RenderLayer::scrollOffset() const
 {
     if (m_scrollableArea)
@@ -396,32 +384,6 @@
     return { 0, 0 };
 }
 
-void RenderLayer::scrollToXPosition(int x, const ScrollPositionChangeOptions& options)
-{
-    ensureLayerScrollableArea()->scrollToXPosition(x, options);
-}
-
-void RenderLayer::scrollToYPosition(int y, const ScrollPositionChangeOptions& options)
-{
-    ensureLayerScrollableArea()->scrollToYPosition(y, options);
-}
-
-void RenderLayer::setScrollPosition(const ScrollPosition& position, const ScrollPositionChangeOptions& options)
-{
-    ensureLayerScrollableArea()->setScrollPosition(position, options);
-}
-
-void RenderLayer::scrollByRecursively(const IntSize& delta, ScrollableArea** scrolledArea)
-{
-    ensureLayerScrollableArea()->scrollByRecursively(delta, scrolledArea);
-}
-
-void RenderLayer::setRequiresScrollPositionReconciliation(bool requiresReconciliation)
-{
-    if (m_scrollableArea)
-        m_scrollableArea->setRequiresScrollPositionReconciliation(requiresReconciliation);
-}
-
 bool RenderLayer::shouldPlaceBlockDirectionScrollbarOnLeft() const
 {
     return renderer().shouldPlaceBlockDirectionScrollbarOnLeft();
@@ -434,13 +396,6 @@
     return false;
 }
 
-bool RenderLayer::hasScrollableOrRubberbandableAncestor()
-{
-    if (m_scrollableArea)
-        return m_scrollableArea->hasScrollableOrRubberbandableAncestor();
-    return false;
-}
-
 RenderMarquee* RenderLayer::marquee() const
 {
     if (m_scrollableArea)
@@ -485,27 +440,6 @@
         m_scrollableArea->paintOverlayScrollbars(context, damageRect, behavior, subtreePaintRoot);
 }
 
-IntSize RenderLayer::reachableTotalContentsSize() const
-{
-    if (m_scrollableArea)
-        return m_scrollableArea->reachableTotalContentsSize();
-    return { 0, 0 };
-}
-
-bool RenderLayer::horizontalScrollbarHiddenByStyle() const
-{
-    if (m_scrollableArea)
-        return m_scrollableArea->horizontalScrollbarHiddenByStyle();
-    return false;
-}
-
-bool RenderLayer::verticalScrollbarHiddenByStyle() const
-{
-    if (m_scrollableArea)
-        return m_scrollableArea->verticalScrollbarHiddenByStyle();
-    return false;
-}
-
 void RenderLayer::setPostLayoutScrollPosition(Optional<ScrollPosition> position)
 {
     if (m_scrollableArea)

Modified: trunk/Source/WebCore/rendering/RenderLayer.h (271597 => 271598)


--- trunk/Source/WebCore/rendering/RenderLayer.h	2021-01-19 09:07:51 UTC (rev 271597)
+++ trunk/Source/WebCore/rendering/RenderLayer.h	2021-01-19 11:02:44 UTC (rev 271598)
@@ -160,17 +160,9 @@
     WEBCORE_EXPORT RenderLayerScrollableArea* ensureLayerScrollableArea();
 
     // Start of temporary glue code to help landing webkit.org/b/60305 (split RenderLayer into RenderLayer/RenderLayerScrollableArea)
-    ScrollType currentScrollType() const;
-    WEBCORE_EXPORT ScrollAnimator& scrollAnimator() const;
     WEBCORE_EXPORT ScrollOffset scrollOffset() const;
-    void scrollToXPosition(int x, const ScrollPositionChangeOptions&);
-    void scrollToYPosition(int y, const ScrollPositionChangeOptions&);
-    void setScrollPosition(const ScrollPosition&, const ScrollPositionChangeOptions&);
-    void scrollByRecursively(const IntSize& delta, ScrollableArea** scrolledArea = nullptr);
-    void setRequiresScrollPositionReconciliation(bool requiresReconciliation = true);
     bool shouldPlaceBlockDirectionScrollbarOnLeft() const;
     bool containsDirtyOverlayScrollbars() const;
-    bool hasScrollableOrRubberbandableAncestor();
     RenderMarquee* marquee() const;
     void updateLayerPositionsAfterDocumentScroll();
     bool hitTestOverflowControls(HitTestResult&, const IntPoint& localPoint);
@@ -178,9 +170,6 @@
     void paintScrollCorner(GraphicsContext&, const IntPoint&, const IntRect& damageRect);
     void paintResizer(GraphicsContext&, const LayoutPoint&, const LayoutRect& damageRect);
     void paintOverlayScrollbars(GraphicsContext&, const LayoutRect& damageRect, OptionSet<PaintBehavior>, RenderObject* subtreePaintRoot = nullptr);
-    IntSize reachableTotalContentsSize() const;
-    bool horizontalScrollbarHiddenByStyle() const;
-    bool verticalScrollbarHiddenByStyle() const;
     void setPostLayoutScrollPosition(Optional<ScrollPosition>);
     void panScrollFromPoint(const IntPoint&);
     ScrollPosition scrollPosition() const;

Modified: trunk/Source/WebCore/rendering/RenderLayerBacking.cpp (271597 => 271598)


--- trunk/Source/WebCore/rendering/RenderLayerBacking.cpp	2021-01-19 09:07:51 UTC (rev 271597)
+++ trunk/Source/WebCore/rendering/RenderLayerBacking.cpp	2021-01-19 11:02:44 UTC (rev 271598)
@@ -1491,14 +1491,17 @@
 
 void RenderLayerBacking::updateScrollOffset(ScrollOffset scrollOffset)
 {
-    if (m_owningLayer.currentScrollType() == ScrollType::User) {
+    auto* scrollableLayer = m_owningLayer.scrollableArea();
+    ASSERT(scrollableLayer);
+
+    if (scrollableLayer->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);
-        m_owningLayer.setRequiresScrollPositionReconciliation(true);
+        scrollableLayer->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);
-        m_owningLayer.setRequiresScrollPositionReconciliation(false);
+        scrollableLayer->setRequiresScrollPositionReconciliation(false);
     }
 
     ASSERT(m_scrolledContentsLayer->position().isZero());

Modified: trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp (271597 => 271598)


--- trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp	2021-01-19 09:07:51 UTC (rev 271597)
+++ trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp	2021-01-19 11:02:44 UTC (rev 271598)
@@ -5046,11 +5046,14 @@
     auto* backing = layer.backing();
     ASSERT(backing);
 
-    bool allowHorizontalScrollbar = !layer.horizontalScrollbarHiddenByStyle();
-    bool allowVerticalScrollbar = !layer.verticalScrollbarHiddenByStyle();
+    auto* scrollableLayer = layer.scrollableArea();
+    ASSERT(scrollableLayer);
 
+    bool allowHorizontalScrollbar = !scrollableLayer->horizontalScrollbarHiddenByStyle();
+    bool allowVerticalScrollbar = !scrollableLayer->verticalScrollbarHiddenByStyle();
+
     m_chromeClient.addOrUpdateScrollingLayer(layer.renderer().element(), backing->scrollContainerLayer()->platformLayer(), backing->scrolledContentsLayer()->platformLayer(),
-        layer.reachableTotalContentsSize(), allowHorizontalScrollbar, allowVerticalScrollbar);
+        scrollableLayer->reachableTotalContentsSize(), allowHorizontalScrollbar, allowVerticalScrollbar);
 }
 
 void LegacyWebKitScrollingLayerCoordinator::registerAllScrollingLayers()

Modified: trunk/Source/WebCore/rendering/RenderLayerScrollableArea.cpp (271597 => 271598)


--- trunk/Source/WebCore/rendering/RenderLayerScrollableArea.cpp	2021-01-19 09:07:51 UTC (rev 271597)
+++ trunk/Source/WebCore/rendering/RenderLayerScrollableArea.cpp	2021-01-19 11:02:44 UTC (rev 271598)
@@ -1725,8 +1725,10 @@
         IntSize remainingScrollOffset = newScrollOffset - scrollOffset();
         if (!remainingScrollOffset.isZero() && renderer.parent()) {
             // FIXME: This skips scrollable frames.
-            if (auto* scrollableLayer = m_layer.enclosingScrollableLayer(IncludeSelfOrNot::ExcludeSelf, CrossFrameBoundaries::Yes))
-                scrollableLayer->scrollByRecursively(remainingScrollOffset, scrolledArea);
+            if (auto* enclosingScrollableLayer = m_layer.enclosingScrollableLayer(IncludeSelfOrNot::ExcludeSelf, CrossFrameBoundaries::Yes)) {
+                if (auto* scrollableLayer = enclosingScrollableLayer->scrollableArea())
+                    scrollableLayer->scrollByRecursively(remainingScrollOffset, scrolledArea);
+            }
 
             renderer.frame().eventHandler().updateAutoscrollRenderer();
         }

Modified: trunk/Source/WebCore/rendering/RenderListBox.cpp (271597 => 271598)


--- trunk/Source/WebCore/rendering/RenderListBox.cpp	2021-01-19 09:07:51 UTC (rev 271597)
+++ trunk/Source/WebCore/rendering/RenderListBox.cpp	2021-01-19 11:02:44 UTC (rev 271598)
@@ -897,7 +897,9 @@
 
 bool RenderListBox::hasScrollableOrRubberbandableAncestor()
 {
-    return enclosingLayer() && enclosingLayer()->hasScrollableOrRubberbandableAncestor();
+    if (auto* scrollableLayer = enclosingLayer() ? enclosingLayer()->scrollableArea() : nullptr)
+        return scrollableLayer->hasScrollableOrRubberbandableAncestor();
+    return false;
 }
 
 IntRect RenderListBox::scrollableAreaBoundingBox(bool*) const

Modified: trunk/Source/WebKitLegacy/win/ChangeLog (271597 => 271598)


--- trunk/Source/WebKitLegacy/win/ChangeLog	2021-01-19 09:07:51 UTC (rev 271597)
+++ trunk/Source/WebKitLegacy/win/ChangeLog	2021-01-19 11:02:44 UTC (rev 271598)
@@ -1,3 +1,19 @@
+2021-01-18  Nikolas Zimmermann  <[email protected]>
+
+        Continue removing glue code from RenderLayer that was recently added in r271559
+        https://bugs.webkit.org/show_bug.cgi?id=220715
+
+        Reviewed by Adrian Perez de Castro.
+
+        Follow-up on patch adressing the removal of the glue code that
+        forwards calls from RenderLayer to RenderLayerScrollableArea (see
+        webkit.org/b/60305).
+
+        Covered by existing tests.
+
+        * WebView.cpp:
+        (WebView::gesture):
+
 2021-01-13  Alex Christensen  <[email protected]>
 
         Use more inclusive language in legacy Windows plugin code

Modified: trunk/Source/WebKitLegacy/win/WebView.cpp (271597 => 271598)


--- trunk/Source/WebKitLegacy/win/WebView.cpp	2021-01-19 09:07:51 UTC (rev 271597)
+++ trunk/Source/WebKitLegacy/win/WebView.cpp	2021-01-19 11:02:44 UTC (rev 271598)
@@ -147,6 +147,7 @@
 #include <WebCore/PopupMenuWin.h>
 #include <WebCore/ProgressTracker.h>
 #include <WebCore/RenderLayer.h>
+#include <WebCore/RenderLayerScrollableArea.h>
 #include <WebCore/RenderTheme.h>
 #include <WebCore/RenderTreeAsText.h>
 #include <WebCore/RenderView.h>
@@ -2049,7 +2050,7 @@
             coreFrame->view()->scrollBy(logicalScrollDelta);
             scrolledArea = coreFrame->view();
         } else
-            scrollableLayer->scrollByRecursively(logicalScrollDelta, &scrolledArea);
+            scrollableLayer->ensureLayerScrollableArea()->scrollByRecursively(logicalScrollDelta, &scrolledArea);
 
         if (!(UpdatePanningFeedbackPtr() && BeginPanningFeedbackPtr() && EndPanningFeedbackPtr())) {
             CloseGestureInfoHandlePtr()(gestureHandle);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to