WebKit Bugzilla
Attachment 340071 Details for
Bug 183040
: Separate paint and scroll offsets for RenderLayerBacking::m_scrollingContentsLayer
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
0003-Bug-183040-Separate-paint-and-scroll-offsets-for-Ren.patch (text/plain), 13.56 KB, created by
Frédéric Wang (:fredw)
on 2018-05-09 23:33:34 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Frédéric Wang (:fredw)
Created:
2018-05-09 23:33:34 PDT
Size:
13.56 KB
patch
obsolete
>From 6e307eeaaaebcd58159dd5eb0a99c0ed610e5791 Mon Sep 17 00:00:00 2001 >From: Frederic Wang <fwang@igalia.com> >Date: Thu, 22 Feb 2018 17:49:38 +0100 >Subject: [PATCH xserver 3/4] Bug 183040 - Separate paint and scroll offsets > for RenderLayerBacking::m_scrollingContentsLayer > >--- > .../overflow-scroll-touch-tiles-expected.txt | 3 ++- > .../ios/overflow-scroll-touch-expected.txt | 6 ++++-- > ...verflow-scrolling-with-ancestor-expected.txt | 2 +- > ...ng-with-transformed-descendants-expected.txt | 3 ++- > ...verflow-scrolling-ancestor-clip-expected.txt | 3 ++- > ...ow-scrolling-ancestor-clip-size-expected.txt | 3 ++- > .../ios/textarea-scroll-touch-expected.txt | 6 ++++-- > .../WebCore/platform/graphics/GraphicsLayer.cpp | 17 ++++++++++++++++- > .../WebCore/platform/graphics/GraphicsLayer.h | 8 ++++++++ > Source/WebCore/rendering/RenderLayerBacking.cpp | 16 +++++++--------- > 10 files changed, 48 insertions(+), 19 deletions(-) > >diff --git a/LayoutTests/compositing/ios/overflow-scroll-touch-tiles-expected.txt b/LayoutTests/compositing/ios/overflow-scroll-touch-tiles-expected.txt >index 31732c68f68..068adce53c8 100644 >--- a/LayoutTests/compositing/ios/overflow-scroll-touch-tiles-expected.txt >+++ b/LayoutTests/compositing/ios/overflow-scroll-touch-tiles-expected.txt >@@ -62,7 +62,8 @@ > (bounds 400.00 300.00) > (children 1 > (GraphicsLayer >- (offsetFromRenderer width=2 height=-238) >+ (offsetFromRenderer width=2 height=2) >+ (scrollOffset (0,240)) > (bounds 400.00 2002.00) > (usingTiledLayer 1) > (drawsContent 1) >diff --git a/LayoutTests/fast/scrolling/ios/overflow-scroll-touch-expected.txt b/LayoutTests/fast/scrolling/ios/overflow-scroll-touch-expected.txt >index 9af741822a4..765dc6f6569 100644 >--- a/LayoutTests/fast/scrolling/ios/overflow-scroll-touch-expected.txt >+++ b/LayoutTests/fast/scrolling/ios/overflow-scroll-touch-expected.txt >@@ -21,7 +21,8 @@ > (bounds 200.00 200.00) > (children 1 > (GraphicsLayer >- (offsetFromRenderer width=1 height=-49) >+ (offsetFromRenderer width=1 height=1) >+ (scrollOffset (0,50)) > (bounds 200.00 400.00) > (drawsContent 1) > ) >@@ -41,7 +42,8 @@ > (bounds 200.00 200.00) > (children 1 > (GraphicsLayer >- (offsetFromRenderer width=1 height=-49) >+ (offsetFromRenderer width=1 height=1) >+ (scrollOffset (0,50)) > (bounds 200.00 400.00) > (drawsContent 1) > ) >diff --git a/LayoutTests/fast/scrolling/ios/subpixel-overflow-scrolling-with-ancestor-expected.txt b/LayoutTests/fast/scrolling/ios/subpixel-overflow-scrolling-with-ancestor-expected.txt >index f612e209706..828928400c2 100644 >--- a/LayoutTests/fast/scrolling/ios/subpixel-overflow-scrolling-with-ancestor-expected.txt >+++ b/LayoutTests/fast/scrolling/ios/subpixel-overflow-scrolling-with-ancestor-expected.txt >@@ -15,7 +15,7 @@ > (bounds 300.00 400.00) > (children 1 > (GraphicsLayer >- (offsetFromRenderer width=0 height=-30) >+ (scrollOffset (0,30)) > (bounds 300.00 900.00) > (drawsContent 1) > (children 1 >diff --git a/LayoutTests/platform/ios/compositing/rtl/rtl-scrolling-with-transformed-descendants-expected.txt b/LayoutTests/platform/ios/compositing/rtl/rtl-scrolling-with-transformed-descendants-expected.txt >index 0c6acbb8a9e..f6d8175091a 100644 >--- a/LayoutTests/platform/ios/compositing/rtl/rtl-scrolling-with-transformed-descendants-expected.txt >+++ b/LayoutTests/platform/ios/compositing/rtl/rtl-scrolling-with-transformed-descendants-expected.txt >@@ -19,7 +19,8 @@ > (bounds 400.00 205.00) > (children 1 > (GraphicsLayer >- (offsetFromRenderer width=-364 height=2) >+ (offsetFromRenderer width=2 height=2) >+ (scrollOffset (366,0)) > (bounds 766.00 205.00) > (drawsContent 1) > (children 1 >diff --git a/LayoutTests/platform/ios/fast/scrolling/ios/overflow-scrolling-ancestor-clip-expected.txt b/LayoutTests/platform/ios/fast/scrolling/ios/overflow-scrolling-ancestor-clip-expected.txt >index cefeb188742..5c20344365c 100644 >--- a/LayoutTests/platform/ios/fast/scrolling/ios/overflow-scrolling-ancestor-clip-expected.txt >+++ b/LayoutTests/platform/ios/fast/scrolling/ios/overflow-scrolling-ancestor-clip-expected.txt >@@ -18,7 +18,8 @@ > (bounds 300.00 400.00) > (children 1 > (GraphicsLayer >- (offsetFromRenderer width=1 height=-29) >+ (offsetFromRenderer width=1 height=1) >+ (scrollOffset (0,30)) > (bounds 300.00 900.00) > (drawsContent 1) > (children 1 >diff --git a/LayoutTests/platform/ios/fast/scrolling/ios/overflow-scrolling-ancestor-clip-size-expected.txt b/LayoutTests/platform/ios/fast/scrolling/ios/overflow-scrolling-ancestor-clip-size-expected.txt >index 2f2a3d21626..ff20cafe545 100644 >--- a/LayoutTests/platform/ios/fast/scrolling/ios/overflow-scrolling-ancestor-clip-size-expected.txt >+++ b/LayoutTests/platform/ios/fast/scrolling/ios/overflow-scrolling-ancestor-clip-size-expected.txt >@@ -18,7 +18,8 @@ > (bounds 300.00 400.00) > (children 1 > (GraphicsLayer >- (offsetFromRenderer width=11 height=-19) >+ (offsetFromRenderer width=11 height=11) >+ (scrollOffset (0,30)) > (bounds 300.00 900.00) > (drawsContent 1) > (children 1 >diff --git a/LayoutTests/platform/ios/fast/scrolling/ios/textarea-scroll-touch-expected.txt b/LayoutTests/platform/ios/fast/scrolling/ios/textarea-scroll-touch-expected.txt >index 70b74c8f462..a89c9927feb 100644 >--- a/LayoutTests/platform/ios/fast/scrolling/ios/textarea-scroll-touch-expected.txt >+++ b/LayoutTests/platform/ios/fast/scrolling/ios/textarea-scroll-touch-expected.txt >@@ -19,7 +19,8 @@ > (bounds 204.00 124.00) > (children 1 > (GraphicsLayer >- (offsetFromRenderer width=1 height=-49) >+ (offsetFromRenderer width=1 height=1) >+ (scrollOffset (0,50)) > (bounds 204.00 270.00) > (drawsContent 1) > ) >@@ -40,7 +41,8 @@ > (bounds 204.00 124.00) > (children 1 > (GraphicsLayer >- (offsetFromRenderer width=1 height=-49) >+ (offsetFromRenderer width=1 height=1) >+ (scrollOffset (0,50)) > (bounds 204.00 270.00) > (drawsContent 1) > ) >diff --git a/Source/WebCore/platform/graphics/GraphicsLayer.cpp b/Source/WebCore/platform/graphics/GraphicsLayer.cpp >index 698180e6b22..e6c521c6b85 100644 >--- a/Source/WebCore/platform/graphics/GraphicsLayer.cpp >+++ b/Source/WebCore/platform/graphics/GraphicsLayer.cpp >@@ -407,6 +407,18 @@ void GraphicsLayer::setOffsetFromRenderer(const FloatSize& offset, ShouldSetNeed > setNeedsDisplay(); > } > >+void GraphicsLayer::setScrollOffset(const ScrollOffset& offset, ShouldSetNeedsDisplay shouldSetNeedsDisplay) >+{ >+ if (offset == m_scrollOffset) >+ return; >+ >+ m_scrollOffset = offset; >+ >+ // If the compositing layer offset changes, we need to repaint. >+ if (shouldSetNeedsDisplay == SetNeedsDisplay) >+ setNeedsDisplay(); >+} >+ > void GraphicsLayer::setSize(const FloatSize& size) > { > if (size == m_size) >@@ -425,7 +437,7 @@ void GraphicsLayer::setBackgroundColor(const Color& color) > > void GraphicsLayer::paintGraphicsLayerContents(GraphicsContext& context, const FloatRect& clip, GraphicsLayerPaintBehavior layerPaintBehavior) > { >- FloatSize offset = offsetFromRenderer(); >+ FloatSize offset = offsetFromRenderer() - toFloatSize(scrollOffset()); > context.translate(-offset); > > FloatRect clipRect(clip); >@@ -726,6 +738,9 @@ void GraphicsLayer::dumpProperties(TextStream& ts, LayerTreeAsTextBehavior behav > if (!m_offsetFromRenderer.isZero()) > ts << indent << "(offsetFromRenderer " << m_offsetFromRenderer << ")\n"; > >+ if (!m_scrollOffset.isZero()) >+ ts << indent << "(scrollOffset " << m_scrollOffset << ")\n"; >+ > if (m_position != FloatPoint()) > ts << indent << "(position " << m_position.x() << " " << m_position.y() << ")\n"; > >diff --git a/Source/WebCore/platform/graphics/GraphicsLayer.h b/Source/WebCore/platform/graphics/GraphicsLayer.h >index 558cdb122c1..d965560e1ee 100644 >--- a/Source/WebCore/platform/graphics/GraphicsLayer.h >+++ b/Source/WebCore/platform/graphics/GraphicsLayer.h >@@ -35,6 +35,7 @@ > #include "GraphicsLayerClient.h" > #include "Path.h" > #include "PlatformLayer.h" >+#include "ScrollableArea.h" > #include "TransformOperations.h" > #include "WindRule.h" > #include <wtf/Function.h> >@@ -312,6 +313,10 @@ public: > FloatSize offsetFromRenderer() const { return m_offsetFromRenderer; } > void setOffsetFromRenderer(const FloatSize&, ShouldSetNeedsDisplay = SetNeedsDisplay); > >+ // Scroll offset of the content layer inside its scrolling parent layer. >+ ScrollOffset scrollOffset() const { return m_scrollOffset; } >+ void setScrollOffset(const ScrollOffset&, ShouldSetNeedsDisplay = SetNeedsDisplay); >+ > // The position of the layer (the location of its top-left corner in its parent) > const FloatPoint& position() const { return m_position; } > virtual void setPosition(const FloatPoint& p) { m_approximatePosition = std::nullopt; m_position = p; } >@@ -621,6 +626,9 @@ protected: > // Offset from the owning renderer > FloatSize m_offsetFromRenderer; > >+ // Scroll offset of the content layer inside its scrolling parent layer. >+ ScrollOffset m_scrollOffset; >+ > // Position is relative to the parent GraphicsLayer > FloatPoint m_position; > >diff --git a/Source/WebCore/rendering/RenderLayerBacking.cpp b/Source/WebCore/rendering/RenderLayerBacking.cpp >index 160a5313789..e609d9ef6e3 100644 >--- a/Source/WebCore/rendering/RenderLayerBacking.cpp >+++ b/Source/WebCore/rendering/RenderLayerBacking.cpp >@@ -1171,9 +1171,8 @@ void RenderLayerBacking::updateGeometry() > > m_scrollingContentsLayer->setSize(scrollSize); > // Scrolling the content layer does not need to trigger a repaint. The offset will be compensated away during painting. >- // FIXME: The paint offset and the scroll offset should really be separate concepts. >- LayoutSize scrollingContentsOffset = toLayoutSize(paddingBox.location() - toLayoutSize(scrollOffset)); >- m_scrollingContentsLayer->setOffsetFromRenderer(scrollingContentsOffset, GraphicsLayer::DontSetNeedsDisplay); >+ m_scrollingContentsLayer->setScrollOffset(scrollOffset, GraphicsLayer::DontSetNeedsDisplay); >+ m_scrollingContentsLayer->setOffsetFromRenderer(toLayoutSize(paddingBox.location()), GraphicsLayer::DontSetNeedsDisplay); > #else > m_scrollingContentsLayer->setPosition(-scrollOffset); > >@@ -1192,18 +1191,17 @@ void RenderLayerBacking::updateGeometry() > if (scrollSize != m_scrollingContentsLayer->size() || paddingBoxOffsetChanged) > m_scrollingContentsLayer->setNeedsDisplay(); > >- LayoutSize scrollingContentsOffset = toLayoutSize(paddingBox.location() - toLayoutSize(scrollOffset)); >- if (scrollingContentsOffset != m_scrollingContentsLayer->offsetFromRenderer() || scrollSize != m_scrollingContentsLayer->size()) >+ if (toLayoutSize(paddingBox.location()) != m_scrollingContentsLayer->offsetFromRenderer() || scrollOffset != m_scrollingContentsLayer->scrollOffset() || scrollSize != m_scrollingContentsLayer->size()) > compositor().scrollingLayerDidChange(m_owningLayer); > > m_scrollingContentsLayer->setSize(scrollSize); >- // FIXME: The paint offset and the scroll offset should really be separate concepts. >- m_scrollingContentsLayer->setOffsetFromRenderer(scrollingContentsOffset, GraphicsLayer::DontSetNeedsDisplay); >+ m_scrollingContentsLayer->setScrollOffset(scrollOffset, GraphicsLayer::DontSetNeedsDisplay); >+ m_scrollingContentsLayer->setOffsetFromRenderer(toLayoutSize(paddingBox.location()), GraphicsLayer::DontSetNeedsDisplay); > #endif > > if (m_foregroundLayer) { > m_foregroundLayer->setSize(m_scrollingContentsLayer->size()); >- m_foregroundLayer->setOffsetFromRenderer(m_scrollingContentsLayer->offsetFromRenderer()); >+ m_foregroundLayer->setOffsetFromRenderer(m_scrollingContentsLayer->offsetFromRenderer() - toLayoutSize(m_scrollingContentsLayer->scrollOffset())); > } > } > >@@ -2479,7 +2477,7 @@ void RenderLayerBacking::setContentsNeedDisplayInRect(const LayoutRect& r, Graph > > if (m_scrollingContentsLayer && m_scrollingContentsLayer->drawsContent()) { > FloatRect layerDirtyRect = pixelSnappedRectForPainting; >- layerDirtyRect.move(-m_scrollingContentsLayer->offsetFromRenderer() - m_subpixelOffsetFromRenderer); >+ layerDirtyRect.move(-m_scrollingContentsLayer->offsetFromRenderer() + toLayoutSize(m_scrollingContentsLayer->scrollOffset()) - m_subpixelOffsetFromRenderer); > #if PLATFORM(IOS) > // Account for the fact that RenderLayerBacking::updateGeometry() bakes scrollOffset into offsetFromRenderer on iOS, > // but the repaint rect is computed without taking the scroll position into account (see shouldApplyClipAndScrollPositionForRepaint()). >-- >2.17.0 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 183040
:
334454
|
340071
|
348912
|
354929
|
354943
|
354956
|
355336
|
355474
|
356130