Changeset 288429 in webkit
- Timestamp:
- Jan 23, 2022 8:48:29 PM (6 months ago)
- Location:
- trunk
- Files:
-
- 1 added
- 6 edited
- 1 copied
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/compositing/backing/no-backing-for-offscreen-children-of-position-fixed-expected.txt (copied) (copied from trunk/LayoutTests/compositing/clip-child-by-non-stacking-ancestor-expected.txt) (1 diff)
-
LayoutTests/compositing/backing/no-backing-for-offscreen-children-of-position-fixed.html (added)
-
LayoutTests/compositing/clip-child-by-non-stacking-ancestor-expected.txt (modified) (1 diff)
-
LayoutTests/compositing/geometry/limit-layer-bounds-fixed-expected.txt (modified) (1 diff)
-
LayoutTests/platform/ios-wk2/compositing/geometry/limit-layer-bounds-fixed-expected.txt (modified) (1 diff)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/rendering/RenderLayerBacking.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r288425 r288429 1 2022-01-23 Matt Woodrow <mattwoodrow@apple.com> 2 3 Position:fixed layers shouldn't allocate a backing buffer if all children are offscreen. 4 https://bugs.webkit.org/show_bug.cgi?id=235420 5 <rdar://86612099> 6 7 Reviewed by Simon Fraser and Darin Adler. 8 9 Adds a test that has a viewport sized position:fixed element (with compositing 10 layer), and a single child which is entirely offscreen. Tests that we correctly 11 determine that we don't need a backing store for the layer. 12 13 * compositing/backing/no-backing-for-offscreen-children-of-position-fixed-expected.txt: Added. 14 * compositing/backing/no-backing-for-offscreen-children-of-position-fixed.html: Added. 15 1 16 2022-01-23 Tyler Wilcock <tyler_w@apple.com> 2 17 -
trunk/LayoutTests/compositing/backing/no-backing-for-offscreen-children-of-position-fixed-expected.txt
r288428 r288429 8 8 (children 1 9 9 (GraphicsLayer 10 (position 8.00 8.00) 11 (bounds 100.00 100.00) 12 (contentsOpaque 1) 13 (drawsContent 1) 10 (bounds 200.00 200.00) 14 11 ) 15 12 ) -
trunk/LayoutTests/compositing/clip-child-by-non-stacking-ancestor-expected.txt
r168244 r288429 11 11 (bounds 100.00 100.00) 12 12 (contentsOpaque 1) 13 (drawsContent 1)14 13 ) 15 14 ) -
trunk/LayoutTests/compositing/geometry/limit-layer-bounds-fixed-expected.txt
r225897 r288429 16 16 (position 0.00 3000.00) 17 17 (bounds 300.00 200.00) 18 (drawsContent 1)19 18 ) 20 19 ) -
trunk/LayoutTests/platform/ios-wk2/compositing/geometry/limit-layer-bounds-fixed-expected.txt
r225897 r288429 16 16 (position 0.00 3000.00) 17 17 (bounds 300.00 200.00) 18 (drawsContent 1)19 18 ) 20 19 ) -
trunk/Source/WebCore/ChangeLog
r288428 r288429 1 2022-01-23 Matt Woodrow <mattwoodrow@apple.com> 2 3 Position:fixed layers shouldn't allocate a backing buffer if all children are offscreen. 4 https://bugs.webkit.org/show_bug.cgi?id=235420 5 <rdar://86612099> 6 7 Reviewed by Simon Fraser and Darin Adler. 8 9 Adds a bounds intersection check to isPaintDestinationForDescendantLayers, 10 so that we can exclude descendants that definitely won't draw anything into 11 the compositing layer. Uses a conservative check, which gives up if there are 12 any transforms in the ancestor chain. 13 14 Test: compositing/backing/no-backing-for-offscreen-children-of-position-fixed.html 15 16 * rendering/RenderLayerBacking.cpp: 17 (WebCore::intersectsWithAncestor): 18 (WebCore::RenderLayerBacking::isPaintDestinationForDescendantLayers const): 19 1 20 2022-01-23 Darin Adler <darin@apple.com> 2 21 -
trunk/Source/WebCore/rendering/RenderLayerBacking.cpp
r287757 r288429 2791 2791 } 2792 2792 2793 static std::optional<bool> intersectsWithAncestor(const RenderLayer& child, const RenderLayer& ancestor, const LayoutRect& ancestorCompositedBounds) 2794 { 2795 // If any layers between child and ancestor are transformed, then adjusting the offset is 2796 // insufficient to convert coordinates into ancestor's coordinate space. 2797 for (auto* layer = &child; layer != &ancestor; layer = layer->parent()) { 2798 if (!layer->canUseOffsetFromAncestor()) 2799 return std::nullopt; 2800 } 2801 2802 auto offset = child.convertToLayerCoords(&ancestor, { }, RenderLayer::AdjustForColumns); 2803 auto overlap = child.overlapBounds(); 2804 overlap.moveBy(offset); 2805 return overlap.intersects(ancestorCompositedBounds); 2806 } 2807 2793 2808 // Conservative test for having no rendered children. 2794 2809 bool RenderLayerBacking::isPaintDestinationForDescendantLayers(RenderLayer::PaintedContentRequest& request) const 2795 2810 { 2796 2811 bool hasPaintingDescendant = false; 2797 traverseVisibleNonCompositedDescendantLayers(m_owningLayer, [&hasPaintingDescendant, &request](const RenderLayer& layer) { 2798 hasPaintingDescendant |= layer.isVisuallyNonEmpty(&request); 2812 traverseVisibleNonCompositedDescendantLayers(m_owningLayer, [&hasPaintingDescendant, &request, this](const RenderLayer& layer) { 2813 RenderLayer::PaintedContentRequest localRequest; 2814 if (layer.isVisuallyNonEmpty(&localRequest)) { 2815 bool mayIntersect = intersectsWithAncestor(layer, m_owningLayer, compositedBounds()).value_or(true); 2816 if (mayIntersect) { 2817 hasPaintingDescendant = true; 2818 request.setHasPaintedContent(); 2819 } 2820 } 2799 2821 return (hasPaintingDescendant && request.isSatisfied()) ? LayerTraversal::Stop : LayerTraversal::Continue; 2800 2822 });
Note: See TracChangeset
for help on using the changeset viewer.