Changeset 246869 in webkit
- Timestamp:
- Jun 26, 2019 9:13:15 PM (5 years ago)
- Location:
- trunk
- Files:
-
- 7 added
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r246868 r246869 1 2019-06-26 Simon Fraser <simon.fraser@apple.com> 2 3 [Async overflow scrolling] Fix missing or misplaced content inside overflow:scroll 4 https://bugs.webkit.org/show_bug.cgi?id=199253 5 6 Reviewed by Zalan Bujtas. 7 8 * compositing/geometry/limit-layer-bounds-clipping-ancestor-expected.txt: 9 * compositing/layer-creation/clipping-scope/overlap-constrained-inside-scroller-expected.txt: 10 * compositing/layer-creation/clipping-scope/scroller-with-negative-z-children-expected.txt: 11 * compositing/rtl/rtl-scrolling-with-transformed-descendants-expected.txt: 12 * compositing/scrolling/async-overflow-scrolling/hidden-relative-layer-content-in-scroller-expected.html: Added. 13 * compositing/scrolling/async-overflow-scrolling/hidden-relative-layer-content-in-scroller.html: Added. 14 * compositing/scrolling/async-overflow-scrolling/layer-for-negative-z-in-scroller-expected.txt: Added. 15 * compositing/scrolling/async-overflow-scrolling/layer-for-negative-z-in-scroller.html: Added. 16 * compositing/scrolling/async-overflow-scrolling/negative-z-in-scroller-expected.html: Added. 17 * compositing/scrolling/async-overflow-scrolling/negative-z-in-scroller.html: Added. 18 * compositing/shared-backing/overflow-scroll/nested-absolute-with-clipping-in-stacking-overflow-expected.txt: 19 * platform/ios-wk2/compositing/layer-creation/clipping-scope/overlap-constrained-inside-scroller-expected.txt: 20 * platform/ios-wk2/compositing/layer-creation/clipping-scope/scroller-with-negative-z-children-expected.txt: 21 * platform/ios-wk2/compositing/scrolling/async-overflow-scrolling/layer-for-negative-z-in-scroller-expected.txt: Added. 22 * platform/ios-wk2/compositing/shared-backing/overflow-scroll/nested-absolute-with-clipping-in-stacking-overflow-expected.txt: 23 * platform/ios/compositing/geometry/limit-layer-bounds-clipping-ancestor-expected.txt: 24 1 25 2019-06-26 Ryosuke Niwa <rniwa@webkit.org> 2 26 -
trunk/LayoutTests/compositing/geometry/limit-layer-bounds-clipping-ancestor-expected.txt
r246725 r246869 28 28 (GraphicsLayer 29 29 (offsetFromRenderer width=0 height=100) 30 (bounds 149.00 200.00) 30 (bounds 149.00 2086.00) 31 (usingTiledLayer 1) 31 32 (drawsContent 1) 32 33 ) -
trunk/LayoutTests/compositing/layer-creation/clipping-scope/overlap-constrained-inside-scroller-expected.txt
r246725 r246869 6 6 (bounds 800.00 600.00) 7 7 (contentsOpaque 1) 8 (children 58 (children 6 9 9 (GraphicsLayer 10 10 (position 8.00 8.00) … … 70 70 ) 71 71 ) 72 (GraphicsLayer 73 (position 9.00 9.00) 74 (bounds 285.00 300.00) 75 (children 1 76 (GraphicsLayer 77 (position 40.00 380.00) 78 (bounds 100.00 100.00) 79 (contentsOpaque 1) 80 ) 81 ) 82 ) 72 83 ) 73 84 ) -
trunk/LayoutTests/compositing/layer-creation/clipping-scope/scroller-with-negative-z-children-expected.txt
r246725 r246869 6 6 (bounds 800.00 600.00) 7 7 (contentsOpaque 1) 8 (children 48 (children 1 9 9 (GraphicsLayer 10 (position 8.00 8.00) 11 (bounds 302.00 302.00) 10 (bounds 800.00 600.00) 12 11 (drawsContent 1) 13 (children 112 (children 7 14 13 (GraphicsLayer 15 (offsetFromRenderer width=1 height=1) 16 (position 1.00 1.00) 14 (position 9.00 9.00) 17 15 (bounds 285.00 300.00) 18 16 (children 1 19 17 (GraphicsLayer 20 ( offsetFromRenderer width=1 height=1)21 ( anchor 0.000.00)22 ( bounds 285.00 500.00)18 (position 40.00 140.00) 19 (bounds 100.00 100.00) 20 (contentsOpaque 1) 23 21 ) 24 22 ) 25 23 ) 26 )27 )28 (GraphicsLayer29 (position 9.00 9.00)30 (bounds 285.00 300.00)31 (children 132 24 (GraphicsLayer 33 (position 10.00 10.00) 34 (bounds 50.00 200.00) 35 (contentsOpaque 1) 25 (bounds 800.00 600.00) 26 (drawsContent 1) 36 27 ) 37 )38 )39 (GraphicsLayer40 (position 9.00 9.00)41 (bounds 285.00 300.00)42 (children 143 28 (GraphicsLayer 44 (position 40.00 20.00) 45 (bounds 100.00 100.00) 46 (contentsOpaque 1) 29 (position 8.00 8.00) 30 (bounds 302.00 302.00) 31 (drawsContent 1) 32 (children 1 33 (GraphicsLayer 34 (offsetFromRenderer width=1 height=1) 35 (position 1.00 1.00) 36 (bounds 285.00 300.00) 37 (children 1 38 (GraphicsLayer 39 (offsetFromRenderer width=1 height=1) 40 (anchor 0.00 0.00) 41 (bounds 285.00 500.00) 42 ) 43 ) 44 ) 45 ) 47 46 ) 48 )49 )50 (GraphicsLayer51 (position 9.00 9.00)52 (bounds 285.00 300.00)53 (children 154 47 (GraphicsLayer 55 (position 40.00 260.00) 56 (bounds 100.00 100.00) 57 (contentsOpaque 1) 48 (position 9.00 9.00) 49 (bounds 285.00 300.00) 50 (children 1 51 (GraphicsLayer 52 (position 10.00 10.00) 53 (bounds 50.00 200.00) 54 (contentsOpaque 1) 55 ) 56 ) 57 ) 58 (GraphicsLayer 59 (position 9.00 9.00) 60 (bounds 285.00 300.00) 61 (children 1 62 (GraphicsLayer 63 (position 40.00 20.00) 64 (bounds 100.00 100.00) 65 (contentsOpaque 1) 66 ) 67 ) 68 ) 69 (GraphicsLayer 70 (position 9.00 9.00) 71 (bounds 285.00 300.00) 72 (children 1 73 (GraphicsLayer 74 (position 40.00 260.00) 75 (bounds 100.00 100.00) 76 (contentsOpaque 1) 77 ) 78 ) 79 ) 80 (GraphicsLayer 81 (position 9.00 9.00) 82 (bounds 285.00 300.00) 83 (children 1 84 (GraphicsLayer 85 (position 40.00 380.00) 86 (bounds 100.00 100.00) 87 (contentsOpaque 1) 88 ) 89 ) 58 90 ) 59 91 ) -
trunk/LayoutTests/compositing/rtl/rtl-scrolling-with-transformed-descendants-expected.txt
r246725 r246869 8 8 (bounds 800.00 600.00) 9 9 (contentsOpaque 1) 10 (children 310 (children 5 11 11 (GraphicsLayer 12 12 (position 8.00 8.00) … … 59 59 ) 60 60 ) 61 (GraphicsLayer 62 (position 10.00 10.00) 63 (bounds origin 366.00 0.00) 64 (bounds 400.00 204.00) 65 (clips 1) 66 (children 1 67 (GraphicsLayer 68 (position 154.00 0.00) 69 (bounds 150.00 200.00) 70 (contentsOpaque 1) 71 ) 72 ) 73 ) 74 (GraphicsLayer 75 (position 10.00 10.00) 76 (bounds origin 366.00 0.00) 77 (bounds 400.00 204.00) 78 (clips 1) 79 (children 1 80 (GraphicsLayer 81 (bounds 150.00 200.00) 82 (contentsOpaque 1) 83 ) 84 ) 85 ) 61 86 ) 62 87 ) -
trunk/LayoutTests/compositing/shared-backing/overflow-scroll/nested-absolute-with-clipping-in-stacking-overflow-expected.txt
r245170 r246869 29 29 (contentsOpaque 1) 30 30 (drawsContent 1) 31 (children 132 (GraphicsLayer33 (bounds 140.00 140.00)34 )35 )36 31 ) 37 32 ) -
trunk/LayoutTests/platform/ios-wk2/compositing/layer-creation/clipping-scope/overlap-constrained-inside-scroller-expected.txt
r246725 r246869 6 6 (bounds 800.00 600.00) 7 7 (contentsOpaque 1) 8 (children 58 (children 6 9 9 (GraphicsLayer 10 10 (position 8.00 8.00) … … 70 70 ) 71 71 ) 72 (GraphicsLayer 73 (position 9.00 9.00) 74 (bounds 300.00 300.00) 75 (children 1 76 (GraphicsLayer 77 (position 40.00 380.00) 78 (bounds 100.00 100.00) 79 (contentsOpaque 1) 80 ) 81 ) 82 ) 72 83 ) 73 84 ) -
trunk/LayoutTests/platform/ios-wk2/compositing/layer-creation/clipping-scope/scroller-with-negative-z-children-expected.txt
r246725 r246869 6 6 (bounds 800.00 600.00) 7 7 (contentsOpaque 1) 8 (children 48 (children 1 9 9 (GraphicsLayer 10 (position 8.00 8.00) 11 (bounds 302.00 302.00) 10 (bounds 800.00 600.00) 12 11 (drawsContent 1) 13 (children 112 (children 7 14 13 (GraphicsLayer 15 (offsetFromRenderer width=1 height=1) 16 (position 1.00 1.00) 14 (position 9.00 9.00) 17 15 (bounds 300.00 300.00) 18 16 (children 1 19 17 (GraphicsLayer 20 ( offsetFromRenderer width=1 height=1)21 ( anchor 0.000.00)22 ( bounds 300.00 500.00)18 (position 40.00 140.00) 19 (bounds 100.00 100.00) 20 (contentsOpaque 1) 23 21 ) 24 22 ) 25 23 ) 26 )27 )28 (GraphicsLayer29 (position 9.00 9.00)30 (bounds 300.00 300.00)31 (children 132 24 (GraphicsLayer 33 (position 10.00 10.00) 34 (bounds 50.00 200.00) 35 (contentsOpaque 1) 25 (bounds 800.00 600.00) 26 (drawsContent 1) 36 27 ) 37 )38 )39 (GraphicsLayer40 (position 9.00 9.00)41 (bounds 300.00 300.00)42 (children 143 28 (GraphicsLayer 44 (position 40.00 20.00) 45 (bounds 100.00 100.00) 46 (contentsOpaque 1) 29 (position 8.00 8.00) 30 (bounds 302.00 302.00) 31 (drawsContent 1) 32 (children 1 33 (GraphicsLayer 34 (offsetFromRenderer width=1 height=1) 35 (position 1.00 1.00) 36 (bounds 300.00 300.00) 37 (children 1 38 (GraphicsLayer 39 (offsetFromRenderer width=1 height=1) 40 (anchor 0.00 0.00) 41 (bounds 300.00 500.00) 42 ) 43 ) 44 ) 45 ) 47 46 ) 48 )49 )50 (GraphicsLayer51 (position 9.00 9.00)52 (bounds 300.00 300.00)53 (children 154 47 (GraphicsLayer 55 (position 40.00 260.00) 56 (bounds 100.00 100.00) 57 (contentsOpaque 1) 48 (position 9.00 9.00) 49 (bounds 300.00 300.00) 50 (children 1 51 (GraphicsLayer 52 (position 10.00 10.00) 53 (bounds 50.00 200.00) 54 (contentsOpaque 1) 55 ) 56 ) 57 ) 58 (GraphicsLayer 59 (position 9.00 9.00) 60 (bounds 300.00 300.00) 61 (children 1 62 (GraphicsLayer 63 (position 40.00 20.00) 64 (bounds 100.00 100.00) 65 (contentsOpaque 1) 66 ) 67 ) 68 ) 69 (GraphicsLayer 70 (position 9.00 9.00) 71 (bounds 300.00 300.00) 72 (children 1 73 (GraphicsLayer 74 (position 40.00 260.00) 75 (bounds 100.00 100.00) 76 (contentsOpaque 1) 77 ) 78 ) 79 ) 80 (GraphicsLayer 81 (position 9.00 9.00) 82 (bounds 300.00 300.00) 83 (children 1 84 (GraphicsLayer 85 (position 40.00 380.00) 86 (bounds 100.00 100.00) 87 (contentsOpaque 1) 88 ) 89 ) 58 90 ) 59 91 ) -
trunk/LayoutTests/platform/ios-wk2/compositing/shared-backing/overflow-scroll/nested-absolute-with-clipping-in-stacking-overflow-expected.txt
r245170 r246869 29 29 (contentsOpaque 1) 30 30 (drawsContent 1) 31 (children 132 (GraphicsLayer33 (bounds 140.00 140.00)34 )35 )36 31 ) 37 32 ) -
trunk/LayoutTests/platform/ios/compositing/geometry/limit-layer-bounds-clipping-ancestor-expected.txt
r246725 r246869 28 28 (GraphicsLayer 29 29 (offsetFromRenderer width=0 height=100) 30 (bounds 149.00 200.00) 30 (bounds 149.00 2086.00) 31 (usingTiledLayer 1) 31 32 (drawsContent 1) 32 33 ) -
trunk/Source/WebCore/ChangeLog
r246868 r246869 1 2019-06-26 Simon Fraser <simon.fraser@apple.com> 2 3 [Async overflow scrolling] Fix missing or misplaced content inside overflow:scroll 4 https://bugs.webkit.org/show_bug.cgi?id=199253 5 rdar://problem/51855156, rdar://problem/51934514 6 7 Reviewed by Zalan Bujtas. 8 9 This patch fixes a couple of related issues triggered by failing to composite layers inside non-stacking-context 10 overflow scroll. 11 12 First, we relied on overlap testing to composite position:relative layers inside overflow:scroll, but this only 13 worked when they came later in z-order, so didn't work for layers with negative z-index. 14 RenderLayerCompositor::requiresCompositingForIndirectReason() was intended to trigger compositing in such cases, 15 but it only did so for position:absolute inside stacking-context scroller, because 16 isNonScrolledLayerInsideScrolledCompositedAncestor() tested ancestorMovedByScroller && !layerMovedByScroller. 17 18 I fixed this by sharing code between the three places that ask whether compositing crosses a containing-block 19 boundary to call a single function, RenderLayerCompositor::layerScrollBehahaviorRelativeToCompositedAncestor(), 20 that returns a ScrollPositioningBehavior. We now do compositing for both "moves" and "stationary" behaviors (but 21 not "none"), ensuring that position:relative inside non-stacking scroller is always composited. 22 23 However, this would trigger compositing on layers that should be using backing sharing; if they were outside the 24 visible part of the scroller, the overlap code would not trigger, but the 25 "IndirectCompositingReason::OverflowScrollPositioning" code would. This is undesirable; any layer that can use 26 backing sharing should, because that's fewer composited layers, so smaller layer trees and less backing store. 27 To fix this, I moved the backing-sharing check before the overlap check in 28 RenderLayerCompositor::computeCompositingRequirements(). 29 30 The "layer.setHasCompositingDescendant(currentState.subtreeIsCompositing)" line was in the wrong place, 31 triggering assertions on some content; "subtreeIsCompositing" only refers to child layers, so this bit needs to 32 be set right after we've traversed the z-order lists. 33 34 Tests: compositing/scrolling/async-overflow-scrolling/hidden-relative-layer-content-in-scroller.html 35 compositing/scrolling/async-overflow-scrolling/layer-for-negative-z-in-scroller.html 36 compositing/scrolling/async-overflow-scrolling/negative-z-in-scroller.html 37 38 * rendering/RenderLayerCompositor.cpp: 39 (WebCore::RenderLayerCompositor::computeCompositingRequirements): 40 (WebCore::RenderLayerCompositor::traverseUnchangedSubtree): 41 (WebCore::RenderLayerCompositor::requiresCompositingForIndirectReason const): 42 (WebCore::isScrolledByOverflowScrollLayer): 43 (WebCore::enclosingCompositedScrollingLayer): 44 (WebCore::RenderLayerCompositor::layerScrollBehahaviorRelativeToCompositedAncestor): 45 (WebCore::RenderLayerCompositor::computeCoordinatedPositioningForLayer const): 46 (WebCore::isNonScrolledLayerInsideScrolledCompositedAncestor): Deleted. 47 (WebCore::RenderLayerCompositor::layerContainingBlockCrossesCoordinatedScrollingBoundary): Deleted. 48 * rendering/RenderLayerCompositor.h: 49 1 50 2019-06-26 Ryosuke Niwa <rniwa@webkit.org> 2 51 -
trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp
r246725 r246869 864 864 bool willBeComposited = layer.isComposited(); 865 865 bool becameCompositedAfterDescendantTraversal = false; 866 IndirectCompositingReason compositingReason = compositingState.subtreeIsCompositing ? IndirectCompositingReason::Stacking : IndirectCompositingReason::None; 866 867 867 868 if (layer.needsPostLayoutCompositingUpdate() || compositingState.fullPaintOrderTraversalRequired || compositingState.descendantsRequireCompositingUpdate) { 868 869 layer.setIndirectCompositingReason(IndirectCompositingReason::None); 869 870 willBeComposited = needsToBeComposited(layer, queryData); 871 } 872 873 bool layerPaintsIntoProvidedBacking = false; 874 if (!willBeComposited && compositingState.subtreeIsCompositing && backingSharingState.backingProviderCandidate() && canBeComposited(layer) && backingProviderLayerCanIncludeLayer(*backingSharingState.backingProviderCandidate(), layer)) { 875 backingSharingState.appendSharingLayer(layer); 876 LOG(Compositing, " layer %p can share with %p", &layer, backingSharingState.backingProviderCandidate()); 877 compositingReason = IndirectCompositingReason::None; 878 layerPaintsIntoProvidedBacking = true; 870 879 } 871 880 … … 881 890 overlapMap.geometryMap().pushMappingsToAncestor(&layer, ancestorLayer, respectTransforms); 882 891 883 IndirectCompositingReason compositingReason = compositingState.subtreeIsCompositing ? IndirectCompositingReason::Stacking : IndirectCompositingReason::None;884 bool layerPaintsIntoProvidedBacking = false;885 bool didPushOverlapContainer = false;886 887 892 // If we know for sure the layer is going to be composited, don't bother looking it up in the overlap map 888 if (!willBeComposited && ! overlapMap.isEmpty() && compositingState.testingOverlap) {893 if (!willBeComposited && !layerPaintsIntoProvidedBacking && !overlapMap.isEmpty() && compositingState.testingOverlap) { 889 894 // If we're testing for overlap, we only need to composite if we overlap something that is already composited. 890 if (layerOverlaps(overlapMap, layer, layerExtent)) { 891 if (backingSharingState.backingProviderCandidate() && canBeComposited(layer) && backingProviderLayerCanIncludeLayer(*backingSharingState.backingProviderCandidate(), layer)) { 892 backingSharingState.appendSharingLayer(layer); 893 LOG(Compositing, " layer %p can share with %p", &layer, backingSharingState.backingProviderCandidate()); 894 compositingReason = IndirectCompositingReason::None; 895 layerPaintsIntoProvidedBacking = true; 896 } else 897 compositingReason = IndirectCompositingReason::Overlap; 898 } else 895 if (layerOverlaps(overlapMap, layer, layerExtent)) 896 compositingReason = IndirectCompositingReason::Overlap; 897 else 899 898 compositingReason = IndirectCompositingReason::None; 900 899 } … … 923 922 // ancestor with subtreeIsCompositing set to false. 924 923 CompositingState currentState = compositingState.stateForPaintOrderChildren(layer); 924 bool didPushOverlapContainer = false; 925 925 926 926 auto layerWillComposite = [&] { … … 994 994 computeCompositingRequirements(&layer, *childLayer, overlapMap, currentState, backingSharingState, anyDescendantHas3DTransform); 995 995 996 // Set the flag to say that this layer has compositing children. 997 layer.setHasCompositingDescendant(currentState.subtreeIsCompositing); 998 996 999 // If we just entered compositing mode, the root will have become composited (as long as accelerated compositing is enabled). 997 1000 if (layer.isRenderViewLayer()) { … … 1022 1025 layer.reflectionLayer()->setIndirectCompositingReason(willBeComposited ? IndirectCompositingReason::Stacking : IndirectCompositingReason::None); 1023 1026 } 1024 1025 // Set the flag to say that this layer has compositing children.1026 layer.setHasCompositingDescendant(currentState.subtreeIsCompositing);1027 1027 1028 1028 // setHasCompositingDescendant() may have changed the answer to needsToBeComposited() when clipping, so test that now. … … 1151 1151 ASSERT(layerIsComposited); 1152 1152 } 1153 1153 1154 1154 for (auto* childLayer : layer.normalFlowLayers()) 1155 1155 traverseUnchangedSubtree(&layer, *childLayer, overlapMap, currentState, backingSharingState, anyDescendantHas3DTransform); … … 2993 2993 } 2994 2994 2995 static RenderLayer* enclosingCompositedScrollingLayer(const RenderLayer& layer, const RenderLayer& intermediateLayer, bool& sawIntermediateLayer)2996 {2997 const auto* ancestorLayer = layer.parent();2998 while (ancestorLayer) {2999 if (ancestorLayer == &intermediateLayer)3000 sawIntermediateLayer = true;3001 3002 if (ancestorLayer->hasCompositedScrollableOverflow())3003 return const_cast<RenderLayer*>(ancestorLayer);3004 3005 ancestorLayer = ancestorLayer->parent();3006 }3007 3008 return nullptr;3009 }3010 3011 static bool isScrolledByOverflowScrollLayer(const RenderLayer& layer, const RenderLayer& overflowScrollLayer)3012 {3013 bool scrolledByOverflowScroll = false;3014 traverseAncestorLayers(layer, [&](const RenderLayer& ancestorLayer, bool inContainingBlockChain, bool) {3015 if (&ancestorLayer == &overflowScrollLayer) {3016 scrolledByOverflowScroll = inContainingBlockChain;3017 return AncestorTraversal::Stop;3018 }3019 return AncestorTraversal::Continue;3020 });3021 return scrolledByOverflowScroll;3022 }3023 3024 static bool isNonScrolledLayerInsideScrolledCompositedAncestor(const RenderLayer& layer, const RenderLayer& compositedAncestor, const RenderLayer& scrollingAncestor)3025 {3026 bool ancestorMovedByScroller = &compositedAncestor == &scrollingAncestor || isScrolledByOverflowScrollLayer(compositedAncestor, scrollingAncestor);3027 bool layerMovedByScroller = isScrolledByOverflowScrollLayer(layer, scrollingAncestor);3028 3029 return ancestorMovedByScroller && !layerMovedByScroller;3030 }3031 3032 2995 // FIXME: why doesn't this handle the clipping cases? 3033 2996 bool RenderLayerCompositor::requiresCompositingForIndirectReason(const RenderLayer& layer, bool hasCompositedDescendants, bool has3DTransformedDescendants, bool paintsIntoProvidedBacking, IndirectCompositingReason& reason) const … … 3058 3021 if (!paintsIntoProvidedBacking && layer.hasCompositedScrollingAncestor()) { 3059 3022 auto* paintDestination = layer.paintOrderParent(); 3060 bool paintDestinationIsScrolling = false; 3061 auto* scrollingAncestor = enclosingCompositedScrollingLayer(layer, *paintDestination, paintDestinationIsScrolling); 3062 if (isNonScrolledLayerInsideScrolledCompositedAncestor(layer, *paintDestination, *scrollingAncestor)) { 3023 if (paintDestination && layerScrollBehahaviorRelativeToCompositedAncestor(layer, *paintDestination) != ScrollPositioningBehavior::None) { 3063 3024 reason = IndirectCompositingReason::OverflowScrollPositioning; 3064 3025 return true; … … 3165 3126 } 3166 3127 3167 bool RenderLayerCompositor::layerContainingBlockCrossesCoordinatedScrollingBoundary(const RenderLayer& layer, const RenderLayer& compositedAncestor) 3168 { 3128 static bool isScrolledByOverflowScrollLayer(const RenderLayer& layer, const RenderLayer& overflowScrollLayer) 3129 { 3130 bool scrolledByOverflowScroll = false; 3131 traverseAncestorLayers(layer, [&](const RenderLayer& ancestorLayer, bool inContainingBlockChain, bool) { 3132 if (&ancestorLayer == &overflowScrollLayer) { 3133 scrolledByOverflowScroll = inContainingBlockChain; 3134 return AncestorTraversal::Stop; 3135 } 3136 return AncestorTraversal::Continue; 3137 }); 3138 return scrolledByOverflowScroll; 3139 } 3140 3141 static RenderLayer* enclosingCompositedScrollingLayer(const RenderLayer& layer, const RenderLayer& intermediateLayer, bool& sawIntermediateLayer) 3142 { 3143 const auto* ancestorLayer = layer.parent(); 3144 while (ancestorLayer) { 3145 if (ancestorLayer == &intermediateLayer) 3146 sawIntermediateLayer = true; 3147 3148 if (ancestorLayer->hasCompositedScrollableOverflow()) 3149 return const_cast<RenderLayer*>(ancestorLayer); 3150 3151 ancestorLayer = ancestorLayer->parent(); 3152 } 3153 3154 return nullptr; 3155 } 3156 3157 ScrollPositioningBehavior RenderLayerCompositor::layerScrollBehahaviorRelativeToCompositedAncestor(const RenderLayer& layer, const RenderLayer& compositedAncestor) 3158 { 3159 if (!layer.hasCompositedScrollingAncestor()) 3160 return ScrollPositioningBehavior::None; 3161 3169 3162 bool compositedAncestorIsInsideScroller = false; 3170 3163 auto* scrollingAncestor = enclosingCompositedScrollingLayer(layer, compositedAncestor, compositedAncestorIsInsideScroller); 3171 3164 if (!scrollingAncestor) { 3172 3165 ASSERT_NOT_REACHED(); // layer.hasCompositedScrollingAncestor() should guarantee we have one. 3173 return false;3166 return ScrollPositioningBehavior::None; 3174 3167 } 3175 3168 3176 if (!compositedAncestorIsInsideScroller) 3177 return false; 3178 3179 return isNonScrolledLayerInsideScrolledCompositedAncestor(layer, compositedAncestor, *scrollingAncestor); 3169 bool ancestorMovedByScroller = &compositedAncestor == scrollingAncestor || (compositedAncestorIsInsideScroller && isScrolledByOverflowScrollLayer(compositedAncestor, *scrollingAncestor)); 3170 bool layerMovedByScroller = isScrolledByOverflowScrollLayer(layer, *scrollingAncestor); 3171 3172 if (ancestorMovedByScroller == layerMovedByScroller) 3173 return ScrollPositioningBehavior::None; 3174 3175 return layerMovedByScroller ? ScrollPositioningBehavior::Moves : ScrollPositioningBehavior::Stationary; 3180 3176 } 3181 3177 … … 3228 3224 } 3229 3225 3230 bool compositedAncestorIsScrolling = false; 3231 auto* scrollingAncestor = enclosingCompositedScrollingLayer(layer, *compositedAncestor, compositedAncestorIsScrolling); 3232 if (!scrollingAncestor) { 3233 ASSERT_NOT_REACHED(); // layer.hasCompositedScrollingAncestor() should guarantee we have one. 3234 return ScrollPositioningBehavior::None; 3235 } 3236 3237 // There are two cases we have to deal with here: 3238 // 1. There's a composited overflow:scroll in the parent chain between the renderer and its containing block, and the layer's 3239 // composited (z-order) ancestor is inside the scroller or is the scroller. In this case, we have to compensate for scroll position 3240 // changes to make the positioned layer stay in the same place. This only applies to position:absolute or descendants of position:absolute. 3241 if (compositedAncestorIsScrolling && isNonScrolledLayerInsideScrolledCompositedAncestor(layer, *compositedAncestor, *scrollingAncestor)) 3242 return ScrollPositioningBehavior::Stationary; 3243 3244 // 2. The layer's containing block is the overflow or inside the overflow:scroll, but its z-order ancestor is 3245 // outside the overflow:scroll. In that case, we have to move the layer via the scrolling tree to make 3246 // it move along with the overflow scrolling. 3247 if (!compositedAncestorIsScrolling && isScrolledByOverflowScrollLayer(layer, *scrollingAncestor)) 3248 return ScrollPositioningBehavior::Moves; 3249 3250 return ScrollPositioningBehavior::None; 3226 return layerScrollBehahaviorRelativeToCompositedAncestor(layer, *compositedAncestor); 3251 3227 } 3252 3228 -
trunk/Source/WebCore/rendering/RenderLayerCompositor.h
r246725 r246869 498 498 bool requiresCompositingForIndirectReason(const RenderLayer&, bool hasCompositedDescendants, bool has3DTransformedDescendants, bool paintsIntoProvidedBacking, IndirectCompositingReason&) const; 499 499 500 static bool layerContainingBlockCrossesCoordinatedScrollingBoundary(const RenderLayer&, const RenderLayer& compositedAncestor);500 static ScrollPositioningBehavior layerScrollBehahaviorRelativeToCompositedAncestor(const RenderLayer&, const RenderLayer& compositedAncestor); 501 501 502 502 static bool styleChangeMayAffectIndirectCompositingReasons(const RenderStyle& oldStyle, const RenderStyle& newStyle);
Note: See TracChangeset
for help on using the changeset viewer.