Index: Source/core/rendering/RenderLayer.cpp |
diff --git a/Source/core/rendering/RenderLayer.cpp b/Source/core/rendering/RenderLayer.cpp |
index aa8d0e1601e68c17665463eacacb33799dc2366d..ad18f1a836f964af6f7d7312c0b261adfb01a62f 100644 |
--- a/Source/core/rendering/RenderLayer.cpp |
+++ b/Source/core/rendering/RenderLayer.cpp |
@@ -111,8 +111,6 @@ RenderLayer::RenderLayer(RenderLayerModelObject* renderer) |
, m_isUnclippedDescendant(false) |
, m_isRootLayer(renderer->isRenderView()) |
, m_usedTransparency(false) |
- , m_childLayerHasBlendMode(false) |
- , m_childLayerHasBlendModeStatusDirty(false) |
, m_visibleContentStatusDirty(true) |
, m_hasVisibleContent(false) |
, m_visibleDescendantStatusDirty(false) |
@@ -124,7 +122,6 @@ RenderLayer::RenderLayer(RenderLayerModelObject* renderer) |
, m_containsDirtyOverlayScrollbars(false) |
, m_canSkipRepaintRectsUpdateOnScroll(renderer->isTableCell()) |
, m_hasFilterInfo(false) |
- , m_blendMode(blink::WebBlendModeNormal) |
, m_renderer(renderer) |
, m_parent(0) |
, m_previous(0) |
@@ -136,6 +133,7 @@ RenderLayer::RenderLayer(RenderLayerModelObject* renderer) |
, m_enclosingPaginationLayer(0) |
, m_repainter(renderer) |
, m_clipper(renderer) |
+ , m_blendInfo(renderer) |
{ |
updateStackingNode(); |
@@ -515,30 +513,6 @@ void RenderLayer::updateLayerPositionsAfterScroll(RenderGeometryMap* geometryMap |
geometryMap->popMappingsToAncestor(parent()); |
} |
-bool RenderLayer::hasBlendMode() const |
-{ |
- return RuntimeEnabledFeatures::cssCompositingEnabled() && renderer()->hasBlendMode(); |
-} |
- |
-void RenderLayer::updateBlendMode() |
-{ |
- if (!RuntimeEnabledFeatures::cssCompositingEnabled()) |
- return; |
- |
- bool hadBlendMode = m_blendMode != blink::WebBlendModeNormal; |
- blink::WebBlendMode newBlendMode = renderer()->style()->blendMode(); |
- if (newBlendMode != m_blendMode) { |
- m_blendMode = newBlendMode; |
- |
- // Only update the flag if a blend mode is set or unset. |
- if (parent() && (!hadBlendMode || !hasBlendMode())) |
- parent()->dirtyAncestorChainBlendedDescendantStatus(); |
- |
- if (hasCompositedLayerMapping()) |
- compositedLayerMapping()->setBlendMode(newBlendMode); |
- } |
-} |
- |
void RenderLayer::updateTransform() |
{ |
// hasTransform() on the renderer is also true when there is transform-style: preserve-3d or perspective set, |
@@ -758,33 +732,6 @@ void RenderLayer::setAncestorChainHasVisibleDescendant() |
} |
} |
-void RenderLayer::dirtyAncestorChainBlendedDescendantStatus() |
-{ |
- for (RenderLayer* layer = this; layer; layer = layer->parent()) { |
- if (layer->m_childLayerHasBlendModeStatusDirty) |
- break; |
- |
- layer->m_childLayerHasBlendModeStatusDirty = true; |
- |
- if (layer->stackingNode()->isStackingContext()) |
- break; |
- } |
-} |
- |
-void RenderLayer::setAncestorChainBlendedDescendant() |
-{ |
- for (RenderLayer* layer = this; layer; layer = layer->parent()) { |
- if (!layer->m_childLayerHasBlendModeStatusDirty && layer->childLayerHasBlendMode()) |
- break; |
- |
- layer->m_childLayerHasBlendMode = true; |
- layer->m_childLayerHasBlendModeStatusDirty = false; |
- |
- if (layer->stackingNode()->isStackingContext()) |
- break; |
- } |
-} |
- |
void RenderLayer::updateHasUnclippedDescendant() |
{ |
TRACE_EVENT0("blink_rendering", "RenderLayer::updateHasUnclippedDescendant"); |
@@ -858,19 +805,21 @@ void RenderLayer::updateDescendantDependentFlags() |
m_hasOutOfFlowPositionedDescendantDirty = false; |
} |
- if (m_childLayerHasBlendModeStatusDirty) { |
- m_childLayerHasBlendMode = false; |
+ if (m_blendInfo.childLayerHasBlendModeStatusDirty()) { |
+ m_blendInfo.setChildLayerHasBlendMode(false); |
for (RenderLayer* child = firstChild(); child; child = child->nextSibling()) { |
if (!child->stackingNode()->isStackingContext()) |
child->updateDescendantDependentFlags(); |
- bool childLayerHasBlendMode = child->paintsWithBlendMode() || (child->m_childLayerHasBlendMode && !child->stackingNode()->isStackingContext()); |
- m_childLayerHasBlendMode |= childLayerHasBlendMode; |
+ bool childLayerHasBlendMode = child->paintsWithBlendMode() |
+ || (child->blendInfo().childLayerHasBlendModeWhileDirty() && !child->stackingNode()->isStackingContext()); |
Julien - ping for review
2013/12/10 00:55:09
We should *never* allow the flag to be queried dir
dsinclair
2013/12/10 16:59:12
The current code does require this at the moment.
|
+ |
+ m_blendInfo.updateChildLayerHasBlendMode(childLayerHasBlendMode); |
Julien - ping for review
2013/12/10 00:55:09
A better way to handle that would be to store this
dsinclair
2013/12/13 16:53:59
Done.
|
- if (m_childLayerHasBlendMode) |
+ if (m_blendInfo.childLayerHasBlendModeWhileDirty()) |
break; |
} |
- m_childLayerHasBlendModeStatusDirty = false; |
+ m_blendInfo.setChildLayerHasBlendModeStatusDirty(false); |
} |
if (m_visibleContentStatusDirty) { |
@@ -1336,7 +1285,7 @@ LayoutRect RenderLayer::paintingExtent(const RenderLayer* rootLayer, const Layou |
void RenderLayer::beginTransparencyLayers(GraphicsContext* context, const RenderLayer* rootLayer, const LayoutRect& paintDirtyRect, PaintBehavior paintBehavior) |
{ |
- bool createTransparencyLayerForBlendMode = m_stackingNode->isStackingContext() && m_childLayerHasBlendMode; |
+ bool createTransparencyLayerForBlendMode = m_stackingNode->isStackingContext() && m_blendInfo.childLayerHasBlendMode(); |
if (context->paintingDisabled() || ((paintsWithTransparency(paintBehavior) || paintsWithBlendMode() || createTransparencyLayerForBlendMode) && m_usedTransparency)) |
return; |
@@ -1350,7 +1299,7 @@ void RenderLayer::beginTransparencyLayers(GraphicsContext* context, const Render |
LayoutRect clipRect = paintingExtent(rootLayer, paintDirtyRect, paintBehavior); |
context->clip(clipRect); |
if (paintsWithBlendMode()) |
- context->setCompositeOperation(context->compositeOperation(), m_blendMode); |
+ context->setCompositeOperation(context->compositeOperation(), m_blendInfo.blendMode()); |
context->beginTransparencyLayer(renderer()->opacity()); |
#ifdef REVEAL_TRANSPARENCY_LAYERS |
@@ -1406,8 +1355,8 @@ void RenderLayer::addChild(RenderLayer* child, RenderLayer* beforeChild) |
if (child->isSelfPaintingLayer() || child->hasSelfPaintingLayerDescendant()) |
setAncestorChainHasSelfPaintingLayerDescendant(); |
- if (child->paintsWithBlendMode() || child->childLayerHasBlendMode()) |
- setAncestorChainBlendedDescendant(); |
+ if (child->paintsWithBlendMode() || child->blendInfo().childLayerHasBlendMode()) |
+ m_blendInfo.setAncestorChainBlendedDescendant(); |
if (subtreeContainsOutOfFlowPositionedLayer(child)) { |
// Now that the out of flow positioned descendant is in the tree, we |
@@ -1467,8 +1416,8 @@ RenderLayer* RenderLayer::removeChild(RenderLayer* oldChild) |
if (oldChild->m_hasVisibleContent || oldChild->m_hasVisibleDescendant) |
dirtyAncestorChainVisibleDescendantStatus(); |
- if (oldChild->paintsWithBlendMode() || oldChild->childLayerHasBlendMode()) |
- dirtyAncestorChainBlendedDescendantStatus(); |
+ if (oldChild->paintsWithBlendMode() || oldChild->blendInfo().childLayerHasBlendMode()) |
+ m_blendInfo.dirtyAncestorChainBlendedDescendantStatus(); |
if (oldChild->isSelfPaintingLayer() || oldChild->hasSelfPaintingLayerDescendant()) |
dirtyAncestorChainHasSelfPaintingLayerDescendantStatus(); |
@@ -2055,7 +2004,7 @@ void RenderLayer::paintLayerContents(GraphicsContext* context, const LayerPainti |
// Blending operations must be performed only with the nearest ancestor stacking context. |
// Note that there is no need to create a transparency layer if we're painting the root. |
- bool createTransparencyLayerForBlendMode = !renderer()->isRoot() && m_stackingNode->isStackingContext() && m_childLayerHasBlendMode; |
+ bool createTransparencyLayerForBlendMode = !renderer()->isRoot() && m_stackingNode->isStackingContext() && m_blendInfo.childLayerHasBlendMode(); |
if (createTransparencyLayerForBlendMode) |
beginTransparencyLayers(context, paintingInfo.rootLayer, paintingInfo.paintDirtyRect, paintingInfo.paintBehavior); |
@@ -3655,7 +3604,7 @@ CompositedLayerMappingPtr RenderLayer::ensureCompositedLayerMapping() |
updateOrRemoveFilterEffectRenderer(); |
if (RuntimeEnabledFeatures::cssCompositingEnabled()) |
- compositedLayerMapping()->setBlendMode(m_blendMode); |
+ compositedLayerMapping()->setBlendMode(m_blendInfo.blendMode()); |
} |
return m_compositedLayerMapping.get(); |
} |
@@ -3972,7 +3921,7 @@ void RenderLayer::styleChanged(StyleDifference, const RenderStyle* oldStyle) |
updateReflectionInfo(oldStyle); |
if (RuntimeEnabledFeatures::cssCompositingEnabled()) |
- updateBlendMode(); |
+ m_blendInfo.updateBlendMode(); |
updateDescendantDependentFlags(); |
updateTransform(); |