| Index: Source/core/rendering/RenderLayer.cpp
|
| diff --git a/Source/core/rendering/RenderLayer.cpp b/Source/core/rendering/RenderLayer.cpp
|
| index 3db81e33e92bb8b428490476965e92164f5d84e0..51cd6ed9277bd853adc45c6870e6118cb4b9d19d 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_compositedLayerMapping || !m_compositedLayerMapping->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 (compositedLayerMapping())
|
| 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) && compositedLayerMapping()) {
|
| CompositedLayerMapping::UpdateAfterLayoutFlags updateFlags = CompositedLayerMapping::CompositingChildrenOnly;
|
| if (flags & NeedsFullRepaintInBacking)
|
| updateFlags |= CompositedLayerMapping::NeedsFullRepaint;
|
| @@ -835,7 +834,7 @@ void RenderLayer::updatePagination()
|
| m_isPaginated = false;
|
| m_enclosingPaginationLayer = 0;
|
|
|
| - if (isComposited() || !parent())
|
| + if (compositedLayerMapping() || !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 (compositedLayerMapping()) {
|
| // 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,17 @@ 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. It is very likely that some call sites of this function actually mean to use
|
| +// enclosingCompositingLayerForRepaint().
|
| RenderLayer* RenderLayer::enclosingCompositingLayer(bool includeSelf) const
|
| {
|
| - if (includeSelf && isComposited())
|
| + if (includeSelf && compositedLayerMapping())
|
| return const_cast<RenderLayer*>(this);
|
|
|
| for (const RenderLayer* curr = compositingContainer(this); curr; curr = compositingContainer(curr)) {
|
| - if (curr->isComposited())
|
| + if (curr->compositedLayerMapping())
|
| return const_cast<RenderLayer*>(curr);
|
| }
|
|
|
| @@ -1292,11 +1295,11 @@ RenderLayer* RenderLayer::enclosingCompositingLayer(bool includeSelf) const
|
|
|
| RenderLayer* RenderLayer::enclosingCompositingLayerForRepaint(bool includeSelf) const
|
| {
|
| - if (includeSelf && isComposited() && !compositedLayerMapping()->paintsIntoCompositedAncestor())
|
| + if (includeSelf && compositingState() == PaintsIntoOwnBacking)
|
| return const_cast<RenderLayer*>(this);
|
|
|
| for (const RenderLayer* curr = compositingContainer(this); curr; curr = compositingContainer(curr)) {
|
| - if (curr->isComposited() && !curr->compositedLayerMapping()->paintsIntoCompositedAncestor())
|
| + if (curr->compositingState() == PaintsIntoOwnBacking)
|
| return const_cast<RenderLayer*>(curr);
|
| }
|
|
|
| @@ -1334,7 +1337,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 +1368,7 @@ void RenderLayer::setFilterBackendNeedsRepaintingInRect(const LayoutRect& rect)
|
| FloatQuad repaintQuad(rectForRepaint);
|
| LayoutRect parentLayerRect = renderer()->localToContainerQuad(repaintQuad, parentLayer->renderer()).enclosingBoundingBox();
|
|
|
| - if (parentLayer->isComposited()) {
|
| + if (parentLayer->compositedLayerMapping()) {
|
| parentLayer->setBackingNeedsRepaintInRect(parentLayerRect);
|
| return;
|
| }
|
| @@ -1396,7 +1399,7 @@ bool RenderLayer::hasAncestorWithFilterOutsets() const
|
|
|
| RenderLayer* RenderLayer::clippingRootForPainting() const
|
| {
|
| - if (isComposited())
|
| + if (compositedLayerMapping())
|
| return const_cast<RenderLayer*>(this);
|
|
|
| const RenderLayer* current = this;
|
| @@ -1407,7 +1410,7 @@ RenderLayer* RenderLayer::clippingRootForPainting() const
|
| current = compositingContainer(current);
|
| ASSERT(current);
|
| if (current->transform()
|
| - || (current->isComposited() && !current->compositedLayerMapping()->paintsIntoCompositedAncestor())
|
| + || (current->compositingState() == PaintsIntoOwnBacking)
|
| )
|
| return const_cast<RenderLayer*>(current);
|
| }
|
| @@ -1442,11 +1445,11 @@ bool RenderLayer::isTransparent() const
|
|
|
| RenderLayer* RenderLayer::transparentPaintingAncestor()
|
| {
|
| - if (isComposited())
|
| + if (compositedLayerMapping())
|
| return 0;
|
|
|
| for (RenderLayer* curr = parent(); curr; curr = curr->parent()) {
|
| - if (curr->isComposited())
|
| + if (curr->compositedLayerMapping())
|
| return 0;
|
| if (curr->isTransparent())
|
| return curr;
|
| @@ -1885,7 +1888,7 @@ bool RenderLayer::usesCompositedScrolling() const
|
| if (box && (box->isIntristicallyScrollable(VerticalScrollbar) || box->isIntristicallyScrollable(HorizontalScrollbar)))
|
| return false;
|
|
|
| - return isComposited() && compositedLayerMapping()->scrollingLayer();
|
| + return compositedLayerMapping() && compositedLayerMapping()->scrollingLayer();
|
| }
|
|
|
| bool RenderLayer::needsCompositedScrolling() const
|
| @@ -2516,7 +2519,7 @@ static bool paintForFixedRootBackground(const RenderLayer* layer, RenderLayer::P
|
|
|
| void RenderLayer::paintLayer(GraphicsContext* context, const LayerPaintingInfo& paintingInfo, PaintLayerFlags paintFlags)
|
| {
|
| - if (isComposited()) {
|
| + if (compositingState() != NotComposited) {
|
| // 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)) {
|
| @@ -4316,7 +4319,7 @@ IntRect RenderLayer::calculateLayerBounds(const RenderLayer* ancestorLayer, cons
|
| const_cast<RenderLayer*>(this)->updateLayerListsIfNeeded();
|
|
|
| if (RenderLayer* reflection = reflectionLayer()) {
|
| - if (!reflection->isComposited()) {
|
| + if (!reflection->compositedLayerMapping()) {
|
| IntRect childUnionBounds = reflection->calculateLayerBounds(this, 0, descendantFlags);
|
| unionBounds.unite(childUnionBounds);
|
| }
|
| @@ -4328,11 +4331,14 @@ IntRect RenderLayer::calculateLayerBounds(const RenderLayer* ancestorLayer, cons
|
| LayerListMutationDetector mutationChecker(const_cast<RenderLayer*>(this));
|
| #endif
|
|
|
| + // FIXME: Descendants that are composited should not necessarily be skipped, if they don't paint into their own
|
| + // separate backing. Instead, they ought to contribute to the bounds of the layer we're trying to compute.
|
| + // This applies to all z-order lists below.
|
| if (Vector<RenderLayer*>* negZOrderList = this->negZOrderList()) {
|
| 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->compositedLayerMapping()) {
|
| IntRect childUnionBounds = curLayer->calculateLayerBounds(this, 0, descendantFlags);
|
| unionBounds.unite(childUnionBounds);
|
| }
|
| @@ -4343,7 +4349,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->compositedLayerMapping()) {
|
| IntRect childUnionBounds = curLayer->calculateLayerBounds(this, 0, descendantFlags);
|
| unionBounds.unite(childUnionBounds);
|
| }
|
| @@ -4354,7 +4360,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->compositedLayerMapping()) {
|
| IntRect curAbsBounds = curLayer->calculateLayerBounds(this, 0, descendantFlags);
|
| unionBounds.unite(curAbsBounds);
|
| }
|
| @@ -4407,6 +4413,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_compositedLayerMapping)
|
| + return NotComposited;
|
| +
|
| + if (m_compositedLayerMapping && compositedLayerMapping()->paintsIntoCompositedAncestor())
|
| + return HasOwnBackingButPaintsIntoAncestor;
|
| +
|
| + ASSERT(m_compositedLayerMapping);
|
| + return PaintsIntoOwnBacking;
|
| +}
|
| +
|
| CompositedLayerMapping* RenderLayer::ensureCompositedLayerMapping()
|
| {
|
| if (!m_compositedLayerMapping) {
|
| @@ -4468,7 +4489,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
|
| @@ -4519,7 +4540,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->compositedLayerMapping())
|
| continue;
|
|
|
| if (!childLayer->canUseConvertToLayerCoords())
|
| @@ -4776,7 +4797,7 @@ void RenderLayer::repaintIncludingDescendants()
|
|
|
| void RenderLayer::setBackingNeedsRepaint()
|
| {
|
| - ASSERT(isComposited());
|
| + ASSERT(compositedLayerMapping());
|
| compositedLayerMapping()->setContentsNeedDisplay();
|
| }
|
|
|
| @@ -4784,8 +4805,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(compositedLayerMapping());
|
| + if (!compositedLayerMapping()) {
|
| // If we're trying to repaint the placeholder document layer, propagate the
|
| // repaint to the native view system.
|
| LayoutRect absRect(r);
|
| @@ -5002,7 +5023,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 !compositedLayerMapping() && oldStyle && (oldStyle->overflowX() != newStyle->overflowX()) && ancestorStackingContainer()->hasCompositingDescendant();
|
| }
|
|
|
| inline bool RenderLayer::needsCompositingLayersRebuiltForFilters(const RenderStyle* oldStyle, const RenderStyle* newStyle, bool didPaintWithFilters) const
|
| @@ -5046,7 +5067,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 = compositedLayerMapping() && !renderer()->animation()->isRunningAcceleratedAnimationOnRenderer(renderer(), CSSPropertyWebkitFilter);
|
| if (shouldUpdateFilters)
|
| compositedLayerMapping()->updateFilters(renderer()->style());
|
| updateOrRemoveFilterEffectRenderer();
|
| @@ -5092,7 +5113,7 @@ void RenderLayer::styleChanged(StyleDifference, const RenderStyle* oldStyle)
|
| || needsCompositingLayersRebuiltForOverflow(oldStyle, newStyle)
|
| || needsCompositingLayersRebuiltForFilters(oldStyle, newStyle, didPaintWithFilters))
|
| compositor()->setCompositingLayersNeedRebuild();
|
| - else if (isComposited())
|
| + else if (compositedLayerMapping())
|
| compositedLayerMapping()->updateGraphicsLayerGeometry();
|
| }
|
|
|
|
|