Changeset 249434 in webkit
- Timestamp:
- Sep 3, 2019, 11:25:27 AM (7 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 5 edited
-
ChangeLog (modified) (1 diff)
-
rendering/RenderLayer.cpp (modified) (1 diff)
-
rendering/RenderLayer.h (modified) (3 diffs)
-
rendering/RenderLayerCompositor.cpp (modified) (6 diffs)
-
rendering/RenderLayerCompositor.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r249433 r249434 1 2019-09-03 Simon Fraser <simon.fraser@apple.com> 2 3 Make "clips compositing descendants" an indirect compositing reason 4 https://bugs.webkit.org/show_bug.cgi?id=201381 5 6 Reviewed by Antti Koivisto. 7 8 Whether a layer has to composite to clip composited descendants is an "indirect" reason, 9 just like having to composite for filters if there's a composited descendant. So add 10 IndirectCompositingReason::Clipping, and have computeIndirectCompositingReason() compute this, 11 replacing the code that ran in computeCompositingRequirements(). 12 13 This is some preparatory cleanup for webkit.org/b/201330. 14 15 * rendering/RenderLayer.cpp: 16 (WebCore::RenderLayer::calculateClipRects const): 17 * rendering/RenderLayer.h: 18 * rendering/RenderLayerCompositor.cpp: 19 (WebCore::RenderLayerCompositor::computeCompositingRequirements): 20 (WebCore::RenderLayerCompositor::requiresCompositingLayer const): 21 (WebCore::RenderLayerCompositor::reasonsForCompositing const): 22 (WebCore::RenderLayerCompositor::computeIndirectCompositingReason const): 23 (WebCore::RenderLayerCompositor::requiresCompositingForIndirectReason const): Deleted. 24 * rendering/RenderLayerCompositor.h: 25 1 26 2019-09-03 Zalan Bujtas <zalan@apple.com> 2 27 -
trunk/Source/WebCore/rendering/RenderLayer.cpp
r249352 r249434 6922 6922 switch (reason) { 6923 6923 case IndirectCompositingReason::None: ts << "none"; break; 6924 case IndirectCompositingReason::Clipping: ts << "clipping"; break; 6924 6925 case IndirectCompositingReason::Stacking: ts << "stacking"; break; 6925 6926 case IndirectCompositingReason::OverflowScrollPositioning: ts << "overflow positioning"; break; -
trunk/Source/WebCore/rendering/RenderLayer.h
r249339 r249434 120 120 enum class IndirectCompositingReason { 121 121 None, 122 Clipping, 122 123 Stacking, 123 124 OverflowScrollPositioning, … … 1239 1240 bool m_has3DTransformedAncestor : 1; 1240 1241 1241 unsigned m_indirectCompositingReason : 3;1242 unsigned m_viewportConstrainedNotCompositedReason : 2; 1242 unsigned m_indirectCompositingReason : 4; // IndirectCompositingReason 1243 unsigned m_viewportConstrainedNotCompositedReason : 2; // ViewportConstrainedNotCompositedReason 1243 1244 1244 1245 #if PLATFORM(IOS_FAMILY) … … 1258 1259 1259 1260 #if ENABLE(CSS_COMPOSITING) 1260 unsigned m_blendMode : 5; 1261 unsigned m_blendMode : 5; // BlendMode 1261 1262 bool m_hasNotIsolatedCompositedBlendingDescendants : 1; 1262 1263 bool m_hasNotIsolatedBlendingDescendants : 1; -
trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp
r249336 r249434 1015 1015 #endif 1016 1016 // Now check for reasons to become composited that depend on the state of descendant layers. 1017 IndirectCompositingReason indirectCompositingReason; 1018 if (!willBeComposited && canBeComposited(layer) 1019 && requiresCompositingForIndirectReason(layer, currentState.subtreeIsCompositing, anyDescendantHas3DTransform, layerPaintsIntoProvidedBacking, indirectCompositingReason)) { 1020 layer.setIndirectCompositingReason(indirectCompositingReason); 1021 layerWillCompositePostDescendants(); 1022 } 1023 1017 if (!willBeComposited && canBeComposited(layer)) { 1018 auto indirectReason = computeIndirectCompositingReason(layer, currentState.subtreeIsCompositing, anyDescendantHas3DTransform, layerPaintsIntoProvidedBacking); 1019 if (indirectReason != IndirectCompositingReason::None) { 1020 layer.setIndirectCompositingReason(indirectReason); 1021 layerWillCompositePostDescendants(); 1022 } 1023 } 1024 1024 1025 if (layer.reflectionLayer()) { 1025 1026 // FIXME: Shouldn't we call computeCompositingRequirements to handle a reflection overlapping with another renderer? 1026 1027 layer.reflectionLayer()->setIndirectCompositingReason(willBeComposited ? IndirectCompositingReason::Stacking : IndirectCompositingReason::None); 1027 1028 } 1028 1029 // setHasCompositingDescendant() may have changed the answer to needsToBeComposited() when clipping, so test that now.1030 bool isCompositedClippingLayer = canBeComposited(layer) && clipsCompositingDescendants(layer);1031 if (isCompositedClippingLayer & !willBeComposited)1032 layerWillCompositePostDescendants();1033 1029 1034 1030 // If we're back at the root, and no other layers need to be composited, and the root layer itself doesn't need … … 2322 2318 return requiresCompositingForTransform(renderer) 2323 2319 || requiresCompositingForAnimation(renderer) 2324 || clipsCompositingDescendants(*renderer.layer())2325 2320 || requiresCompositingForPosition(renderer, *renderer.layer(), queryData) 2326 2321 || requiresCompositingForCanvas(renderer) … … 2449 2444 reasons.add(CompositingReason::BackfaceVisibilityHidden); 2450 2445 2451 if (clipsCompositingDescendants(*renderer.layer()))2452 reasons.add(CompositingReason::ClipsCompositingDescendants);2453 2454 2446 if (requiresCompositingForAnimation(renderer)) 2455 2447 reasons.add(CompositingReason::Animation); … … 2469 2461 switch (renderer.layer()->indirectCompositingReason()) { 2470 2462 case IndirectCompositingReason::None: 2463 break; 2464 case IndirectCompositingReason::Clipping: 2465 reasons.add(CompositingReason::ClipsCompositingDescendants); 2471 2466 break; 2472 2467 case IndirectCompositingReason::Stacking: … … 3043 3038 } 3044 3039 3045 // FIXME: why doesn't this handle the clipping cases? 3046 bool RenderLayerCompositor::requiresCompositingForIndirectReason(const RenderLayer& layer, bool hasCompositedDescendants, bool has3DTransformedDescendants, bool paintsIntoProvidedBacking, IndirectCompositingReason& reason) const 3040 IndirectCompositingReason RenderLayerCompositor::computeIndirectCompositingReason(const RenderLayer& layer, bool hasCompositedDescendants, bool has3DTransformedDescendants, bool paintsIntoProvidedBacking) const 3047 3041 { 3048 3042 // When a layer has composited descendants, some effects, like 2d transforms, filters, masks etc must be implemented 3049 3043 // via compositing so that they also apply to those composited descendants. 3050 3044 auto& renderer = layer.renderer(); 3051 if (hasCompositedDescendants && (layer.isolatesCompositedBlending() || layer.transform() || renderer.createsGroup() || renderer.hasReflection())) { 3052 reason = IndirectCompositingReason::GraphicalEffect; 3053 return true; 3054 } 3045 if (hasCompositedDescendants && (layer.isolatesCompositedBlending() || layer.transform() || renderer.createsGroup() || renderer.hasReflection())) 3046 return IndirectCompositingReason::GraphicalEffect; 3055 3047 3056 3048 // A layer with preserve-3d or perspective only needs to be composited if there are descendant layers that 3057 3049 // will be affected by the preserve-3d or perspective. 3058 3050 if (has3DTransformedDescendants) { 3059 if (renderer.style().transformStyle3D() == TransformStyle3D::Preserve3D) { 3060 reason = IndirectCompositingReason::Preserve3D; 3061 return true; 3062 } 3051 if (renderer.style().transformStyle3D() == TransformStyle3D::Preserve3D) 3052 return IndirectCompositingReason::Preserve3D; 3063 3053 3064 if (renderer.style().hasPerspective()) { 3065 reason = IndirectCompositingReason::Perspective; 3066 return true; 3067 } 3054 if (renderer.style().hasPerspective()) 3055 return IndirectCompositingReason::Perspective; 3068 3056 } 3069 3057 … … 3071 3059 if (!paintsIntoProvidedBacking && layer.hasCompositedScrollingAncestor()) { 3072 3060 auto* paintDestination = layer.paintOrderParent(); 3073 if (paintDestination && layerScrollBehahaviorRelativeToCompositedAncestor(layer, *paintDestination) != ScrollPositioningBehavior::None) { 3074 reason = IndirectCompositingReason::OverflowScrollPositioning; 3075 return true; 3076 } 3077 } 3078 3079 reason = IndirectCompositingReason::None; 3080 return false; 3061 if (paintDestination && layerScrollBehahaviorRelativeToCompositedAncestor(layer, *paintDestination) != ScrollPositioningBehavior::None) 3062 return IndirectCompositingReason::OverflowScrollPositioning; 3063 } 3064 3065 // Check for clipping last; if compositing just for clipping, the layer doesn't need its own backing store. 3066 if (hasCompositedDescendants && clipsCompositingDescendants(layer)) 3067 return IndirectCompositingReason::Clipping; 3068 3069 return IndirectCompositingReason::None; 3081 3070 } 3082 3071 -
trunk/Source/WebCore/rendering/RenderLayerCompositor.h
r248762 r249434 499 499 bool requiresCompositingForOverflowScrolling(const RenderLayer&, RequiresCompositingData&) const; 500 500 bool requiresCompositingForEditableImage(RenderLayerModelObject&) const; 501 bool requiresCompositingForIndirectReason(const RenderLayer&, bool hasCompositedDescendants, bool has3DTransformedDescendants, bool paintsIntoProvidedBacking, IndirectCompositingReason&) const;501 IndirectCompositingReason computeIndirectCompositingReason(const RenderLayer&, bool hasCompositedDescendants, bool has3DTransformedDescendants, bool paintsIntoProvidedBacking) const; 502 502 503 503 static ScrollPositioningBehavior layerScrollBehahaviorRelativeToCompositedAncestor(const RenderLayer&, const RenderLayer& compositedAncestor);
Note:
See TracChangeset
for help on using the changeset viewer.