Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1967)

Unified Diff: Source/core/rendering/RenderLayer.cpp

Issue 313653004: Fix composited bounds of reflections. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Added static. Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/rendering/RenderLayer.cpp
diff --git a/Source/core/rendering/RenderLayer.cpp b/Source/core/rendering/RenderLayer.cpp
index 02068ddf33e45708e2014378bbc0ef76fa58f6b8..1edbf10504a2281785018ebc8ea62bf2a254017b 100644
--- a/Source/core/rendering/RenderLayer.cpp
+++ b/Source/core/rendering/RenderLayer.cpp
@@ -3356,6 +3356,21 @@ LayoutRect RenderLayer::physicalBoundingBoxIncludingReflectionAndStackingChildre
return result;
}
+static void expandCompositingRectForStackingChildren(const RenderLayer* ancestorLayer, RenderLayer::CalculateBoundsOptions options, LayoutRect& result)
+{
+ RenderLayerStackingNodeIterator iterator(*ancestorLayer->stackingNode(), AllChildren);
+ while (RenderLayerStackingNode* node = iterator.next()) {
+ // Here we exclude both directly composited layers and squashing layers
+ // because those RenderLayers don't paint into the graphics layer
+ // for this RenderLayer. For example, the bounds of squashed RenderLayers
+ // will be included in the computation of the appropriate squashing
+ // GraphicsLayer.
+ if (options != RenderLayer::ApplyBoundsChickenEggHacks && node->layer()->compositingState() != NotComposited)
+ continue;
+ result.unite(node->layer()->boundingBoxForCompositing(ancestorLayer, options));
+ }
+}
+
LayoutRect RenderLayer::boundingBoxForCompositing(const RenderLayer* ancestorLayer, CalculateBoundsOptions options) const
{
if (!isSelfPaintingLayer())
@@ -3399,17 +3414,15 @@ LayoutRect RenderLayer::boundingBoxForCompositing(const RenderLayer* ancestorLay
LayerListMutationDetector mutationChecker(const_cast<RenderLayer*>(this)->stackingNode());
#endif
- RenderLayerStackingNodeIterator iterator(*m_stackingNode.get(), AllChildren);
- while (RenderLayerStackingNode* node = iterator.next()) {
- // Here we exclude both directly composited layers and squashing layers
- // because those RenderLayers don't paint into the graphics layer
- // for this RenderLayer. For example, the bounds of squashed RenderLayers
- // will be included in the computation of the appropriate squashing
- // GraphicsLayer.
- if (options != ApplyBoundsChickenEggHacks && node->layer()->compositingState() != NotComposited)
- continue;
- result.unite(node->layer()->boundingBoxForCompositing(this, options));
- }
+ // Reflections are implemented with RenderLayers that hang off of the reflected layer. However,
+ // the reflection layer subtree does not include the subtree of the parent RenderLayer, so
+ // a recursive computation of stacking children yields no results. This breaks cases when there are stacking
+ // children of the parent, that need to be included in reflected composited bounds.
+ // Fix this by including composited bounds of stacking children of the reflected RenderLayer.
+ if (parent() && parent()->reflectionInfo() && parent()->reflectionInfo()->reflectionLayer() == this)
+ expandCompositingRectForStackingChildren(parent(), options, result);
+ else
+ expandCompositingRectForStackingChildren(this, options, result);
// FIXME: We can optimize the size of the composited layers, by not enlarging
// filtered areas with the outsets if we know that the filter is going to render in hardware.
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698