Changeset 257920 in webkit
- Timestamp:
- Mar 5, 2020 9:18:00 AM (4 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r257919 r257920 1 2020-03-05 Simon Fraser <simon.fraser@apple.com> 2 3 Track "scrolling scope" on RenderLayers 4 https://bugs.webkit.org/show_bug.cgi?id=208620 5 6 Reviewed by Zalan Bujtas. 7 8 Keep track of a "scrolling scope" on RenderLayers. Layers that share a scrolling scope 9 get scrolled by some common async-scrollable containing-block ancestor. The scope is just 10 a unique identifier. 11 12 Each layer has two scopes; a "box" scope that applies to the background/borders, and 13 a "content" scope that applies to (potentially) scrollable content. For most layers, 14 these will be the same, and shared with the layer's containing block ancestor layer. 15 16 For async-scrollable overflow, "box" scope is shared with the cb ancestor, but "content" scope 17 will have a new value that applies to all the layers moved by that scroller. 18 19 Having this value makes it easy to ask the question "is this layer scrolled by some ancestor", 20 which is a tricky computation for things like a position:absolute layer inside a non-containing block 21 stacking context overflow:scroll. Also, position:fixed whose containing block is the root will share 22 the scrolling scope of the root. 23 24 No behavior change. 25 26 * rendering/RenderLayer.cpp: 27 (WebCore::nextScrollingScope): 28 (WebCore::RenderLayer::RenderLayer): 29 (WebCore::RenderLayer::updateLayerPositions): 30 (WebCore::RenderLayer::updateLayerPosition): 31 (WebCore::outputPaintOrderTreeLegend): 32 (WebCore::outputPaintOrderTreeRecursive): 33 * rendering/RenderLayer.h: 34 * rendering/RenderLayerCompositor.cpp: 35 (WebCore::isScrolledByOverflowScrollLayer): 36 1 37 2020-03-05 youenn fablet <youenn@apple.com> 2 38 -
trunk/Source/WebCore/rendering/RenderLayer.cpp
r255957 r257920 284 284 #endif 285 285 286 static ScrollingScope nextScrollingScope() 287 { 288 static ScrollingScope currentScope = 0; 289 return ++currentScope; 290 } 291 286 292 DEFINE_ALLOCATOR_WITH_HEAP_IDENTIFIER(RenderLayer); 287 293 … … 344 350 m_isSelfPaintingLayer = shouldBeSelfPaintingLayer(); 345 351 352 if (isRenderViewLayer()) 353 m_boxScrollingScope = m_contentsScrollingScope = nextScrollingScope(); 354 346 355 if (!renderer().firstChild()) { 347 356 m_visibleContentStatusDirty = false; … … 959 968 // Clear our cached clip rect information. 960 969 clearClipRects(); 961 970 962 971 if (hasOverflowControls()) { 963 972 LayoutSize offsetFromRoot; … … 1735 1744 localPoint -= toLayoutSize(positionedParent->scrollPosition()); 1736 1745 1737 if ( renderer().isOutOfFlowPositioned() &&positionedParent->renderer().isInFlowPositioned() && is<RenderInline>(positionedParent->renderer())) {1746 if (positionedParent->renderer().isInFlowPositioned() && is<RenderInline>(positionedParent->renderer())) { 1738 1747 LayoutSize offset = downcast<RenderInline>(positionedParent->renderer()).offsetForInFlowPositionedInline(&downcast<RenderBox>(renderer())); 1739 1748 localPoint += offset; 1740 1749 } 1741 } else if (parent()) { 1742 if (parent()->renderer().hasOverflowClip()) 1750 1751 ASSERT(positionedParent->contentsScrollingScope()); 1752 m_boxScrollingScope = positionedParent->contentsScrollingScope(); 1753 } else if (auto* parentLayer = parent()) { 1754 if (parentLayer->renderer().hasOverflowClip()) 1743 1755 localPoint -= toLayoutSize(parent()->scrollPosition()); 1744 } 1745 1756 1757 ASSERT(parentLayer->contentsScrollingScope()); 1758 m_boxScrollingScope = parentLayer->contentsScrollingScope(); 1759 } 1760 1761 if (hasCompositedScrollableOverflow()) { 1762 if (!m_contentsScrollingScope) 1763 m_contentsScrollingScope = nextScrollingScope(); 1764 } else if (!m_contentsScrollingScope) 1765 m_contentsScrollingScope = m_boxScrollingScope; 1766 1746 1767 bool positionOrOffsetChanged = false; 1747 1768 if (renderer().isInFlowPositioned()) { … … 7098 7119 "Dirty (z)-lists, Dirty (n)ormal flow lists\n" 7099 7120 "Traversal needs: requirements (t)raversal on descendants, (b)acking or hierarchy traversal on descendants, (r)equirements traversal on all descendants, requirements traversal on all (s)ubsequent layers, (h)ierarchy traversal on all descendants, update of paint (o)rder children\n" 7100 "Update needs: post-(l)ayout requirements, (g)eometry, (k)ids geometry, (c)onfig, layer conne(x)ion, (s)crolling tree\n"; 7121 "Update needs: post-(l)ayout requirements, (g)eometry, (k)ids geometry, (c)onfig, layer conne(x)ion, (s)crolling tree\n" 7122 "Scrolling scope: box contents\n"; 7101 7123 stream.nextLine(); 7102 7124 } … … 7169 7191 stream << " "; 7170 7192 7193 stream << layer.boxScrollingScope(); 7194 stream << " "; 7195 stream << layer.contentsScrollingScope(); 7196 7197 stream << " "; 7198 7171 7199 outputIdent(stream, depth); 7172 7200 -
trunk/Source/WebCore/rendering/RenderLayer.h
r255957 r257920 54 54 #include "ScrollableArea.h" 55 55 #include <memory> 56 #include <wtf/Markable.h> 56 57 #include <wtf/WeakPtr.h> 57 58 … … 139 140 }; 140 141 142 using ScrollingScope = uint64_t; 143 141 144 DECLARE_ALLOCATOR_WITH_HEAP_IDENTIFIER(RenderLayer); 142 145 class RenderLayer final : public ScrollableArea { … … 862 865 void setHasCompositedScrollingAncestor(bool hasCompositedScrollingAncestor) { m_hasCompositedScrollingAncestor = hasCompositedScrollingAncestor; } 863 866 867 // Layers with the same ScrollingScope are scrolled by some common ancestor scroller. Used for async scrolling. 868 Optional<ScrollingScope> boxScrollingScope() const { return m_boxScrollingScope; } 869 Optional<ScrollingScope> contentsScrollingScope() const { return m_contentsScrollingScope; } 870 864 871 bool paintsWithTransparency(OptionSet<PaintBehavior> paintBehavior) const 865 872 { … … 1322 1329 IntPoint m_cachedOverlayScrollbarOffset; 1323 1330 1331 Markable<ScrollingScope, IntegralMarkableTraits<ScrollingScope, 0>> m_boxScrollingScope; 1332 Markable<ScrollingScope, IntegralMarkableTraits<ScrollingScope, 0>> m_contentsScrollingScope; 1333 1324 1334 std::unique_ptr<RenderMarquee> m_marquee; // Used for <marquee>. 1325 1335 -
trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp
r257689 r257920 3179 3179 static bool isScrolledByOverflowScrollLayer(const RenderLayer& layer, const RenderLayer& overflowScrollLayer) 3180 3180 { 3181 bool scrolledByOverflowScroll = false; 3182 traverseAncestorLayers(layer, [&](const RenderLayer& ancestorLayer, bool inContainingBlockChain, bool) { 3183 if (&ancestorLayer == &overflowScrollLayer) { 3184 scrolledByOverflowScroll = inContainingBlockChain; 3185 return AncestorTraversal::Stop; 3186 } 3187 return AncestorTraversal::Continue; 3188 }); 3189 return scrolledByOverflowScroll; 3181 return layer.boxScrollingScope() == overflowScrollLayer.contentsScrollingScope(); 3190 3182 } 3191 3183
Note: See TracChangeset
for help on using the changeset viewer.