- Revision
- 240897
- Author
- [email protected]
- Date
- 2019-02-02 11:09:18 -0800 (Sat, 02 Feb 2019)
Log Message
Async overflow scroll is jumpy on macOS if the main thread is busy
https://bugs.webkit.org/show_bug.cgi?id=194184
<rdar://problem/47758655>
Reviewed by Antti Koivisto.
This change extends to macOS some existing overflow-scroll functionality for iOS.
When an async scroll is in process in the scroll thread (or UI process), we periodically
message back to the web process main thread with scroll position updates. These
can trigger post-scroll compositing updates, but we need to ensure that this update
doesn't clobber the scroll position of the native layers, which would trigger
stutters.
To do this we have the notion of a scroll position "sync" (ScrollingLayerPositionAction::Sync) which
pokes the new value into the GraphicsLayer (hence making visible rect computations work), but doesn't
propagate it to the platform layer. This patch wires up syncs for macOS during async overflow scrolling,
coming out of AsyncScrollingCoordinator::updateScrollPositionAfterAsyncScroll().
In RenderLayerBacking, m_scrollingContentsLayer is renamed to m_scrolledContentsLayer, and I added
updateScrollOffset() and setLocationOfScrolledContents() to handle the set vs. sync, and to keep
the iOS vs macOS differences in one function. This allows for more code sharing in RenderLayerBacking::updateGeometry().
There's a confusing bit in the m_childClippingMaskLayer code (trac.webkit.org/178029) where the setOffsetFromRenderer()
just looks wrong; it should match m_scrollingLayer. This code is never hit for Cocoa, which never has m_childClippingMaskLayer.
* page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.mm:
(WebCore::ScrollingTreeOverflowScrollingNodeMac::setScrollPosition): Logging
(WebCore::ScrollingTreeOverflowScrollingNodeMac::setScrollLayerPosition): Logging
* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::RenderLayer):
(WebCore::RenderLayer::scrollTo):
* rendering/RenderLayer.h: Rename m_requiresScrollBoundsOriginUpdate to m_requiresScrollPositionReconciliation
and make it available on all platforms. Just reorder m_adjustForIOSCaretWhenScrolling to reduce #ifdef nesting confusion.
* rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::updateDebugIndicators):
(WebCore::RenderLayerBacking::destroyGraphicsLayers):
(WebCore::RenderLayerBacking::updateGeometry):
(WebCore::RenderLayerBacking::setLocationOfScrolledContents):
(WebCore::RenderLayerBacking::updateScrollOffset):
(WebCore::RenderLayerBacking::updateDrawsContent):
(WebCore::RenderLayerBacking::updateScrollingLayers):
(WebCore::RenderLayerBacking::paintingPhaseForPrimaryLayer const):
(WebCore::RenderLayerBacking::parentForSublayers const):
(WebCore::RenderLayerBacking::setContentsNeedDisplay):
(WebCore::RenderLayerBacking::setContentsNeedDisplayInRect):
(WebCore::RenderLayerBacking::paintContents):
(WebCore::RenderLayerBacking::backingStoreMemoryEstimate const):
* rendering/RenderLayerBacking.h:
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (240896 => 240897)
--- trunk/Source/WebCore/ChangeLog 2019-02-02 18:35:42 UTC (rev 240896)
+++ trunk/Source/WebCore/ChangeLog 2019-02-02 19:09:18 UTC (rev 240897)
@@ -1,3 +1,54 @@
+2019-02-01 Simon Fraser <[email protected]>
+
+ Async overflow scroll is jumpy on macOS if the main thread is busy
+ https://bugs.webkit.org/show_bug.cgi?id=194184
+ <rdar://problem/47758655>
+
+ Reviewed by Antti Koivisto.
+
+ This change extends to macOS some existing overflow-scroll functionality for iOS.
+ When an async scroll is in process in the scroll thread (or UI process), we periodically
+ message back to the web process main thread with scroll position updates. These
+ can trigger post-scroll compositing updates, but we need to ensure that this update
+ doesn't clobber the scroll position of the native layers, which would trigger
+ stutters.
+
+ To do this we have the notion of a scroll position "sync" (ScrollingLayerPositionAction::Sync) which
+ pokes the new value into the GraphicsLayer (hence making visible rect computations work), but doesn't
+ propagate it to the platform layer. This patch wires up syncs for macOS during async overflow scrolling,
+ coming out of AsyncScrollingCoordinator::updateScrollPositionAfterAsyncScroll().
+
+ In RenderLayerBacking, m_scrollingContentsLayer is renamed to m_scrolledContentsLayer, and I added
+ updateScrollOffset() and setLocationOfScrolledContents() to handle the set vs. sync, and to keep
+ the iOS vs macOS differences in one function. This allows for more code sharing in RenderLayerBacking::updateGeometry().
+
+ There's a confusing bit in the m_childClippingMaskLayer code (trac.webkit.org/178029) where the setOffsetFromRenderer()
+ just looks wrong; it should match m_scrollingLayer. This code is never hit for Cocoa, which never has m_childClippingMaskLayer.
+
+ * page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.mm:
+ (WebCore::ScrollingTreeOverflowScrollingNodeMac::setScrollPosition): Logging
+ (WebCore::ScrollingTreeOverflowScrollingNodeMac::setScrollLayerPosition): Logging
+ * rendering/RenderLayer.cpp:
+ (WebCore::RenderLayer::RenderLayer):
+ (WebCore::RenderLayer::scrollTo):
+ * rendering/RenderLayer.h: Rename m_requiresScrollBoundsOriginUpdate to m_requiresScrollPositionReconciliation
+ and make it available on all platforms. Just reorder m_adjustForIOSCaretWhenScrolling to reduce #ifdef nesting confusion.
+ * rendering/RenderLayerBacking.cpp:
+ (WebCore::RenderLayerBacking::updateDebugIndicators):
+ (WebCore::RenderLayerBacking::destroyGraphicsLayers):
+ (WebCore::RenderLayerBacking::updateGeometry):
+ (WebCore::RenderLayerBacking::setLocationOfScrolledContents):
+ (WebCore::RenderLayerBacking::updateScrollOffset):
+ (WebCore::RenderLayerBacking::updateDrawsContent):
+ (WebCore::RenderLayerBacking::updateScrollingLayers):
+ (WebCore::RenderLayerBacking::paintingPhaseForPrimaryLayer const):
+ (WebCore::RenderLayerBacking::parentForSublayers const):
+ (WebCore::RenderLayerBacking::setContentsNeedDisplay):
+ (WebCore::RenderLayerBacking::setContentsNeedDisplayInRect):
+ (WebCore::RenderLayerBacking::paintContents):
+ (WebCore::RenderLayerBacking::backingStoreMemoryEstimate const):
+ * rendering/RenderLayerBacking.h:
+
2019-02-02 Zalan Bujtas <[email protected]>
[LFC] Initialize ICB's style with fixed width/height.
Modified: trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.mm (240896 => 240897)
--- trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.mm 2019-02-02 18:35:42 UTC (rev 240896)
+++ trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.mm 2019-02-02 19:09:18 UTC (rev 240897)
@@ -107,7 +107,7 @@
void ScrollingTreeOverflowScrollingNodeMac::setScrollPosition(const FloatPoint& scrollPosition)
{
- LOG_WITH_STREAM(Scrolling, stream << "ScrollingTreeOverflowScrollingNodeMac::setScrollPosition " << scrollPosition << " scrollPosition(): " << this->scrollPosition() << " min: " << minimumScrollPosition() << " max: " << maximumScrollPosition());
+ LOG_WITH_STREAM(Scrolling, stream << "ScrollingTreeOverflowScrollingNodeMac::setScrollPosition " << scrollPosition << " from " << this->scrollPosition() << " (min: " << minimumScrollPosition() << " max: " << maximumScrollPosition() << ")");
// Scroll deltas can be non-integral with some input devices, so scrollPosition may not be integral.
// FIXME: when we support half-pixel scroll positions on Retina displays, this will need to round to half pixels.
@@ -124,6 +124,8 @@
void ScrollingTreeOverflowScrollingNodeMac::setScrollLayerPosition(const FloatPoint& scrollPosition, const FloatRect& fixedPositionRect)
{
+ LOG_WITH_STREAM(Scrolling, stream << "ScrollingTreeOverflowScrollingNodeMac::setScrollLayerPosition " << scrollPosition);
+
scrolledContentsLayer().position = -scrollPosition;
if (!m_children)
return;
Modified: trunk/Source/WebCore/rendering/RenderLayer.cpp (240896 => 240897)
--- trunk/Source/WebCore/rendering/RenderLayer.cpp 2019-02-02 18:35:42 UTC (rev 240896)
+++ trunk/Source/WebCore/rendering/RenderLayer.cpp 2019-02-02 19:09:18 UTC (rev 240897)
@@ -296,15 +296,13 @@
, m_indirectCompositingReason(static_cast<unsigned>(IndirectCompositingReason::None))
, m_viewportConstrainedNotCompositedReason(NoNotCompositedReason)
#if PLATFORM(IOS_FAMILY)
- , m_adjustForIOSCaretWhenScrolling(false)
-#endif
-#if PLATFORM(IOS_FAMILY)
#if ENABLE(IOS_TOUCH_EVENTS)
, m_registeredAsTouchEventListenerForScrolling(false)
#endif
+ , m_adjustForIOSCaretWhenScrolling(false)
+#endif
, m_inUserScroll(false)
- , m_requiresScrollBoundsOriginUpdate(false)
-#endif
+ , m_requiresScrollPositionReconciliation(false)
, m_containsDirtyOverlayScrollbars(false)
, m_updatingMarqueePosition(false)
#if !ASSERT_DISABLED
@@ -2347,7 +2345,7 @@
if (!box)
return;
- LOG_WITH_STREAM(Scrolling, stream << "RenderLayer::scrollTo " << position);
+ LOG_WITH_STREAM(Scrolling, stream << "RenderLayer::scrollTo " << position << " from " << m_scrollPosition << " (in user scroll " << isInUserScroll() << ")");
ScrollPosition newPosition = position;
if (!box->isHTMLMarquee()) {
@@ -2374,12 +2372,12 @@
}
if (m_scrollPosition == newPosition) {
-#if PLATFORM(IOS_FAMILY)
- if (m_requiresScrollBoundsOriginUpdate) {
+ // FIXME: Nothing guarantees we get a scrollTo() with an unchanged position at the end of a user gesture.
+ // The ScrollingCoordinator probably needs to message the main thread when a gesture ends.
+ if (requiresScrollPositionReconciliation()) {
setNeedsCompositingGeometryUpdate();
updateCompositingLayersAfterScroll();
}
-#endif
return;
}
Modified: trunk/Source/WebCore/rendering/RenderLayer.h (240896 => 240897)
--- trunk/Source/WebCore/rendering/RenderLayer.h 2019-02-02 18:35:42 UTC (rev 240896)
+++ trunk/Source/WebCore/rendering/RenderLayer.h 2019-02-02 19:09:18 UTC (rev 240897)
@@ -449,6 +449,12 @@
void updateSnapOffsets() override;
#endif
+ void setIsUserScroll(bool isUserScroll) override { m_inUserScroll = isUserScroll; }
+ bool isInUserScroll() const { return m_inUserScroll; }
+
+ bool requiresScrollPositionReconciliation() const { return m_requiresScrollPositionReconciliation; }
+ void setRequiresScrollPositionReconciliation(bool requiresReconciliation = true) { m_requiresScrollPositionReconciliation = requiresReconciliation; }
+
#if PLATFORM(IOS_FAMILY)
#if ENABLE(IOS_TOUCH_EVENTS)
bool handleTouchEvent(const PlatformTouchEvent&) override;
@@ -457,12 +463,6 @@
void didStartScroll() override;
void didEndScroll() override;
void didUpdateScroll() override;
- void setIsUserScroll(bool isUserScroll) override { m_inUserScroll = isUserScroll; }
-
- bool isInUserScroll() const { return m_inUserScroll; }
-
- bool requiresScrollBoundsOriginUpdate() const { return m_requiresScrollBoundsOriginUpdate; }
- void setRequiresScrollBoundsOriginUpdate(bool requiresUpdate = true) { m_requiresScrollBoundsOriginUpdate = requiresUpdate; }
#endif
// Returns true when the layer could do touch scrolling, but doesn't look at whether there is actually scrollable overflow.
@@ -1192,14 +1192,14 @@
unsigned m_viewportConstrainedNotCompositedReason : 2;
#if PLATFORM(IOS_FAMILY)
- bool m_adjustForIOSCaretWhenScrolling : 1;
#if ENABLE(IOS_TOUCH_EVENTS)
bool m_registeredAsTouchEventListenerForScrolling : 1;
#endif
- bool m_inUserScroll : 1;
- bool m_requiresScrollBoundsOriginUpdate : 1;
+ bool m_adjustForIOSCaretWhenScrolling : 1;
#endif
+ bool m_inUserScroll : 1;
+ bool m_requiresScrollPositionReconciliation : 1;
bool m_containsDirtyOverlayScrollbars : 1;
bool m_updatingMarqueePosition : 1;
Modified: trunk/Source/WebCore/rendering/RenderLayerBacking.cpp (240896 => 240897)
--- trunk/Source/WebCore/rendering/RenderLayerBacking.cpp 2019-02-02 18:35:42 UTC (rev 240896)
+++ trunk/Source/WebCore/rendering/RenderLayerBacking.cpp 2019-02-02 19:09:18 UTC (rev 240897)
@@ -394,9 +394,9 @@
if (m_scrollingLayer)
m_scrollingLayer->setShowDebugBorder(showBorder);
- if (m_scrollingContentsLayer) {
- m_scrollingContentsLayer->setShowDebugBorder(showBorder);
- m_scrollingContentsLayer->setShowRepaintCounter(showRepaintCounter);
+ if (m_scrolledContentsLayer) {
+ m_scrolledContentsLayer->setShowDebugBorder(showBorder);
+ m_scrolledContentsLayer->setShowRepaintCounter(showRepaintCounter);
}
}
@@ -483,7 +483,7 @@
GraphicsLayer::unparentAndClear(m_childContainmentLayer);
GraphicsLayer::unparentAndClear(m_childClippingMaskLayer);
GraphicsLayer::unparentAndClear(m_scrollingLayer);
- GraphicsLayer::unparentAndClear(m_scrollingContentsLayer);
+ GraphicsLayer::unparentAndClear(m_scrolledContentsLayer);
GraphicsLayer::unparentAndClear(m_graphicsLayer);
}
@@ -1182,7 +1182,7 @@
}
if (m_scrollingLayer) {
- ASSERT(m_scrollingContentsLayer);
+ ASSERT(m_scrolledContentsLayer);
auto& renderBox = downcast<RenderBox>(renderer());
LayoutRect paddingBoxIncludingScrollbar = renderBox.paddingBoxRectIncludingScrollbar();
ScrollOffset scrollOffset = m_owningLayer.scrollOffset();
@@ -1189,37 +1189,13 @@
// FIXME: need to do some pixel snapping here.
m_scrollingLayer->setPosition(FloatPoint(paddingBoxIncludingScrollbar.location() - compositedBounds().location()));
+ m_scrollingLayer->setSize(roundedIntSize(LayoutSize(renderBox.clientWidth(), renderBox.clientHeight())));
- m_scrollingLayer->setSize(roundedIntSize(LayoutSize(renderBox.clientWidth(), renderBox.clientHeight())));
+ updateScrollOffset(scrollOffset);
#if PLATFORM(IOS_FAMILY)
- FloatSize oldScrollingLayerOffset = m_scrollingLayer->offsetFromRenderer();
- m_scrollingLayer->setOffsetFromRenderer(FloatPoint() - paddingBoxIncludingScrollbar.location());
- bool paddingBoxOffsetChanged = oldScrollingLayerOffset != m_scrollingLayer->offsetFromRenderer();
+ m_scrolledContentsLayer->setPosition({ }); // FIXME: necessary?
+#endif
- if (m_owningLayer.isInUserScroll()) {
- // If scrolling is happening externally, we don't want to touch the layer bounds origin here because that will cause jitter.
- m_scrollingLayer->syncBoundsOrigin(scrollOffset);
- m_owningLayer.setRequiresScrollBoundsOriginUpdate(true);
- } else {
- // Note that we implement the contents offset via the bounds origin on this layer, rather than a position on the sublayer.
- m_scrollingLayer->setBoundsOrigin(scrollOffset);
- m_owningLayer.setRequiresScrollBoundsOriginUpdate(false);
- }
-
- IntSize scrollSize(m_owningLayer.scrollWidth(), m_owningLayer.scrollHeight());
-
- m_scrollingContentsLayer->setPosition(FloatPoint());
-
- if (scrollSize != m_scrollingContentsLayer->size() || paddingBoxOffsetChanged)
- m_scrollingContentsLayer->setNeedsDisplay();
-
- m_scrollingContentsLayer->setSize(scrollSize);
- // Scrolling the content layer does not need to trigger a repaint. The offset will be compensated away during painting.
- m_scrollingContentsLayer->setScrollOffset(scrollOffset, GraphicsLayer::DontSetNeedsDisplay);
- m_scrollingContentsLayer->setOffsetFromRenderer(toLayoutSize(paddingBoxIncludingScrollbar.location()), GraphicsLayer::DontSetNeedsDisplay);
-#else
- m_scrollingContentsLayer->setPosition(-scrollOffset);
-
FloatSize oldScrollingLayerOffset = m_scrollingLayer->offsetFromRenderer();
m_scrollingLayer->setOffsetFromRenderer(-toFloatSize(paddingBoxIncludingScrollbar.location()));
@@ -1226,23 +1202,22 @@
if (m_childClippingMaskLayer) {
m_childClippingMaskLayer->setPosition(m_scrollingLayer->position());
m_childClippingMaskLayer->setSize(m_scrollingLayer->size());
- m_childClippingMaskLayer->setOffsetFromRenderer(toFloatSize(paddingBoxIncludingScrollbar.location()));
+ m_childClippingMaskLayer->setOffsetFromRenderer(-toFloatSize(paddingBoxIncludingScrollbar.location()));
}
bool paddingBoxOffsetChanged = oldScrollingLayerOffset != m_scrollingLayer->offsetFromRenderer();
IntSize scrollSize(m_owningLayer.scrollWidth(), m_owningLayer.scrollHeight());
- if (scrollSize != m_scrollingContentsLayer->size() || paddingBoxOffsetChanged)
- m_scrollingContentsLayer->setNeedsDisplay();
+ if (scrollSize != m_scrolledContentsLayer->size() || paddingBoxOffsetChanged)
+ m_scrolledContentsLayer->setNeedsDisplay();
- m_scrollingContentsLayer->setSize(scrollSize);
- m_scrollingContentsLayer->setScrollOffset(scrollOffset, GraphicsLayer::DontSetNeedsDisplay);
- m_scrollingContentsLayer->setOffsetFromRenderer(toLayoutSize(paddingBoxIncludingScrollbar.location()), GraphicsLayer::DontSetNeedsDisplay);
-#endif
+ m_scrolledContentsLayer->setSize(scrollSize);
+ m_scrolledContentsLayer->setScrollOffset(scrollOffset, GraphicsLayer::DontSetNeedsDisplay);
+ m_scrolledContentsLayer->setOffsetFromRenderer(toLayoutSize(paddingBoxIncludingScrollbar.location()), GraphicsLayer::DontSetNeedsDisplay);
if (m_foregroundLayer) {
- m_foregroundLayer->setSize(m_scrollingContentsLayer->size());
- m_foregroundLayer->setOffsetFromRenderer(m_scrollingContentsLayer->offsetFromRenderer() - toLayoutSize(m_scrollingContentsLayer->scrollOffset()));
+ m_foregroundLayer->setSize(m_scrolledContentsLayer->size());
+ m_foregroundLayer->setOffsetFromRenderer(m_scrolledContentsLayer->offsetFromRenderer() - toLayoutSize(m_scrolledContentsLayer->scrollOffset()));
}
}
@@ -1259,6 +1234,34 @@
setContentsNeedDisplay();
}
+void RenderLayerBacking::setLocationOfScrolledContents(ScrollOffset scrollOffset, ScrollingLayerPositionAction setOrSync)
+{
+#if PLATFORM(IOS_FAMILY)
+ if (setOrSync == ScrollingLayerPositionAction::Sync)
+ m_scrollingLayer->syncBoundsOrigin(scrollOffset);
+ else
+ m_scrollingLayer->setBoundsOrigin(scrollOffset);
+#else
+ if (setOrSync == ScrollingLayerPositionAction::Sync)
+ m_scrolledContentsLayer->syncPosition(-scrollOffset);
+ else
+ m_scrolledContentsLayer->setPosition(-scrollOffset);
+#endif
+}
+
+void RenderLayerBacking::updateScrollOffset(ScrollOffset scrollOffset)
+{
+ if (m_owningLayer.isInUserScroll()) {
+ // 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);
+ } 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);
+ }
+}
+
void RenderLayerBacking::updateAfterDescendants()
{
// FIXME: this potentially duplicates work we did in updateConfiguration().
@@ -1391,12 +1394,12 @@
// We don't have to consider overflow controls, because we know that the scrollbars are drawn elsewhere.
// m_graphicsLayer only needs backing store if the non-scrolling parts (background, outlines, borders, shadows etc) need to paint.
// m_scrollingLayer never has backing store.
- // m_scrollingContentsLayer only needs backing store if the scrolled contents need to paint.
+ // m_scrolledContentsLayer only needs backing store if the scrolled contents need to paint.
bool hasNonScrollingPaintedContent = m_owningLayer.hasVisibleContent() && m_owningLayer.hasVisibleBoxDecorationsOrBackground();
m_graphicsLayer->setDrawsContent(hasNonScrollingPaintedContent);
bool hasScrollingPaintedContent = m_owningLayer.hasVisibleContent() && (renderer().hasBackground() || contentsInfo.paintsContent());
- m_scrollingContentsLayer->setDrawsContent(hasScrollingPaintedContent);
+ m_scrolledContentsLayer->setDrawsContent(hasScrollingPaintedContent);
return;
}
@@ -1745,23 +1748,23 @@
m_scrollingLayer->setMasksToBounds(true);
// Inner layer which renders the content that scrolls.
- m_scrollingContentsLayer = createGraphicsLayer("scrolled contents");
- m_scrollingContentsLayer->setDrawsContent(true);
- m_scrollingContentsLayer->setAnchorPoint({ });
+ m_scrolledContentsLayer = createGraphicsLayer("scrolled contents");
+ m_scrolledContentsLayer->setDrawsContent(true);
+ m_scrolledContentsLayer->setAnchorPoint({ });
GraphicsLayerPaintingPhase paintPhase = GraphicsLayerPaintOverflowContents | GraphicsLayerPaintCompositedScroll;
if (!m_foregroundLayer)
paintPhase |= GraphicsLayerPaintForeground;
- m_scrollingContentsLayer->setPaintingPhase(paintPhase);
- m_scrollingLayer->addChild(*m_scrollingContentsLayer);
+ m_scrolledContentsLayer->setPaintingPhase(paintPhase);
+ m_scrollingLayer->addChild(*m_scrolledContentsLayer);
} else {
compositor().willRemoveScrollingLayerWithBacking(m_owningLayer, *this);
willDestroyLayer(m_scrollingLayer.get());
- willDestroyLayer(m_scrollingContentsLayer.get());
+ willDestroyLayer(m_scrolledContentsLayer.get());
GraphicsLayer::unparentAndClear(m_scrollingLayer);
- GraphicsLayer::unparentAndClear(m_scrollingContentsLayer);
+ GraphicsLayer::unparentAndClear(m_scrolledContentsLayer);
}
m_graphicsLayer->setPaintingPhase(paintingPhaseForPrimaryLayer());
@@ -1831,7 +1834,7 @@
if (!m_foregroundLayer)
phase |= GraphicsLayerPaintForeground;
- if (m_scrollingContentsLayer) {
+ if (m_scrolledContentsLayer) {
phase &= ~GraphicsLayerPaintForeground;
phase |= GraphicsLayerPaintCompositedScroll;
}
@@ -2394,8 +2397,8 @@
GraphicsLayer* RenderLayerBacking::parentForSublayers() const
{
- if (m_scrollingContentsLayer)
- return m_scrollingContentsLayer.get();
+ if (m_scrolledContentsLayer)
+ return m_scrolledContentsLayer.get();
return m_childContainmentLayer ? m_childContainmentLayer.get() : m_graphicsLayer.get();
}
@@ -2480,8 +2483,8 @@
if (m_childClippingMaskLayer && m_childClippingMaskLayer->drawsContent())
m_childClippingMaskLayer->setNeedsDisplay();
- if (m_scrollingContentsLayer && m_scrollingContentsLayer->drawsContent())
- m_scrollingContentsLayer->setNeedsDisplay();
+ if (m_scrolledContentsLayer && m_scrolledContentsLayer->drawsContent())
+ m_scrolledContentsLayer->setNeedsDisplay();
}
// r is in the coordinate space of the layer's render object
@@ -2529,15 +2532,15 @@
m_childClippingMaskLayer->setNeedsDisplayInRect(layerDirtyRect);
}
- if (m_scrollingContentsLayer && m_scrollingContentsLayer->drawsContent()) {
+ if (m_scrolledContentsLayer && m_scrolledContentsLayer->drawsContent()) {
FloatRect layerDirtyRect = pixelSnappedRectForPainting;
- layerDirtyRect.move(-m_scrollingContentsLayer->offsetFromRenderer() + toLayoutSize(m_scrollingContentsLayer->scrollOffset()) - m_subpixelOffsetFromRenderer);
+ layerDirtyRect.move(-m_scrolledContentsLayer->offsetFromRenderer() + toLayoutSize(m_scrolledContentsLayer->scrollOffset()) - m_subpixelOffsetFromRenderer);
#if PLATFORM(IOS_FAMILY)
// 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()).
layerDirtyRect.moveBy(-m_owningLayer.scrollPosition());
#endif
- m_scrollingContentsLayer->setNeedsDisplayInRect(layerDirtyRect, shouldClip);
+ m_scrolledContentsLayer->setNeedsDisplayInRect(layerDirtyRect, shouldClip);
}
}
@@ -2623,7 +2626,7 @@
|| graphicsLayer == m_backgroundLayer.get()
|| graphicsLayer == m_maskLayer.get()
|| graphicsLayer == m_childClippingMaskLayer.get()
- || graphicsLayer == m_scrollingContentsLayer.get()) {
+ || graphicsLayer == m_scrolledContentsLayer.get()) {
InspectorInstrumentation::willPaint(renderer());
if (!(paintingPhase & GraphicsLayerPaintOverflowContents))
@@ -3079,8 +3082,8 @@
if (m_childClippingMaskLayer)
backingMemory += m_childClippingMaskLayer->backingStoreMemoryEstimate();
- if (m_scrollingContentsLayer)
- backingMemory += m_scrollingContentsLayer->backingStoreMemoryEstimate();
+ if (m_scrolledContentsLayer)
+ backingMemory += m_scrolledContentsLayer->backingStoreMemoryEstimate();
if (m_layerForHorizontalScrollbar)
backingMemory += m_layerForHorizontalScrollbar->backingStoreMemoryEstimate();
Modified: trunk/Source/WebCore/rendering/RenderLayerBacking.h (240896 => 240897)
--- trunk/Source/WebCore/rendering/RenderLayerBacking.h 2019-02-02 18:35:42 UTC (rev 240896)
+++ trunk/Source/WebCore/rendering/RenderLayerBacking.h 2019-02-02 19:09:18 UTC (rev 240897)
@@ -106,7 +106,7 @@
bool hasScrollingLayer() const { return m_scrollingLayer != nullptr; }
GraphicsLayer* scrollingLayer() const { return m_scrollingLayer.get(); }
- GraphicsLayer* scrollingContentsLayer() const { return m_scrollingContentsLayer.get(); }
+ GraphicsLayer* scrollingContentsLayer() const { return m_scrolledContentsLayer.get(); }
OptionSet<ScrollCoordinationRole> coordinatedScrollingRoles() const;
@@ -298,6 +298,9 @@
bool requiresVerticalScrollbarLayer() const;
bool requiresScrollCornerLayer() const;
bool updateScrollingLayers(bool scrollingLayers);
+
+ void updateScrollOffset(ScrollOffset);
+ void setLocationOfScrolledContents(ScrollOffset, ScrollingLayerPositionAction);
void updateChildClippingStrategy(bool needsDescendantsClippingLayer);
@@ -383,7 +386,7 @@
RefPtr<GraphicsLayer> m_layerForScrollCorner;
RefPtr<GraphicsLayer> m_scrollingLayer; // Only used if the layer is using composited scrolling.
- RefPtr<GraphicsLayer> m_scrollingContentsLayer; // Only used if the layer is using composited scrolling.
+ RefPtr<GraphicsLayer> m_scrolledContentsLayer; // Only used if the layer is using composited scrolling.
LayoutRect m_compositedBounds;
LayoutSize m_subpixelOffsetFromRenderer; // This is the subpixel distance between the primary graphics layer and the associated renderer's bounds.