Diff
Modified: trunk/LayoutTests/ChangeLog (246537 => 246538)
--- trunk/LayoutTests/ChangeLog 2019-06-18 14:47:41 UTC (rev 246537)
+++ trunk/LayoutTests/ChangeLog 2019-06-18 15:16:33 UTC (rev 246538)
@@ -1,3 +1,18 @@
+2019-06-18 Simon Fraser <simon.fra...@apple.com>
+
+ Convert macOS to scroll by changing layer boundsOrigin
+ https://bugs.webkit.org/show_bug.cgi?id=198917
+
+ Reviewed by Antti Koivisto.
+
+ * compositing/iframes/scrolling-iframe-expected.txt:
+ * compositing/overflow/textarea-scroll-touch-expected.txt:
+ * compositing/repaint/iframes/compositing-iframe-scroll-repaint-expected.txt:
+ * compositing/repaint/iframes/compositing-iframe-with-fixed-background-doc-repaint-expected.txt:
+ * compositing/repaint/scroller-with-foreground-layer-repaints-expected.txt:
+ * compositing/rtl/rtl-scrolling-with-transformed-descendants-expected.txt:
+ * scrollingcoordinator/scrolling-tree/fixed-inside-frame-expected.txt:
+
2019-06-18 Zan Dobersek <zdober...@igalia.com>
[WebGL] Extensions3DOpenGLES::bindVertexArrayOES() should allow zero array object
Modified: trunk/LayoutTests/compositing/iframes/scrolling-iframe-expected.txt (246537 => 246538)
--- trunk/LayoutTests/compositing/iframes/scrolling-iframe-expected.txt 2019-06-18 14:47:41 UTC (rev 246537)
+++ trunk/LayoutTests/compositing/iframes/scrolling-iframe-expected.txt 2019-06-18 15:16:33 UTC (rev 246538)
@@ -16,11 +16,11 @@
(position 43.00 43.00)
(children 1
(GraphicsLayer
+ (bounds origin 80.00 80.00)
(anchor 0.00 0.00)
(bounds 285.00 135.00)
(children 1
(GraphicsLayer
- (position -80.00 -80.00)
(anchor 0.00 0.00)
(children 1
(GraphicsLayer
Modified: trunk/LayoutTests/compositing/overflow/textarea-scroll-touch-expected.txt (246537 => 246538)
--- trunk/LayoutTests/compositing/overflow/textarea-scroll-touch-expected.txt 2019-06-18 14:47:41 UTC (rev 246537)
+++ trunk/LayoutTests/compositing/overflow/textarea-scroll-touch-expected.txt 2019-06-18 15:16:33 UTC (rev 246538)
@@ -16,12 +16,12 @@
(GraphicsLayer
(offsetFromRenderer width=1 height=1)
(position 1.00 1.00)
+ (bounds origin 0.00 50.00)
(bounds 189.00 124.00)
(children 1
(GraphicsLayer
(offsetFromRenderer width=1 height=1)
(scrollOffset (0,50))
- (position 0.00 -50.00)
(anchor 0.00 0.00)
(bounds 189.00 270.00)
(drawsContent 1)
@@ -39,12 +39,12 @@
(GraphicsLayer
(offsetFromRenderer width=1 height=1)
(position 1.00 1.00)
+ (bounds origin 0.00 50.00)
(bounds 189.00 124.00)
(children 1
(GraphicsLayer
(offsetFromRenderer width=1 height=1)
(scrollOffset (0,50))
- (position 0.00 -50.00)
(anchor 0.00 0.00)
(bounds 189.00 270.00)
(drawsContent 1)
Modified: trunk/LayoutTests/compositing/repaint/iframes/compositing-iframe-scroll-repaint-expected.txt (246537 => 246538)
--- trunk/LayoutTests/compositing/repaint/iframes/compositing-iframe-scroll-repaint-expected.txt 2019-06-18 14:47:41 UTC (rev 246537)
+++ trunk/LayoutTests/compositing/repaint/iframes/compositing-iframe-scroll-repaint-expected.txt 2019-06-18 15:16:33 UTC (rev 246538)
@@ -17,11 +17,11 @@
(position 16.00 16.00)
(children 1
(GraphicsLayer
+ (bounds origin 0.00 100.00)
(anchor 0.00 0.00)
(bounds 400.00 300.00)
(children 1
(GraphicsLayer
- (position 0.00 -100.00)
(anchor 0.00 0.00)
(children 1
(GraphicsLayer
Modified: trunk/LayoutTests/compositing/repaint/iframes/compositing-iframe-with-fixed-background-doc-repaint-expected.txt (246537 => 246538)
--- trunk/LayoutTests/compositing/repaint/iframes/compositing-iframe-with-fixed-background-doc-repaint-expected.txt 2019-06-18 14:47:41 UTC (rev 246537)
+++ trunk/LayoutTests/compositing/repaint/iframes/compositing-iframe-with-fixed-background-doc-repaint-expected.txt 2019-06-18 15:16:33 UTC (rev 246538)
@@ -17,11 +17,11 @@
(position 16.00 16.00)
(children 1
(GraphicsLayer
+ (bounds origin 0.00 100.00)
(anchor 0.00 0.00)
(bounds 400.00 300.00)
(children 1
(GraphicsLayer
- (position 0.00 -100.00)
(anchor 0.00 0.00)
(children 1
(GraphicsLayer
Modified: trunk/LayoutTests/compositing/repaint/scroller-with-foreground-layer-repaints-expected.txt (246537 => 246538)
--- trunk/LayoutTests/compositing/repaint/scroller-with-foreground-layer-repaints-expected.txt 2019-06-18 14:47:41 UTC (rev 246537)
+++ trunk/LayoutTests/compositing/repaint/scroller-with-foreground-layer-repaints-expected.txt 2019-06-18 15:16:33 UTC (rev 246538)
@@ -20,12 +20,12 @@
(GraphicsLayer
(offsetFromRenderer width=1 height=1)
(position 1.00 1.00)
+ (bounds origin 0.00 200.00)
(bounds 305.00 305.00)
(children 1
(GraphicsLayer
(offsetFromRenderer width=1 height=1)
(scrollOffset (0,200))
- (position 0.00 -200.00)
(anchor 0.00 0.00)
(bounds 305.00 1020.00)
(drawsContent 1)
Modified: trunk/LayoutTests/compositing/rtl/rtl-scrolling-with-transformed-descendants-expected.txt (246537 => 246538)
--- trunk/LayoutTests/compositing/rtl/rtl-scrolling-with-transformed-descendants-expected.txt 2019-06-18 14:47:41 UTC (rev 246537)
+++ trunk/LayoutTests/compositing/rtl/rtl-scrolling-with-transformed-descendants-expected.txt 2019-06-18 15:16:33 UTC (rev 246538)
@@ -15,12 +15,12 @@
(GraphicsLayer
(offsetFromRenderer width=2 height=2)
(position 2.00 2.00)
+ (bounds origin 366.00 0.00)
(bounds 400.00 204.00)
(children 1
(GraphicsLayer
(offsetFromRenderer width=2 height=2)
(scrollOffset (366,0))
- (position -366.00 0.00)
(anchor 0.00 0.00)
(bounds 766.00 204.00)
(drawsContent 1)
Modified: trunk/LayoutTests/platform/ios-wk2/compositing/iframes/scrolling-iframe-expected.txt (246537 => 246538)
--- trunk/LayoutTests/platform/ios-wk2/compositing/iframes/scrolling-iframe-expected.txt 2019-06-18 14:47:41 UTC (rev 246537)
+++ trunk/LayoutTests/platform/ios-wk2/compositing/iframes/scrolling-iframe-expected.txt 2019-06-18 15:16:33 UTC (rev 246538)
@@ -16,6 +16,7 @@
(position 43.00 43.00)
(children 1
(GraphicsLayer
+ (bounds origin 80.00 80.00)
(anchor 0.00 0.00)
(bounds 300.00 150.00)
(children 1
Modified: trunk/LayoutTests/platform/ios-wk2/scrollingcoordinator/scrolling-tree/fixed-inside-frame-expected.txt (246537 => 246538)
--- trunk/LayoutTests/platform/ios-wk2/scrollingcoordinator/scrolling-tree/fixed-inside-frame-expected.txt 2019-06-18 14:47:41 UTC (rev 246537)
+++ trunk/LayoutTests/platform/ios-wk2/scrollingcoordinator/scrolling-tree/fixed-inside-frame-expected.txt 2019-06-18 15:16:33 UTC (rev 246538)
@@ -63,6 +63,7 @@
(position 12.00 12.00)
(children 1
(GraphicsLayer
+ (bounds origin 0.00 120.00)
(anchor 0.00 0.00)
(bounds 480.00 400.00)
(children 1
Modified: trunk/LayoutTests/platform/mac-highsierra-wk1/compositing/repaint/iframes/compositing-iframe-scroll-repaint-expected.txt (246537 => 246538)
--- trunk/LayoutTests/platform/mac-highsierra-wk1/compositing/repaint/iframes/compositing-iframe-scroll-repaint-expected.txt 2019-06-18 14:47:41 UTC (rev 246537)
+++ trunk/LayoutTests/platform/mac-highsierra-wk1/compositing/repaint/iframes/compositing-iframe-scroll-repaint-expected.txt 2019-06-18 15:16:33 UTC (rev 246538)
@@ -21,11 +21,11 @@
(position 16.00 16.00)
(children 1
(GraphicsLayer
+ (bounds origin 0.00 100.00)
(anchor 0.00 0.00)
(bounds 400.00 300.00)
(children 1
(GraphicsLayer
- (position 0.00 -100.00)
(anchor 0.00 0.00)
(children 1
(GraphicsLayer
Modified: trunk/LayoutTests/platform/mac-highsierra-wk1/compositing/repaint/iframes/compositing-iframe-with-fixed-background-doc-repaint-expected.txt (246537 => 246538)
--- trunk/LayoutTests/platform/mac-highsierra-wk1/compositing/repaint/iframes/compositing-iframe-with-fixed-background-doc-repaint-expected.txt 2019-06-18 14:47:41 UTC (rev 246537)
+++ trunk/LayoutTests/platform/mac-highsierra-wk1/compositing/repaint/iframes/compositing-iframe-with-fixed-background-doc-repaint-expected.txt 2019-06-18 15:16:33 UTC (rev 246538)
@@ -21,11 +21,11 @@
(position 16.00 16.00)
(children 1
(GraphicsLayer
+ (bounds origin 0.00 100.00)
(anchor 0.00 0.00)
(bounds 400.00 300.00)
(children 1
(GraphicsLayer
- (position 0.00 -100.00)
(anchor 0.00 0.00)
(children 1
(GraphicsLayer
Modified: trunk/LayoutTests/platform/mac-sierra-wk1/compositing/repaint/iframes/compositing-iframe-scroll-repaint-expected.txt (246537 => 246538)
--- trunk/LayoutTests/platform/mac-sierra-wk1/compositing/repaint/iframes/compositing-iframe-scroll-repaint-expected.txt 2019-06-18 14:47:41 UTC (rev 246537)
+++ trunk/LayoutTests/platform/mac-sierra-wk1/compositing/repaint/iframes/compositing-iframe-scroll-repaint-expected.txt 2019-06-18 15:16:33 UTC (rev 246538)
@@ -20,11 +20,11 @@
(position 16.00 16.00)
(children 1
(GraphicsLayer
+ (bounds origin 0.00 100.00)
(anchor 0.00 0.00)
(bounds 400.00 300.00)
(children 1
(GraphicsLayer
- (position 0.00 -100.00)
(children 1
(GraphicsLayer
(anchor 0.00 0.00)
Modified: trunk/LayoutTests/platform/mac-wk1/compositing/repaint/iframes/compositing-iframe-scroll-repaint-expected.txt (246537 => 246538)
--- trunk/LayoutTests/platform/mac-wk1/compositing/repaint/iframes/compositing-iframe-scroll-repaint-expected.txt 2019-06-18 14:47:41 UTC (rev 246537)
+++ trunk/LayoutTests/platform/mac-wk1/compositing/repaint/iframes/compositing-iframe-scroll-repaint-expected.txt 2019-06-18 15:16:33 UTC (rev 246538)
@@ -20,11 +20,11 @@
(position 16.00 16.00)
(children 1
(GraphicsLayer
+ (bounds origin 0.00 100.00)
(anchor 0.00 0.00)
(bounds 400.00 300.00)
(children 1
(GraphicsLayer
- (position 0.00 -100.00)
(anchor 0.00 0.00)
(children 1
(GraphicsLayer
@@ -34,6 +34,12 @@
(GraphicsLayer
(bounds 400.00 1016.00)
(drawsContent 1)
+ (repaint rects
+ (rect 0.00 0.00 400.00 1016.00)
+ (rect 0.00 0.00 400.00 1016.00)
+ (rect 8.00 8.00 384.00 1000.00)
+ (rect 0.00 0.00 400.00 1016.00)
+ )
(children 1
(GraphicsLayer
(position 8.00 8.00)
Modified: trunk/LayoutTests/platform/mac-wk1/compositing/repaint/iframes/compositing-iframe-with-fixed-background-doc-repaint-expected.txt (246537 => 246538)
--- trunk/LayoutTests/platform/mac-wk1/compositing/repaint/iframes/compositing-iframe-with-fixed-background-doc-repaint-expected.txt 2019-06-18 14:47:41 UTC (rev 246537)
+++ trunk/LayoutTests/platform/mac-wk1/compositing/repaint/iframes/compositing-iframe-with-fixed-background-doc-repaint-expected.txt 2019-06-18 15:16:33 UTC (rev 246538)
@@ -20,11 +20,11 @@
(position 16.00 16.00)
(children 1
(GraphicsLayer
+ (bounds origin 0.00 100.00)
(anchor 0.00 0.00)
(bounds 400.00 300.00)
(children 1
(GraphicsLayer
- (position 0.00 -100.00)
(anchor 0.00 0.00)
(children 1
(GraphicsLayer
Modified: trunk/LayoutTests/scrollingcoordinator/scrolling-tree/fixed-inside-frame-expected.txt (246537 => 246538)
--- trunk/LayoutTests/scrollingcoordinator/scrolling-tree/fixed-inside-frame-expected.txt 2019-06-18 14:47:41 UTC (rev 246537)
+++ trunk/LayoutTests/scrollingcoordinator/scrolling-tree/fixed-inside-frame-expected.txt 2019-06-18 15:16:33 UTC (rev 246538)
@@ -65,11 +65,11 @@
(position 12.00 12.00)
(children 1
(GraphicsLayer
+ (bounds origin 0.00 120.00)
(anchor 0.00 0.00)
(bounds 465.00 400.00)
(children 1
(GraphicsLayer
- (position 0.00 -120.00)
(anchor 0.00 0.00)
(children 1
(GraphicsLayer
Modified: trunk/LayoutTests/tiled-drawing/scrolling/overflow/overflow-scrolled-down-tile-coverage-expected.txt (246537 => 246538)
--- trunk/LayoutTests/tiled-drawing/scrolling/overflow/overflow-scrolled-down-tile-coverage-expected.txt 2019-06-18 14:47:41 UTC (rev 246537)
+++ trunk/LayoutTests/tiled-drawing/scrolling/overflow/overflow-scrolled-down-tile-coverage-expected.txt 2019-06-18 15:16:33 UTC (rev 246538)
@@ -30,9 +30,10 @@
(GraphicsLayer
(offsetFromRenderer width=1 height=1)
(position 1.00 1.00)
+ (bounds origin 0.00 1800.00)
(bounds 385.00 512.00)
- (visible rect 0.00, 0.00 385.00 x 512.00)
- (coverage rect 0.00, 0.00 385.00 x 512.00)
+ (visible rect 0.00, 1800.00 385.00 x 512.00)
+ (coverage rect 0.00, 1800.00 385.00 x 512.00)
(intersects coverage rect 1)
(contentsScale 1.00)
(children 1
@@ -39,7 +40,6 @@
(GraphicsLayer
(offsetFromRenderer width=1 height=1)
(scrollOffset (0,1800))
- (position 0.00 -1800.00)
(anchor 0.00 0.00)
(bounds 385.00 3000.00)
(drawsContent 1)
Modified: trunk/LayoutTests/tiled-drawing/scrolling/overflow/overflow-scrolled-up-tile-coverage-expected.txt (246537 => 246538)
--- trunk/LayoutTests/tiled-drawing/scrolling/overflow/overflow-scrolled-up-tile-coverage-expected.txt 2019-06-18 14:47:41 UTC (rev 246537)
+++ trunk/LayoutTests/tiled-drawing/scrolling/overflow/overflow-scrolled-up-tile-coverage-expected.txt 2019-06-18 15:16:33 UTC (rev 246538)
@@ -30,9 +30,10 @@
(GraphicsLayer
(offsetFromRenderer width=1 height=1)
(position 1.00 1.00)
+ (bounds origin 0.00 200.00)
(bounds 385.00 512.00)
- (visible rect 0.00, 0.00 385.00 x 512.00)
- (coverage rect 0.00, 0.00 385.00 x 512.00)
+ (visible rect 0.00, 200.00 385.00 x 512.00)
+ (coverage rect 0.00, 200.00 385.00 x 512.00)
(intersects coverage rect 1)
(contentsScale 1.00)
(children 1
@@ -39,7 +40,6 @@
(GraphicsLayer
(offsetFromRenderer width=1 height=1)
(scrollOffset (0,200))
- (position 0.00 -200.00)
(anchor 0.00 0.00)
(bounds 385.00 3000.00)
(drawsContent 1)
Modified: trunk/Source/WebCore/ChangeLog (246537 => 246538)
--- trunk/Source/WebCore/ChangeLog 2019-06-18 14:47:41 UTC (rev 246537)
+++ trunk/Source/WebCore/ChangeLog 2019-06-18 15:16:33 UTC (rev 246538)
@@ -1,3 +1,52 @@
+2019-06-18 Simon Fraser <simon.fra...@apple.com>
+
+ Convert macOS to scroll by changing layer boundsOrigin
+ https://bugs.webkit.org/show_bug.cgi?id=198917
+
+ Reviewed by Antti Koivisto.
+
+ macOS did frame and overflow scrolling by changing the position of the scrolled
+ contents layer. iOS scrolls by changing the boundsOrigin of the scrollContainer layer
+ (which it has to, to match how UIScrollView works).
+
+ The iOS approach removes the need for an extra layer whose only role is for
+ scroll positioning, so migrate macOS to the same approach. A later patch can remove
+ m_scrolledContentsLayer.
+
+ We can remove RenderLayerCompositor::m_clipLayer since m_scrollContainerLayer has exactly
+ the same role now.
+
+ * page/scrolling/AsyncScrollingCoordinator.cpp:
+ (WebCore::AsyncScrollingCoordinator::reconcileScrollPosition):
+ * page/scrolling/ScrollingCoordinator.cpp:
+ (WebCore::ScrollingCoordinator::insetClipLayerForFrameView):
+ * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm:
+ (WebCore::ScrollingTreeFrameScrollingNodeMac::repositionScrollingLayers):
+ * page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.mm:
+ (WebCore::ScrollingTreeOverflowScrollingNodeMac::repositionScrollingLayers):
+ * platform/graphics/cocoa/WebCoreCALayerExtras.h:
+ * platform/graphics/cocoa/WebCoreCALayerExtras.mm:
+ (-[CALayer _web_setLayerBoundsOrigin:]):
+ * rendering/RenderLayerBacking.cpp:
+ (WebCore::RenderLayerBacking::updateGeometry):
+ (WebCore::RenderLayerBacking::setLocationOfScrolledContents):
+ (WebCore::RenderLayerBacking::updateScrollOffset):
+ * rendering/RenderLayerCompositor.cpp:
+ (WebCore::RenderLayerCompositor::~RenderLayerCompositor):
+ (WebCore::RenderLayerCompositor::flushPendingLayerChanges):
+ (WebCore::RenderLayerCompositor::frameViewDidChangeSize):
+ (WebCore::RenderLayerCompositor::updateLayersForScrollPosition):
+ (WebCore::RenderLayerCompositor::updateScrollContainerGeometry):
+ (WebCore::RenderLayerCompositor::frameViewDidScroll):
+ (WebCore::RenderLayerCompositor::updateRootLayerPosition):
+ (WebCore::RenderLayerCompositor::updateOverflowControlsLayers):
+ (WebCore::RenderLayerCompositor::ensureRootLayer):
+ (WebCore::RenderLayerCompositor::destroyRootLayer):
+ (WebCore::RenderLayerCompositor::updateScrollingNodeLayers):
+ (WebCore::RenderLayerCompositor::updateScrollLayerPosition): Deleted.
+ (WebCore::RenderLayerCompositor::updateScrollLayerClipping): Deleted.
+ * rendering/RenderLayerCompositor.h:
+
2019-06-18 Philippe Normand <pnorm...@igalia.com>
[GStreamer] Identify elements with monotonically increasing counters
Modified: trunk/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.cpp (246537 => 246538)
--- trunk/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.cpp 2019-06-18 14:47:41 UTC (rev 246537)
+++ trunk/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.cpp 2019-06-18 15:16:33 UTC (rev 246538)
@@ -446,24 +446,15 @@
void AsyncScrollingCoordinator::reconcileScrollPosition(FrameView& frameView, ScrollingLayerPositionAction scrollingLayerPositionAction)
{
-#if PLATFORM(IOS_FAMILY)
- // Doing all scrolling like this (UIScrollView style) would simplify code.
auto* scrollContainerLayer = scrollContainerLayerForFrameView(frameView);
if (!scrollContainerLayer)
return;
+
+ // This uses scrollPosition because the root content layer accounts for scrollOrigin (see FrameView::positionForRootContentLayer()).
if (scrollingLayerPositionAction == ScrollingLayerPositionAction::Set)
scrollContainerLayer->setBoundsOrigin(frameView.scrollPosition());
else
scrollContainerLayer->syncBoundsOrigin(frameView.scrollPosition());
-#else
- auto* scrolledContentsLayer = scrolledContentsLayerForFrameView(frameView);
- if (!scrolledContentsLayer)
- return;
- if (scrollingLayerPositionAction == ScrollingLayerPositionAction::Set)
- scrolledContentsLayer->setPosition(-frameView.scrollPosition());
- else
- scrolledContentsLayer->syncPosition(-frameView.scrollPosition());
-#endif
}
void AsyncScrollingCoordinator::scrollableAreaScrollbarLayerDidChange(ScrollableArea& scrollableArea, ScrollbarOrientation orientation)
Modified: trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.cpp (246537 => 246538)
--- trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.cpp 2019-06-18 14:47:41 UTC (rev 246537)
+++ trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.cpp 2019-06-18 15:16:33 UTC (rev 246538)
@@ -272,7 +272,7 @@
GraphicsLayer* ScrollingCoordinator::insetClipLayerForFrameView(FrameView& frameView)
{
if (auto* renderView = frameView.frame().contentRenderer())
- return renderView->compositor().clipLayer();
+ return renderView->compositor().scrollContainerLayer();
return nullptr;
}
Modified: trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm (246537 => 246538)
--- trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm 2019-06-18 14:47:41 UTC (rev 246537)
+++ trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm 2019-06-18 15:16:33 UTC (rev 246538)
@@ -199,7 +199,8 @@
void ScrollingTreeFrameScrollingNodeMac::repositionScrollingLayers()
{
- scrolledContentsLayer().position = -currentScrollPosition();
+ // We use scroll position here because the root content layer is offset to account for scrollOrigin (see FrameView::positionForRootContentLayer).
+ [scrollContainerLayer() _web_setLayerBoundsOrigin:currentScrollPosition()];
}
void ScrollingTreeFrameScrollingNodeMac::repositionRelatedLayers()
Modified: trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.mm (246537 => 246538)
--- trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.mm 2019-06-18 14:47:41 UTC (rev 246537)
+++ trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.mm 2019-06-18 15:16:33 UTC (rev 246538)
@@ -31,6 +31,7 @@
#import "Logging.h"
#import "ScrollingStateOverflowScrollingNode.h"
#import "ScrollingTree.h"
+#import "WebCoreCALayerExtras.h"
#import <wtf/text/TextStream.h>
namespace WebCore {
@@ -91,7 +92,7 @@
void ScrollingTreeOverflowScrollingNodeMac::repositionScrollingLayers()
{
auto scrollOffset = ScrollableArea::scrollOffsetFromPosition(currentScrollPosition(), toFloatSize(scrollOrigin()));
- scrolledContentsLayer().position = -scrollOffset;
+ [scrollContainerLayer() _web_setLayerBoundsOrigin:scrollOffset];
}
void ScrollingTreeOverflowScrollingNodeMac::repositionRelatedLayers()
Modified: trunk/Source/WebCore/platform/graphics/cocoa/WebCoreCALayerExtras.h (246537 => 246538)
--- trunk/Source/WebCore/platform/graphics/cocoa/WebCoreCALayerExtras.h 2019-06-18 14:47:41 UTC (rev 246537)
+++ trunk/Source/WebCore/platform/graphics/cocoa/WebCoreCALayerExtras.h 2019-06-18 15:16:33 UTC (rev 246538)
@@ -28,6 +28,7 @@
@interface CALayer (WebCoreCALayerExtras)
- (void)web_disableAllActions;
+- (void)_web_setLayerBoundsOrigin:(CGPoint)origin;
- (void)_web_setLayerTopLeftPosition:(CGPoint)position;
+ (CALayer *)_web_renderLayerWithContextID:(uint32_t)contextID;
Modified: trunk/Source/WebCore/platform/graphics/cocoa/WebCoreCALayerExtras.mm (246537 => 246538)
--- trunk/Source/WebCore/platform/graphics/cocoa/WebCoreCALayerExtras.mm 2019-06-18 14:47:41 UTC (rev 246537)
+++ trunk/Source/WebCore/platform/graphics/cocoa/WebCoreCALayerExtras.mm 2019-06-18 15:16:33 UTC (rev 246538)
@@ -56,6 +56,13 @@
};
}
+- (void)_web_setLayerBoundsOrigin:(CGPoint)origin
+{
+ CGRect bounds = [self bounds];
+ bounds.origin = origin;
+ [self setBounds:bounds];
+}
+
- (void)_web_setLayerTopLeftPosition:(CGPoint)position
{
CGSize layerSize = [self bounds].size;
Modified: trunk/Source/WebCore/rendering/RenderLayerBacking.cpp (246537 => 246538)
--- trunk/Source/WebCore/rendering/RenderLayerBacking.cpp 2019-06-18 14:47:41 UTC (rev 246537)
+++ trunk/Source/WebCore/rendering/RenderLayerBacking.cpp 2019-06-18 15:16:33 UTC (rev 246538)
@@ -1225,9 +1225,6 @@
ScrollOffset scrollOffset = m_owningLayer.scrollOffset();
updateScrollOffset(scrollOffset);
-#if PLATFORM(IOS_FAMILY)
- m_scrolledContentsLayer->setPosition({ }); // FIXME: necessary?
-#endif
FloatSize oldScrollingLayerOffset = m_scrollContainerLayer->offsetFromRenderer();
m_scrollContainerLayer->setOffsetFromRenderer(toFloatSize(paddingBox.location()));
@@ -1306,17 +1303,10 @@
void RenderLayerBacking::setLocationOfScrolledContents(ScrollOffset scrollOffset, ScrollingLayerPositionAction setOrSync)
{
-#if PLATFORM(IOS_FAMILY)
if (setOrSync == ScrollingLayerPositionAction::Sync)
m_scrollContainerLayer->syncBoundsOrigin(scrollOffset);
else
m_scrollContainerLayer->setBoundsOrigin(scrollOffset);
-#else
- if (setOrSync == ScrollingLayerPositionAction::Sync)
- m_scrolledContentsLayer->syncPosition(-scrollOffset);
- else
- m_scrolledContentsLayer->setPosition(-scrollOffset);
-#endif
}
void RenderLayerBacking::updateScrollOffset(ScrollOffset scrollOffset)
@@ -1330,6 +1320,8 @@
setLocationOfScrolledContents(scrollOffset, ScrollingLayerPositionAction::Set);
m_owningLayer.setRequiresScrollPositionReconciliation(false);
}
+
+ ASSERT(m_scrolledContentsLayer->position().isZero());
}
void RenderLayerBacking::updateAfterDescendants()
Modified: trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp (246537 => 246538)
--- trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp 2019-06-18 14:47:41 UTC (rev 246537)
+++ trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp 2019-06-18 15:16:33 UTC (rev 246538)
@@ -301,7 +301,6 @@
// Take care that the owned GraphicsLayers are deleted first as their destructors may call back here.
GraphicsLayer::unparentAndClear(m_rootContentsLayer);
- GraphicsLayer::unparentAndClear(m_clipLayer);
GraphicsLayer::unparentAndClear(m_scrollContainerLayer);
GraphicsLayer::unparentAndClear(m_scrolledContentsLayer);
@@ -521,7 +520,7 @@
#if ENABLE(TREE_DEBUGGING)
if (layersLogEnabled()) {
LOG(Layers, "RenderLayerCompositor::flushPendingLayerChanges");
- showGraphicsLayerTree(m_rootContentsLayer.get());
+ showGraphicsLayerTree(m_overflowControlsHostLayer.get());
}
#endif
}
@@ -1969,7 +1968,7 @@
layer->setNeedsCompositingGeometryUpdate();
if (m_scrolledContentsLayer) {
- updateScrollLayerClipping();
+ updateScrollContainerGeometry();
frameViewDidScroll();
updateOverflowControlsLayers();
@@ -1989,28 +1988,26 @@
return scrollingCoordinator && scrollingCoordinator->coordinatesScrollingForFrameView(m_renderView.frameView());
}
-void RenderLayerCompositor::updateScrollLayerPosition()
+void RenderLayerCompositor::updateLayersForScrollPosition()
{
ASSERT(!hasCoordinatedScrolling());
- ASSERT(m_scrolledContentsLayer);
+ ASSERT(m_scrollContainerLayer);
auto& frameView = m_renderView.frameView();
- IntPoint scrollPosition = frameView.scrollPosition();
+ // This uses scrollPosition because the root content layer accounts for scrollOrigin (see FrameView::positionForRootContentLayer()).
+ m_scrollContainerLayer->setBoundsOrigin(frameView.scrollPosition());
- m_scrolledContentsLayer->setPosition(FloatPoint(-scrollPosition.x(), -scrollPosition.y()));
-
if (auto* fixedBackgroundLayer = fixedRootBackgroundLayer())
fixedBackgroundLayer->setPosition(frameView.scrollPositionForFixedPosition());
}
-void RenderLayerCompositor::updateScrollLayerClipping()
+void RenderLayerCompositor::updateScrollContainerGeometry()
{
- auto* layerForClipping = this->layerForClipping();
- if (!layerForClipping)
+ if (!m_scrollContainerLayer)
return;
- layerForClipping->setSize(m_renderView.frameView().sizeForVisibleContent());
- layerForClipping->setPosition(positionForClipLayer());
+ m_scrollContainerLayer->setSize(m_renderView.frameView().sizeForVisibleContent());
+ m_scrollContainerLayer->setPosition(positionForClipLayer());
}
FloatPoint RenderLayerCompositor::positionForClipLayer() const
@@ -2035,7 +2032,7 @@
return;
}
- updateScrollLayerPosition();
+ updateLayersForScrollPosition();
}
void RenderLayerCompositor::frameViewDidAddOrRemoveScrollbars()
@@ -2252,10 +2249,10 @@
if (m_rootContentsLayer) {
m_rootContentsLayer->setSize(m_renderView.frameView().contentsSize());
m_rootContentsLayer->setPosition(m_renderView.frameView().positionForRootContentLayer());
- m_rootContentsLayer->setAnchorPoint(FloatPoint3D());
+ m_rootContentsLayer->setAnchorPoint({ });
}
- updateScrollLayerClipping();
+ updateScrollContainerGeometry();
#if ENABLE(RUBBER_BANDING)
if (m_contentShadowLayer && m_rootContentsLayer) {
@@ -3682,7 +3679,7 @@
// We want the overhang areas layer to be positioned below the frame contents,
// so insert it below the clip layer.
- m_overflowControlsHostLayer->addChildBelow(*m_layerForOverhangAreas, layerForClipping());
+ m_overflowControlsHostLayer->addChildBelow(*m_layerForOverhangAreas, m_scrollContainerLayer.get());
}
} else
GraphicsLayer::unparentAndClear(m_layerForOverhangAreas);
@@ -3772,7 +3769,7 @@
m_rootContentsLayer->setName("content root");
IntRect overflowRect = snappedIntRect(m_renderView.layoutOverflowRect());
m_rootContentsLayer->setSize(FloatSize(overflowRect.maxX(), overflowRect.maxY()));
- m_rootContentsLayer->setPosition(FloatPoint());
+ m_rootContentsLayer->setPosition({ });
#if PLATFORM(IOS_FAMILY)
// Page scale is applied above this on iOS, so we'll just say that our root layer applies it.
@@ -3788,52 +3785,35 @@
if (requiresScrollLayer(expectedAttachment)) {
if (!m_overflowControlsHostLayer) {
ASSERT(!m_scrolledContentsLayer);
- ASSERT(!m_clipLayer);
// Create a layer to host the clipping layer and the overflow controls layers.
m_overflowControlsHostLayer = GraphicsLayer::create(graphicsLayerFactory(), *this);
m_overflowControlsHostLayer->setName("overflow controls host");
+ m_scrollContainerLayer = GraphicsLayer::create(graphicsLayerFactory(), *this, GraphicsLayer::Type::ScrollContainer);
+ m_scrollContainerLayer->setName("scroll container");
+ m_scrollContainerLayer->setMasksToBounds(true);
+ m_scrollContainerLayer->setAnchorPoint({ });
+
m_scrolledContentsLayer = GraphicsLayer::create(graphicsLayerFactory(), *this, GraphicsLayer::Type::ScrolledContents);
m_scrolledContentsLayer->setName("scrolled contents");
m_scrolledContentsLayer->setAnchorPoint({ });
-#if PLATFORM(IOS_FAMILY)
- if (m_renderView.settings().asyncFrameScrollingEnabled()) {
- m_scrollContainerLayer = GraphicsLayer::create(graphicsLayerFactory(), *this, GraphicsLayer::Type::ScrollContainer);
-
- m_scrollContainerLayer->setName("scroll container");
- m_scrollContainerLayer->setMasksToBounds(true);
- m_scrollContainerLayer->setAnchorPoint({ });
-
- m_scrollContainerLayer->addChild(*m_scrolledContentsLayer);
- m_overflowControlsHostLayer->addChild(*m_scrollContainerLayer);
- }
-#endif
- if (!m_scrollContainerLayer) {
- m_clipLayer = GraphicsLayer::create(graphicsLayerFactory(), *this);
- m_clipLayer->setName("frame clipping");
- m_clipLayer->setMasksToBounds(true);
- m_clipLayer->setAnchorPoint({ });
-
- m_clipLayer->addChild(*m_scrolledContentsLayer);
- m_overflowControlsHostLayer->addChild(*m_clipLayer);
- }
-
+ m_overflowControlsHostLayer->addChild(*m_scrollContainerLayer);
+ m_scrollContainerLayer->addChild(*m_scrolledContentsLayer);
m_scrolledContentsLayer->addChild(*m_rootContentsLayer);
- updateScrollLayerClipping();
+ updateScrollContainerGeometry();
updateOverflowControlsLayers();
if (hasCoordinatedScrolling())
scheduleLayerFlush(true);
else
- updateScrollLayerPosition();
+ updateLayersForScrollPosition();
}
} else {
if (m_overflowControlsHostLayer) {
GraphicsLayer::unparentAndClear(m_overflowControlsHostLayer);
- GraphicsLayer::unparentAndClear(m_clipLayer);
GraphicsLayer::unparentAndClear(m_scrollContainerLayer);
GraphicsLayer::unparentAndClear(m_scrolledContentsLayer);
}
@@ -3880,7 +3860,6 @@
if (m_overflowControlsHostLayer) {
GraphicsLayer::unparentAndClear(m_overflowControlsHostLayer);
- GraphicsLayer::unparentAndClear(m_clipLayer);
GraphicsLayer::unparentAndClear(m_scrollContainerLayer);
GraphicsLayer::unparentAndClear(m_scrolledContentsLayer);
}
@@ -4320,7 +4299,7 @@
FrameView& frameView = m_renderView.frameView();
scrollingCoordinator.setNodeLayers(nodeID, { nullptr,
scrollContainerLayer(), scrolledContentsLayer(),
- fixedRootBackgroundLayer(), clipLayer(), rootContentsLayer(),
+ fixedRootBackgroundLayer(), nullptr, rootContentsLayer(),
frameView.layerForHorizontalScrollbar(), frameView.layerForVerticalScrollbar() });
} else {
auto& backing = *layer.backing();
Modified: trunk/Source/WebCore/rendering/RenderLayerCompositor.h (246537 => 246538)
--- trunk/Source/WebCore/rendering/RenderLayerCompositor.h 2019-06-18 14:47:41 UTC (rev 246537)
+++ trunk/Source/WebCore/rendering/RenderLayerCompositor.h 2019-06-18 15:16:33 UTC (rev 246538)
@@ -246,11 +246,8 @@
GraphicsLayer* scrollContainerLayer() const { return m_scrollContainerLayer.get(); }
GraphicsLayer* scrolledContentsLayer() const { return m_scrolledContentsLayer.get(); }
- GraphicsLayer* clipLayer() const { return m_clipLayer.get(); }
GraphicsLayer* rootContentsLayer() const { return m_rootContentsLayer.get(); }
- GraphicsLayer* layerForClipping() const { return m_clipLayer ? m_clipLayer.get() : m_scrollContainerLayer.get(); }
-
#if ENABLE(RUBBER_BANDING)
GraphicsLayer* headerLayer() const { return m_layerForHeader.get(); }
GraphicsLayer* footerLayer() const { return m_layerForFooter.get(); }
@@ -440,8 +437,8 @@
void updateOverflowControlsLayers();
- void updateScrollLayerPosition();
- void updateScrollLayerClipping();
+ void updateLayersForScrollPosition();
+ void updateScrollContainerGeometry();
FloatPoint positionForClipLayer() const;
@@ -574,7 +571,6 @@
RefPtr<GraphicsLayer> m_rootContentsLayer;
// Enclosing clipping layer for iframe content
- RefPtr<GraphicsLayer> m_clipLayer;
RefPtr<GraphicsLayer> m_scrollContainerLayer;
RefPtr<GraphicsLayer> m_scrolledContentsLayer;
Modified: trunk/Source/WebKit/ChangeLog (246537 => 246538)
--- trunk/Source/WebKit/ChangeLog 2019-06-18 14:47:41 UTC (rev 246537)
+++ trunk/Source/WebKit/ChangeLog 2019-06-18 15:16:33 UTC (rev 246538)
@@ -1,3 +1,15 @@
+2019-06-18 Simon Fraser <simon.fra...@apple.com>
+
+ Convert macOS to scroll by changing layer boundsOrigin
+ https://bugs.webkit.org/show_bug.cgi?id=198917
+
+ Reviewed by Antti Koivisto.
+
+ Remove unreached and confusing code.
+
+ * UIProcess/RemoteLayerTree/ios/ScrollingTreeFrameScrollingNodeRemoteIOS.mm:
+ (WebKit::ScrollingTreeFrameScrollingNodeRemoteIOS::repositionScrollingLayers):
+
2019-06-18 Dean Jackson <d...@apple.com>
Attachment elements are missing context menu previews
Modified: trunk/Source/WebKit/UIProcess/RemoteLayerTree/ios/ScrollingTreeFrameScrollingNodeRemoteIOS.mm (246537 => 246538)
--- trunk/Source/WebKit/UIProcess/RemoteLayerTree/ios/ScrollingTreeFrameScrollingNodeRemoteIOS.mm 2019-06-18 14:47:41 UTC (rev 246537)
+++ trunk/Source/WebKit/UIProcess/RemoteLayerTree/ios/ScrollingTreeFrameScrollingNodeRemoteIOS.mm 2019-06-18 15:16:33 UTC (rev 246538)
@@ -122,9 +122,7 @@
return;
}
- auto scrollPosition = currentScrollPosition();
- // FIXME: This is always wrong on iOS. Maybe assert that we always have a delegate.
- [scrolledContentsLayer() setPosition:-scrollPosition];
+ // Main frame scrolling is handled by the main UIScrollView.
}
void ScrollingTreeFrameScrollingNodeRemoteIOS::repositionRelatedLayers()