 Chromium Code Reviews
 Chromium Code Reviews Issue 88863002:
  Land layer squashing behind a flag  (Closed) 
  Base URL: svn://svn.chromium.org/blink/trunk
    
  
    Issue 88863002:
  Land layer squashing behind a flag  (Closed) 
  Base URL: svn://svn.chromium.org/blink/trunk| Index: Source/core/rendering/RenderLayer.cpp | 
| diff --git a/Source/core/rendering/RenderLayer.cpp b/Source/core/rendering/RenderLayer.cpp | 
| index 323d1957feaafe1d7f55fdb751baf80aa8b2de2a..0c5c7e54d8203362a95887acbaf5521e0e3f256d 100644 | 
| --- a/Source/core/rendering/RenderLayer.cpp | 
| +++ b/Source/core/rendering/RenderLayer.cpp | 
| @@ -134,6 +134,7 @@ RenderLayer::RenderLayer(RenderLayerModelObject* renderer) | 
| , m_staticInlinePosition(0) | 
| , m_staticBlockPosition(0) | 
| , m_enclosingPaginationLayer(0) | 
| + , m_groupedMapping(0) | 
| , m_repainter(renderer) | 
| , m_clipper(renderer) | 
| { | 
| @@ -1110,15 +1111,16 @@ static inline const RenderLayer* compositingContainer(const RenderLayer* layer) | 
| // 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(). | 
| +// the includeSelf option. It is very likely that we don't even want either of these functions; A layer | 
| +// should be told explicitly which GraphicsLayer is the repaintContainer for a RenderLayer, and | 
| +// any other use cases should probably have an API between the non-compositing and compositing sides of code. | 
| RenderLayer* RenderLayer::enclosingCompositingLayer(bool includeSelf) const | 
| { | 
| - if (includeSelf && hasCompositedLayerMapping()) | 
| + if (includeSelf && compositingState() != NotComposited && compositingState() != PaintsIntoGroupedBacking) | 
| return const_cast<RenderLayer*>(this); | 
| for (const RenderLayer* curr = compositingContainer(this); curr; curr = compositingContainer(curr)) { | 
| - if (curr->hasCompositedLayerMapping()) | 
| + if (curr->compositingState() != NotComposited && curr->compositingState() != PaintsIntoGroupedBacking) | 
| return const_cast<RenderLayer*>(curr); | 
| } | 
| @@ -1127,11 +1129,11 @@ RenderLayer* RenderLayer::enclosingCompositingLayer(bool includeSelf) const | 
| RenderLayer* RenderLayer::enclosingCompositingLayerForRepaint(bool includeSelf) const | 
| { | 
| - if (includeSelf && compositingState() == PaintsIntoOwnBacking) | 
| + if (includeSelf && (compositingState() == PaintsIntoOwnBacking || compositingState() == PaintsIntoGroupedBacking)) | 
| return const_cast<RenderLayer*>(this); | 
| for (const RenderLayer* curr = compositingContainer(this); curr; curr = compositingContainer(curr)) { | 
| - if (curr->compositingState() == PaintsIntoOwnBacking) | 
| + if (curr->compositingState() == PaintsIntoOwnBacking || curr->compositingState() == PaintsIntoGroupedBacking) | 
| return const_cast<RenderLayer*>(curr); | 
| } | 
| @@ -1884,7 +1886,7 @@ static bool paintForFixedRootBackground(const RenderLayer* layer, PaintLayerFlag | 
| void RenderLayer::paintLayer(GraphicsContext* context, const LayerPaintingInfo& paintingInfo, PaintLayerFlags paintFlags) | 
| { | 
| - if (compositingState() != NotComposited) { | 
| + if (compositingState() != NotComposited && compositingState() != PaintsIntoGroupedBacking) { | 
| // 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)) { | 
| @@ -2225,6 +2227,11 @@ void RenderLayer::paintChildren(unsigned childrenToVisit, GraphicsContext* conte | 
| RenderLayerStackingNodeIterator iterator(*m_stackingNode, childrenToVisit); | 
| while (RenderLayerStackingNode* child = iterator.next()) { | 
| RenderLayer* childLayer = child->layer(); | 
| + | 
| + // Squashed RenderLayers should not paint into their ancestor. | 
| + if (childLayer->compositingState() == PaintsIntoGroupedBacking) | 
| + continue; | 
| + | 
| if (!childLayer->isPaginated()) | 
| childLayer->paintLayer(context, paintingInfo, paintFlags); | 
| else | 
| @@ -3636,6 +3643,12 @@ 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_groupedMapping) { | 
| + ASSERT(compositor()->isLayerSquashingEnabled()); | 
| + ASSERT(!m_compositedLayerMapping); | 
| + return PaintsIntoGroupedBacking; | 
| + } | 
| + | 
| if (!m_compositedLayerMapping) | 
| return NotComposited; | 
| @@ -3997,10 +4010,17 @@ void RenderLayer::styleChanged(StyleDifference, const RenderStyle* oldStyle) | 
| || needsCompositingLayersRebuiltForClip(oldStyle, newStyle) | 
| || needsCompositingLayersRebuiltForOverflow(oldStyle, newStyle) | 
| || needsCompositingLayersRebuiltForFilters(oldStyle, newStyle, didPaintWithFilters) | 
| - || needsCompositingLayersRebuiltForBlending(oldStyle, newStyle)) | 
| + || needsCompositingLayersRebuiltForBlending(oldStyle, newStyle)) { | 
| compositor()->setCompositingLayersNeedRebuild(); | 
| - else if (hasCompositedLayerMapping()) | 
| + } else if (compositingState() == PaintsIntoOwnBacking || compositingState() == HasOwnBackingButPaintsIntoAncestor) { | 
| + ASSERT(hasCompositedLayerMapping()); | 
| compositedLayerMapping()->updateGraphicsLayerGeometry(); | 
| + } else if (compositingState() == PaintsIntoGroupedBacking) { | 
| + ASSERT(compositor()->isLayerSquashingEnabled()); | 
| + ASSERT(groupedMapping()); | 
| + // FIXME: double-check that updateGraphicsLayerGeometry is not necessary (well the squashing portion is what might be needed? but probably not)... | 
| 
Ian Vollick
2013/12/07 02:44:42
I think we do want to update the geometry here. Th
 
shawnsingh
2013/12/11 18:50:34
(a) if the squashing layer is affected by m_graphi
 | 
| + // FIXME: do we need to take any action here for a squashed layer? | 
| + } | 
| } | 
| bool RenderLayer::scrollsOverflow() const |