Index: Source/core/rendering/RenderLayerCompositor.cpp |
diff --git a/Source/core/rendering/RenderLayerCompositor.cpp b/Source/core/rendering/RenderLayerCompositor.cpp |
index d3d203369b95fc7c92df4d1c9d723c1a2a85be29..b4c8ad3d1cb7da545a04003d3b7199c8d234e651 100644 |
--- a/Source/core/rendering/RenderLayerCompositor.cpp |
+++ b/Source/core/rendering/RenderLayerCompositor.cpp |
@@ -180,6 +180,7 @@ struct CompositingState { |
CompositingState(RenderLayer* compAncestor, bool testOverlap) |
: m_compositingAncestor(compAncestor) |
, m_subtreeIsCompositing(false) |
+ , m_hasCompositedBlendingDescendents(false) |
shawnsingh
2013/09/13 10:22:59
Let's spell it "Descendants" instead... that way t
rosca
2013/09/19 14:26:54
Done.
|
, m_testingOverlap(testOverlap) |
#ifndef NDEBUG |
, m_depth(0) |
@@ -190,6 +191,7 @@ struct CompositingState { |
CompositingState(const CompositingState& other) |
: m_compositingAncestor(other.m_compositingAncestor) |
, m_subtreeIsCompositing(other.m_subtreeIsCompositing) |
+ , m_hasCompositedBlendingDescendents(other.m_hasCompositedBlendingDescendents) |
, m_testingOverlap(other.m_testingOverlap) |
#ifndef NDEBUG |
, m_depth(other.m_depth + 1) |
@@ -199,6 +201,7 @@ struct CompositingState { |
RenderLayer* m_compositingAncestor; |
bool m_subtreeIsCompositing; |
+ bool m_hasCompositedBlendingDescendents; |
bool m_testingOverlap; |
#ifndef NDEBUG |
int m_depth; |
@@ -784,6 +787,7 @@ void RenderLayerCompositor::computeCompositingRequirements(RenderLayer* ancestor |
// Clear the flag |
layer->setHasCompositingDescendant(false); |
+ layer->setShouldIsolateCompositedBlendingDescendants(false); |
// Start by assuming this layer will not need to composite. |
CompositingReasons reasonsToComposite = CompositingReasonNone; |
@@ -943,6 +947,16 @@ void RenderLayerCompositor::computeCompositingRequirements(RenderLayer* ancestor |
if (overlapMap && childState.m_compositingAncestor && !childState.m_compositingAncestor->isRootLayer()) |
addToOverlapMap(*overlapMap, layer, absBounds, haveComputedBounds); |
+ // According to http://dev.w3.org/fxtf/compositing-1/#csscompositingrules_CSS, |
+ // an element that has blending applied, must blend with all the underlying |
shawnsingh
2013/09/13 10:22:59
nit - remove the comma after "applied"
rosca
2013/09/19 14:26:54
Done.
|
+ // content of the stacking context [CSS21] that element belongs to. |
+ // We should isolate and accelerate the stacking contexts containing |
+ // accelerated blending descendants |
+ if (layer->isStackingContext()) |
shawnsingh
2013/09/13 10:22:59
OK - please bear with me =)
(1) This part of the
rosca
2013/09/19 14:26:54
This part of the code should make sure that a stac
|
+ layer->setShouldIsolateCompositedBlendingDescendants(childState.m_hasCompositedBlendingDescendents); |
+ else |
+ compositingState.m_hasCompositedBlendingDescendents = childState.m_hasCompositedBlendingDescendents; |
+ |
// Now check for reasons to become composited that depend on the state of descendant layers. |
CompositingReasons subtreeCompositingReasons = subtreeReasonsForCompositing(layer->renderer(), childState.m_subtreeIsCompositing, anyDescendantHas3DTransform); |
reasonsToComposite |= subtreeCompositingReasons; |
@@ -968,6 +982,8 @@ void RenderLayerCompositor::computeCompositingRequirements(RenderLayer* ancestor |
// Subsequent layers in the parent's stacking context may also need to composite. |
if (childState.m_subtreeIsCompositing) |
compositingState.m_subtreeIsCompositing = true; |
+ if (willBeComposited && layer->hasBlendMode()) |
+ compositingState.m_hasCompositedBlendingDescendents = true; |
// Set the flag to say that this SC has compositing children. |
layer->setHasCompositingDescendant(childState.m_subtreeIsCompositing); |
@@ -1605,6 +1621,7 @@ bool RenderLayerCompositor::requiresOwnBackingStore(const RenderLayer* layer, co |
| CompositingReasonMaskWithCompositedDescendants |
| CompositingReasonFilterWithCompositedDescendants |
| CompositingReasonBlendingWithCompositedDescendants |
+ | CompositingReasonIsolateCompositedDescendants |
| CompositingReasonPreserve3D; // preserve-3d has to create backing store to ensure that 3d-transformed elements intersect. |
return layer->compositingReasons() & indirectReasonsThatNeedBacking; |
} |
@@ -1741,6 +1758,9 @@ const char* RenderLayerCompositor::logReasonsForCompositing(const RenderLayer* l |
if (reasons & CompositingReasonRoot) |
return "root"; |
+ if (reasons & CompositingReasonIsolateCompositedDescendants) |
+ return "isolate composited descendants"; |
+ |
return ""; |
} |
#endif |
@@ -1929,6 +1949,8 @@ CompositingReasons RenderLayerCompositor::subtreeReasonsForCompositing(RenderObj |
if (hasCompositedDescendants) { |
if (layer->transform()) |
subtreeReasons |= CompositingReasonTransformWithCompositedDescendants; |
+ if (layer->shouldIsolateCompositedBlendingDescendants()) |
shawnsingh
2013/09/13 10:22:59
So it seems like this boolean value, shouldIsolate
rosca
2013/09/19 14:26:54
This property is used in RenderLayerBacking::updat
|
+ subtreeReasons |= CompositingReasonIsolateCompositedDescendants; |
// If the implementation of createsGroup changes, we need to be aware of that in this part of code. |
ASSERT((renderer->isTransparent() || renderer->hasMask() || renderer->hasFilter() || renderer->hasBlendMode()) == renderer->createsGroup()); |