| Index: Source/core/rendering/RenderLayer.cpp
|
| diff --git a/Source/core/rendering/RenderLayer.cpp b/Source/core/rendering/RenderLayer.cpp
|
| index 8bfd94b6ff48e5e07fbd519fb5131f2e4c81dcb8..fca7c4492215f5edfee31c5d423b40f3eb66f612 100644
|
| --- a/Source/core/rendering/RenderLayer.cpp
|
| +++ b/Source/core/rendering/RenderLayer.cpp
|
| @@ -289,7 +289,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 (compositedLayerMapping())
|
| + if (hasCompositedLayerMapping())
|
| flags &= ~IsCompositingUpdateRoot;
|
|
|
| if (useRegionBasedColumns() && renderer()->isInFlowRenderFlowThread()) {
|
| @@ -303,7 +303,7 @@ void RenderLayer::updateLayerPositions(RenderGeometryMap* geometryMap, UpdateLay
|
| for (RenderLayer* child = firstChild(); child; child = child->nextSibling())
|
| child->updateLayerPositions(geometryMap, flags);
|
|
|
| - if ((flags & UpdateCompositingLayers) && compositedLayerMapping()) {
|
| + if ((flags & UpdateCompositingLayers) && hasCompositedLayerMapping()) {
|
| CompositedLayerMapping::UpdateAfterLayoutFlags updateFlags = CompositedLayerMapping::CompositingChildrenOnly;
|
| if (flags & NeedsFullRepaintInBacking)
|
| updateFlags |= CompositedLayerMapping::NeedsFullRepaint;
|
| @@ -535,7 +535,8 @@ void RenderLayer::updateBlendMode()
|
| if (!hadBlendMode || !hasBlendMode())
|
| dirtyAncestorChainBlendedDescendantStatus();
|
|
|
| - if (compositedLayerMapping())
|
| + // The compositor can only apply one blend mode per composited layer.
|
| + if (compositingState() == PaintsIntoOwnBacking)
|
| compositedLayerMapping()->setBlendMode(newBlendMode);
|
| }
|
| }
|
| @@ -642,7 +643,11 @@ void RenderLayer::updatePagination()
|
| m_isPaginated = false;
|
| m_enclosingPaginationLayer = 0;
|
|
|
| - if (compositedLayerMapping() || !parent())
|
| + // If this layer is composited and paints into its own backing, it will be placed in its
|
| + // correct position via CompositedLayerMapping::updateGraphicsLayerGeometry. If this layer
|
| + // is not composited or paints into another backing, we'll have to update pagination so
|
| + // that it gets positioned correctly within the layer in which it is painted.
|
| + if (compositingState() == PaintsIntoOwnBacking || !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.
|
|
|
| @@ -993,7 +998,10 @@ bool RenderLayer::updateLayerPosition()
|
| localPoint += offset;
|
| }
|
| } else if (parent()) {
|
| - if (compositedLayerMapping()) {
|
| + // Rationale: composited layers need to be positioned in their correct column. If we've been squashed into another layer,
|
| + // or paint into another composited layer, we will already be positioned into the column-correct location. If we also
|
| + // adjust our position, we'll be double compensating.
|
| + if (compositingState() == PaintsIntoOwnBacking) {
|
| // 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;
|
| @@ -1113,11 +1121,11 @@ static inline const RenderLayer* compositingContainer(const RenderLayer* layer)
|
| // enclosingCompositingLayerForRepaint().
|
| RenderLayer* RenderLayer::enclosingCompositingLayer(bool includeSelf) const
|
| {
|
| - if (includeSelf && compositedLayerMapping())
|
| + if (includeSelf && hasCompositedLayerMapping())
|
| return const_cast<RenderLayer*>(this);
|
|
|
| for (const RenderLayer* curr = compositingContainer(this); curr; curr = compositingContainer(curr)) {
|
| - if (curr->compositedLayerMapping())
|
| + if (curr->hasCompositedLayerMapping())
|
| return const_cast<RenderLayer*>(curr);
|
| }
|
|
|
| @@ -1191,7 +1199,12 @@ bool RenderLayer::hasAncestorWithFilterOutsets() const
|
|
|
| RenderLayer* RenderLayer::clippingRootForPainting() const
|
| {
|
| - if (compositedLayerMapping())
|
| + // The compositor will handle clipping (via GraphicsLayers), but only for
|
| + // those layers that own a backing. All other layers (those that are, say,
|
| + // squashed or paint into another backing) must handle their clipping in
|
| + // software as they paint into their associated compositing ancestor for
|
| + // repaint.
|
| + if (compositingState() == PaintsIntoOwnBacking)
|
| return const_cast<RenderLayer*>(this);
|
|
|
| const RenderLayer* current = this;
|
| @@ -1230,11 +1243,16 @@ bool RenderLayer::isTransparent() const
|
|
|
| RenderLayer* RenderLayer::transparentPaintingAncestor()
|
| {
|
| - if (compositedLayerMapping())
|
| + // The compositor will handle applying opacity for true composited layers.
|
| + // If we squish into a layer that is not transparent, or we paint into another
|
| + // layer's backing we won't be able to rely on the compositor to do this; we
|
| + // must handle our transparency in software as we paint into our ancestor
|
| + // compositing layer for repaint.
|
| + if (compositingState() == PaintsIntoOwnBacking)
|
| return 0;
|
|
|
| for (RenderLayer* curr = parent(); curr; curr = curr->parent()) {
|
| - if (curr->compositedLayerMapping())
|
| + if (curr->compositingState() == PaintsIntoOwnBacking)
|
| return 0;
|
| if (curr->isTransparent())
|
| return curr;
|
| @@ -1770,8 +1788,8 @@ void RenderLayer::updateScrollableArea()
|
|
|
| PassOwnPtr<Vector<FloatRect> > RenderLayer::collectTrackedRepaintRects() const
|
| {
|
| - if (CompositedLayerMapping* mapping = compositedLayerMapping())
|
| - return mapping->collectTrackedRepaintRects();
|
| + if (hasCompositedLayerMapping())
|
| + return compositedLayerMapping()->collectTrackedRepaintRects();
|
| return nullptr;
|
| }
|
|
|
| @@ -3589,7 +3607,7 @@ IntRect RenderLayer::calculateLayerBounds(const RenderLayer* ancestorLayer, cons
|
|
|
| if (m_reflectionInfo) {
|
| RenderLayer* reflectionLayer = m_reflectionInfo->reflectionLayer();
|
| - if (!reflectionLayer->compositedLayerMapping()) {
|
| + if (!reflectionLayer->hasCompositedLayerMapping()) {
|
| IntRect childUnionBounds = reflectionLayer->calculateLayerBounds(this, 0, descendantFlags);
|
| unionBounds.unite(childUnionBounds);
|
| }
|
| @@ -3606,7 +3624,15 @@ IntRect RenderLayer::calculateLayerBounds(const RenderLayer* ancestorLayer, cons
|
| // This applies to all z-order lists below.
|
| RenderLayerStackingNodeIterator iterator(*m_stackingNode.get(), AllChildren);
|
| while (RenderLayerStackingNode* node = iterator.next()) {
|
| - if (flags & IncludeCompositedDescendants || !node->layer()->compositedLayerMapping()) {
|
| + // Node's compositing ancestor may have changed its draw content status
|
| + // prior to updating its bounds. The requires-own-backing-store-for-ancestor-reasons
|
| + // could be stale. Refresh them now.
|
| + if (node->layer()->hasCompositedLayerMapping()) {
|
| + RenderLayer* enclosingCompositingLayer = node->layer()->enclosingCompositingLayer(false);
|
| + node->layer()->compositedLayerMapping()->updateRequiresOwnBackingStoreForAncestorReasons(enclosingCompositingLayer);
|
| + }
|
| +
|
| + if (flags & IncludeCompositedDescendants || node->layer()->compositingState() != PaintsIntoOwnBacking) {
|
| IntRect childUnionBounds = node->layer()->calculateLayerBounds(this, 0, descendantFlags);
|
| unionBounds.unite(childUnionBounds);
|
| }
|
| @@ -3649,7 +3675,7 @@ CompositingState RenderLayer::compositingState() const
|
| return PaintsIntoOwnBacking;
|
| }
|
|
|
| -CompositedLayerMapping* RenderLayer::ensureCompositedLayerMapping()
|
| +CompositedLayerMappingPtr RenderLayer::ensureCompositedLayerMapping()
|
| {
|
| if (!m_compositedLayerMapping) {
|
| m_compositedLayerMapping = adoptPtr(new CompositedLayerMapping(this));
|
| @@ -3736,7 +3762,9 @@ bool RenderLayer::listBackgroundIsKnownToBeOpaqueInRect(const Vector<RenderLayer
|
|
|
| for (Vector<RenderLayerStackingNode*>::const_reverse_iterator iter = list->rbegin(); iter != list->rend(); ++iter) {
|
| const RenderLayer* childLayer = (*iter)->layer();
|
| - if (childLayer->compositedLayerMapping())
|
| + // We skip layers that paint into their own backing (they do not affect the
|
| + // opaqueness of us).
|
| + if (childLayer->compositingState() == PaintsIntoOwnBacking)
|
| continue;
|
|
|
| if (!childLayer->canUseConvertToLayerCoords())
|
| @@ -3909,7 +3937,7 @@ inline bool RenderLayer::needsCompositingLayersRebuiltForClip(const RenderStyle*
|
| inline bool RenderLayer::needsCompositingLayersRebuiltForOverflow(const RenderStyle* oldStyle, const RenderStyle* newStyle) const
|
| {
|
| ASSERT(newStyle);
|
| - return !compositedLayerMapping() && oldStyle && (oldStyle->overflowX() != newStyle->overflowX()) && m_stackingNode->ancestorStackingContainerNode()->layer()->hasCompositingDescendant();
|
| + return !hasCompositedLayerMapping() && oldStyle && (oldStyle->overflowX() != newStyle->overflowX()) && m_stackingNode->ancestorStackingContainerNode()->layer()->hasCompositingDescendant();
|
| }
|
|
|
| inline bool RenderLayer::needsCompositingLayersRebuiltForFilters(const RenderStyle* oldStyle, const RenderStyle* newStyle, bool didPaintWithFilters) const
|
| @@ -3953,7 +3981,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 = compositedLayerMapping() && !renderer()->animation().isRunningAcceleratedAnimationOnRenderer(renderer(), CSSPropertyWebkitFilter);
|
| + bool shouldUpdateFilters = compositingState() == PaintsIntoOwnBacking && !renderer()->animation().isRunningAcceleratedAnimationOnRenderer(renderer(), CSSPropertyWebkitFilter);
|
| if (shouldUpdateFilters)
|
| compositedLayerMapping()->updateFilters(renderer()->style());
|
| updateOrRemoveFilterEffectRenderer();
|
| @@ -3992,7 +4020,7 @@ void RenderLayer::styleChanged(StyleDifference, const RenderStyle* oldStyle)
|
| || needsCompositingLayersRebuiltForOverflow(oldStyle, newStyle)
|
| || needsCompositingLayersRebuiltForFilters(oldStyle, newStyle, didPaintWithFilters))
|
| compositor()->setCompositingLayersNeedRebuild();
|
| - else if (compositedLayerMapping())
|
| + else if (hasCompositedLayerMapping())
|
| compositedLayerMapping()->updateGraphicsLayerGeometry();
|
| }
|
|
|
|
|