Index: Source/core/rendering/RenderLayerCompositor.cpp |
diff --git a/Source/core/rendering/RenderLayerCompositor.cpp b/Source/core/rendering/RenderLayerCompositor.cpp |
index beece9ac5117ea616115251c495916159347e1f6..f3ff63ff599f24bbb7e2e6bc1828262c8cd0a562 100644 |
--- a/Source/core/rendering/RenderLayerCompositor.cpp |
+++ b/Source/core/rendering/RenderLayerCompositor.cpp |
@@ -186,6 +186,7 @@ struct CompositingRecursionData { |
CompositingRecursionData(RenderLayer* compAncestor, bool testOverlap) |
: m_compositingAncestor(compAncestor) |
, m_subtreeIsCompositing(false) |
+ , m_hasCompositedBlendingDescendants(false) |
, m_testingOverlap(testOverlap) |
#ifndef NDEBUG |
, m_depth(0) |
@@ -196,6 +197,7 @@ struct CompositingRecursionData { |
CompositingRecursionData(const CompositingRecursionData& other) |
: m_compositingAncestor(other.m_compositingAncestor) |
, m_subtreeIsCompositing(other.m_subtreeIsCompositing) |
+ , m_hasCompositedBlendingDescendants(other.m_hasCompositedBlendingDescendants) |
, m_testingOverlap(other.m_testingOverlap) |
#ifndef NDEBUG |
, m_depth(other.m_depth + 1) |
@@ -205,6 +207,7 @@ struct CompositingRecursionData { |
RenderLayer* m_compositingAncestor; |
bool m_subtreeIsCompositing; |
+ bool m_hasCompositedBlendingDescendants; |
bool m_testingOverlap; |
#ifndef NDEBUG |
int m_depth; |
@@ -949,6 +952,15 @@ void RenderLayerCompositor::computeCompositingRequirements(RenderLayer* ancestor |
if (overlapMap && childRecursionData.m_compositingAncestor && !childRecursionData.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 |
+ // content of the stacking context [CSS21] that element belongs to. |
+ // We should isolate the stacking contexts containing accelerated blending descendants |
+ layer->setHasCompositedBlendingDescendants(childRecursionData.m_hasCompositedBlendingDescendants); |
+ |
+ if (layer->hasCompositedBlendingDescendants() && !layer->stackingNode()->isStackingContext()) |
+ currentRecursionData.m_hasCompositedBlendingDescendants = true; |
+ |
// Now check for reasons to become composited that depend on the state of descendant layers. |
CompositingReasons subtreeCompositingReasons = subtreeReasonsForCompositing(layer->renderer(), childRecursionData.m_subtreeIsCompositing, anyDescendantHas3DTransform); |
reasonsToComposite |= subtreeCompositingReasons; |
@@ -975,6 +987,9 @@ void RenderLayerCompositor::computeCompositingRequirements(RenderLayer* ancestor |
if (childRecursionData.m_subtreeIsCompositing) |
currentRecursionData.m_subtreeIsCompositing = true; |
+ if (willBeComposited && layer->hasBlendMode()) |
+ currentRecursionData.m_hasCompositedBlendingDescendants = true; |
+ |
// Set the flag to say that this SC has compositing children. |
layer->setHasCompositingDescendant(childRecursionData.m_subtreeIsCompositing); |
@@ -1554,6 +1569,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; |
} |
@@ -1687,6 +1703,9 @@ const char* RenderLayerCompositor::logReasonsForCompositing(const RenderLayer* l |
if (reasons & CompositingReasonRoot) |
return "root"; |
+ if (reasons & CompositingReasonIsolateCompositedDescendants) |
+ return "isolate composited descendants"; |
+ |
return ""; |
} |
#endif |
@@ -1881,6 +1900,8 @@ CompositingReasons RenderLayerCompositor::subtreeReasonsForCompositing(RenderObj |
if (hasCompositedDescendants) { |
if (layer->transform()) |
subtreeReasons |= CompositingReasonTransformWithCompositedDescendants; |
+ if (layer->hasCompositedBlendingDescendants() && layer->stackingNode()->isStackingContext()) |
+ 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()); |