Index: Source/core/rendering/RenderLayer.cpp |
diff --git a/Source/core/rendering/RenderLayer.cpp b/Source/core/rendering/RenderLayer.cpp |
index e6c157de1bd0c9325ca1d0d1520cf63d82f9c532..e52ca654748c87be0d38470fe0f1df81ab8434ba 100644 |
--- a/Source/core/rendering/RenderLayer.cpp |
+++ b/Source/core/rendering/RenderLayer.cpp |
@@ -217,11 +217,10 @@ bool RenderLayer::canRender3DTransforms() const |
bool RenderLayer::paintsWithFilters() const |
{ |
- // FIXME: Eventually there will be more factors than isComposited() to decide whether or not to render the filter |
if (!renderer()->hasFilter()) |
return false; |
- if (!isComposited()) |
+ if (compositingState() != PaintsIntoOwnBacking) |
return true; |
if (!m_backing || !m_backing->canCompositeFilters()) |
@@ -308,7 +307,7 @@ void RenderLayer::updateLayerPositions(RenderGeometryMap* geometryMap, UpdateLay |
// Clear the IsCompositingUpdateRoot flag once we've found the first compositing layer in this update. |
bool isUpdateRoot = (flags & IsCompositingUpdateRoot); |
- if (isComposited()) |
+ if (backing()) |
flags &= ~IsCompositingUpdateRoot; |
if (useRegionBasedColumns() && renderer()->isInFlowRenderFlowThread()) { |
@@ -322,7 +321,7 @@ void RenderLayer::updateLayerPositions(RenderGeometryMap* geometryMap, UpdateLay |
for (RenderLayer* child = firstChild(); child; child = child->nextSibling()) |
child->updateLayerPositions(geometryMap, flags); |
- if ((flags & UpdateCompositingLayers) && isComposited()) { |
+ if ((flags & UpdateCompositingLayers) && backing()) { |
RenderLayerBacking::UpdateAfterLayoutFlags updateFlags = RenderLayerBacking::CompositingChildrenOnly; |
if (flags & NeedsFullRepaintInBacking) |
updateFlags |= RenderLayerBacking::NeedsFullRepaint; |
@@ -835,7 +834,7 @@ void RenderLayer::updatePagination() |
m_isPaginated = false; |
m_enclosingPaginationLayer = 0; |
- if (isComposited() || !parent()) |
+ if (backing() || !parent()) |
return; // FIXME: We will have to deal with paginated compositing layers someday. |
// FIXME: For now the RenderView can't be paginated. Eventually printing will move to a model where it is though. |
@@ -1145,7 +1144,7 @@ bool RenderLayer::updateLayerPosition() |
localPoint += offset; |
} |
} else if (parent()) { |
- if (isComposited()) { |
+ if (backing()) { |
// FIXME: Composited layers ignore pagination, so about the best we can do is make sure they're offset into the appropriate column. |
// They won't split across columns properly. |
LayoutSize columnOffset; |
@@ -1277,13 +1276,16 @@ static inline const RenderLayer* compositingContainer(const RenderLayer* layer) |
return layer->isNormalFlowOnly() ? layer->parent() : layer->ancestorStackingContainer(); |
} |
+// FIXME: having two different functions named enclosingCompositingLayer and enclosingCompositingLayerForRepaint |
+// is error-prone and misleading for reading code that uses these functions - especially compounded with |
+// the includeSelf option. |
Julien - ping for review
2013/10/03 20:08:36
Nit: We usually don't align FIXMEs in Blink.
shawnsingh
2013/10/07 11:45:04
Done
|
RenderLayer* RenderLayer::enclosingCompositingLayer(bool includeSelf) const |
{ |
- if (includeSelf && isComposited()) |
+ if (includeSelf && backing()) |
return const_cast<RenderLayer*>(this); |
for (const RenderLayer* curr = compositingContainer(this); curr; curr = compositingContainer(curr)) { |
- if (curr->isComposited()) |
+ if (curr->backing()) |
return const_cast<RenderLayer*>(curr); |
} |
@@ -1292,11 +1294,11 @@ RenderLayer* RenderLayer::enclosingCompositingLayer(bool includeSelf) const |
RenderLayer* RenderLayer::enclosingCompositingLayerForRepaint(bool includeSelf) const |
{ |
- if (includeSelf && isComposited() && !backing()->paintsIntoCompositedAncestor()) |
+ if (includeSelf && compositingState() == PaintsIntoOwnBacking) |
return const_cast<RenderLayer*>(this); |
for (const RenderLayer* curr = compositingContainer(this); curr; curr = compositingContainer(curr)) { |
- if (curr->isComposited() && !curr->backing()->paintsIntoCompositedAncestor()) |
+ if (curr->compositingState() == PaintsIntoOwnBacking) |
return const_cast<RenderLayer*>(curr); |
} |
@@ -1334,7 +1336,7 @@ RenderLayer* RenderLayer::enclosingFilterLayer(bool includeSelf) const |
RenderLayer* RenderLayer::enclosingFilterRepaintLayer() const |
{ |
for (const RenderLayer* curr = this; curr; curr = curr->parent()) { |
- if ((curr != this && curr->requiresFullLayerImageForFilters()) || curr->isComposited() || curr->isRootLayer()) |
+ if ((curr != this && curr->requiresFullLayerImageForFilters()) || curr->compositingState() == PaintsIntoOwnBacking || curr->isRootLayer()) |
return const_cast<RenderLayer*>(curr); |
} |
return 0; |
@@ -1365,7 +1367,7 @@ void RenderLayer::setFilterBackendNeedsRepaintingInRect(const LayoutRect& rect) |
FloatQuad repaintQuad(rectForRepaint); |
LayoutRect parentLayerRect = renderer()->localToContainerQuad(repaintQuad, parentLayer->renderer()).enclosingBoundingBox(); |
- if (parentLayer->isComposited()) { |
+ if (parentLayer->backing()) { |
parentLayer->setBackingNeedsRepaintInRect(parentLayerRect); |
return; |
} |
@@ -1396,7 +1398,7 @@ bool RenderLayer::hasAncestorWithFilterOutsets() const |
RenderLayer* RenderLayer::clippingRootForPainting() const |
{ |
- if (isComposited()) |
+ if (backing()) |
return const_cast<RenderLayer*>(this); |
const RenderLayer* current = this; |
@@ -1407,7 +1409,7 @@ RenderLayer* RenderLayer::clippingRootForPainting() const |
current = compositingContainer(current); |
ASSERT(current); |
if (current->transform() |
- || (current->isComposited() && !current->backing()->paintsIntoCompositedAncestor()) |
+ || (current->backing() && !current->backing()->paintsIntoCompositedAncestor()) |
) |
return const_cast<RenderLayer*>(current); |
} |
@@ -1442,11 +1444,11 @@ bool RenderLayer::isTransparent() const |
RenderLayer* RenderLayer::transparentPaintingAncestor() |
{ |
- if (isComposited()) |
+ if (backing()) |
Julien - ping for review
2013/10/03 20:08:36
This gets called from RenderLayer::beginTransparen
shawnsingh
2013/10/07 11:45:04
This is a confusing one, and for the sake of movin
|
return 0; |
for (RenderLayer* curr = parent(); curr; curr = curr->parent()) { |
- if (curr->isComposited()) |
+ if (curr->backing()) |
return 0; |
if (curr->isTransparent()) |
return curr; |
@@ -1885,7 +1887,7 @@ bool RenderLayer::usesCompositedScrolling() const |
if (box && (box->isIntristicallyScrollable(VerticalScrollbar) || box->isIntristicallyScrollable(HorizontalScrollbar))) |
return false; |
- return isComposited() && backing()->scrollingLayer(); |
+ return backing() && backing()->scrollingLayer(); |
} |
bool RenderLayer::needsCompositedScrolling() const |
@@ -2514,7 +2516,7 @@ static bool paintForFixedRootBackground(const RenderLayer* layer, RenderLayer::P |
void RenderLayer::paintLayer(GraphicsContext* context, const LayerPaintingInfo& paintingInfo, PaintLayerFlags paintFlags) |
{ |
- if (isComposited()) { |
+ if (backing()) { |
// The updatingControlTints() painting pass goes through compositing layers, |
// but we need to ensure that we don't cache clip rects computed with the wrong root in this case. |
if (context->updatingControlTints() || (paintingInfo.paintBehavior & PaintBehaviorFlattenCompositingLayers)) { |
@@ -4312,7 +4314,7 @@ IntRect RenderLayer::calculateLayerBounds(const RenderLayer* ancestorLayer, cons |
const_cast<RenderLayer*>(this)->updateLayerListsIfNeeded(); |
if (RenderLayer* reflection = reflectionLayer()) { |
- if (!reflection->isComposited()) { |
+ if (!reflection->backing()) { |
IntRect childUnionBounds = reflection->calculateLayerBounds(this, 0, descendantFlags); |
unionBounds.unite(childUnionBounds); |
} |
@@ -4328,7 +4330,7 @@ IntRect RenderLayer::calculateLayerBounds(const RenderLayer* ancestorLayer, cons |
size_t listSize = negZOrderList->size(); |
for (size_t i = 0; i < listSize; ++i) { |
RenderLayer* curLayer = negZOrderList->at(i); |
- if (flags & IncludeCompositedDescendants || !curLayer->isComposited()) { |
+ if (flags & IncludeCompositedDescendants || !curLayer->backing()) { |
IntRect childUnionBounds = curLayer->calculateLayerBounds(this, 0, descendantFlags); |
unionBounds.unite(childUnionBounds); |
} |
@@ -4339,7 +4341,7 @@ IntRect RenderLayer::calculateLayerBounds(const RenderLayer* ancestorLayer, cons |
size_t listSize = posZOrderList->size(); |
for (size_t i = 0; i < listSize; ++i) { |
RenderLayer* curLayer = posZOrderList->at(i); |
- if (flags & IncludeCompositedDescendants || !curLayer->isComposited()) { |
+ if (flags & IncludeCompositedDescendants || !curLayer->backing()) { |
IntRect childUnionBounds = curLayer->calculateLayerBounds(this, 0, descendantFlags); |
unionBounds.unite(childUnionBounds); |
} |
@@ -4350,7 +4352,7 @@ IntRect RenderLayer::calculateLayerBounds(const RenderLayer* ancestorLayer, cons |
size_t listSize = normalFlowList->size(); |
for (size_t i = 0; i < listSize; ++i) { |
RenderLayer* curLayer = normalFlowList->at(i); |
- if (flags & IncludeCompositedDescendants || !curLayer->isComposited()) { |
+ if (flags & IncludeCompositedDescendants || !curLayer->backing()) { |
IntRect curAbsBounds = curLayer->calculateLayerBounds(this, 0, descendantFlags); |
unionBounds.unite(curAbsBounds); |
} |
@@ -4403,6 +4405,21 @@ void RenderLayer::clearClipRects(ClipRectsType typeToClear) |
} |
} |
+CompositingState RenderLayer::compositingState() const |
+{ |
+ // This is computed procedurally so there is no redundant state variable that |
+ // can get out of sync from the real actual compositing state. |
+ |
+ if (!m_backing) |
+ return NotComposited; |
+ |
+ if (m_backing && backing()->paintsIntoCompositedAncestor()) |
+ return HasOwnBackingButPaintsIntoAncestor; |
+ |
+ ASSERT(m_backing); |
+ return PaintsIntoOwnBacking; |
+} |
Julien - ping for review
2013/10/03 20:08:36
The PaintsIntoGroupBacking state is never reached
shawnsingh
2013/10/07 11:45:04
OK, removed for now.
|
+ |
RenderLayerBacking* RenderLayer::ensureBacking() |
{ |
if (!m_backing) { |
@@ -4464,7 +4481,7 @@ GraphicsLayer* RenderLayer::layerForScrollCorner() const |
bool RenderLayer::paintsWithTransform(PaintBehavior paintBehavior) const |
{ |
- return transform() && ((paintBehavior & PaintBehaviorFlattenCompositingLayers) || !isComposited()); |
+ return transform() && ((paintBehavior & PaintBehaviorFlattenCompositingLayers) || compositingState() != PaintsIntoOwnBacking); |
} |
bool RenderLayer::backgroundIsKnownToBeOpaqueInRect(const LayoutRect& localRect) const |
@@ -4515,7 +4532,7 @@ bool RenderLayer::listBackgroundIsKnownToBeOpaqueInRect(const Vector<RenderLayer |
for (Vector<RenderLayer*>::const_reverse_iterator iter = list->rbegin(); iter != list->rend(); ++iter) { |
const RenderLayer* childLayer = *iter; |
- if (childLayer->isComposited()) |
+ if (childLayer->backing()) |
continue; |
if (!childLayer->canUseConvertToLayerCoords()) |
@@ -4772,7 +4789,7 @@ void RenderLayer::repaintIncludingDescendants() |
void RenderLayer::setBackingNeedsRepaint() |
{ |
- ASSERT(isComposited()); |
+ ASSERT(backing()); |
backing()->setContentsNeedDisplay(); |
} |
@@ -4780,8 +4797,8 @@ void RenderLayer::setBackingNeedsRepaintInRect(const LayoutRect& r) |
{ |
// https://bugs.webkit.org/show_bug.cgi?id=61159 describes an unreproducible crash here, |
// so assert but check that the layer is composited. |
- ASSERT(isComposited()); |
- if (!isComposited()) { |
+ ASSERT(backing()); |
+ if (!backing()) { |
// If we're trying to repaint the placeholder document layer, propagate the |
// repaint to the native view system. |
LayoutRect absRect(r); |
@@ -4997,7 +5014,7 @@ inline bool RenderLayer::needsCompositingLayersRebuiltForClip(const RenderStyle* |
inline bool RenderLayer::needsCompositingLayersRebuiltForOverflow(const RenderStyle* oldStyle, const RenderStyle* newStyle) const |
{ |
ASSERT(newStyle); |
- return !isComposited() && oldStyle && (oldStyle->overflowX() != newStyle->overflowX()) && ancestorStackingContainer()->hasCompositingDescendant(); |
+ return !backing() && oldStyle && (oldStyle->overflowX() != newStyle->overflowX()) && ancestorStackingContainer()->hasCompositingDescendant(); |
} |
inline bool RenderLayer::needsCompositingLayersRebuiltForFilters(const RenderStyle* oldStyle, const RenderStyle* newStyle, bool didPaintWithFilters) const |
@@ -5041,7 +5058,7 @@ void RenderLayer::updateFilters(const RenderStyle* oldStyle, const RenderStyle* |
updateOrRemoveFilterClients(); |
// During an accelerated animation, both WebKit and the compositor animate properties. |
// However, WebKit shouldn't ask the compositor to update its filters if the compositor is performing the animation. |
- bool shouldUpdateFilters = isComposited() && !renderer()->animation()->isRunningAcceleratedAnimationOnRenderer(renderer(), CSSPropertyWebkitFilter); |
+ bool shouldUpdateFilters = backing() && !renderer()->animation()->isRunningAcceleratedAnimationOnRenderer(renderer(), CSSPropertyWebkitFilter); |
if (shouldUpdateFilters) |
backing()->updateFilters(renderer()->style()); |
updateOrRemoveFilterEffectRenderer(); |
@@ -5087,7 +5104,7 @@ void RenderLayer::styleChanged(StyleDifference, const RenderStyle* oldStyle) |
|| needsCompositingLayersRebuiltForOverflow(oldStyle, newStyle) |
|| needsCompositingLayersRebuiltForFilters(oldStyle, newStyle, didPaintWithFilters)) |
compositor()->setCompositingLayersNeedRebuild(); |
- else if (isComposited()) |
+ else if (backing()) |
backing()->updateGraphicsLayerGeometry(); |
} |