diff --git a/engine/core/rendering/RenderLayer.cpp b/engine/core/rendering/RenderLayer.cpp index 48c04e49f9f789335e7ca6494afd0ca3a52382e8..aaf7bd00e05cda339d155fd4bd6860fc8e97929b 100644 --- a/engine/core/rendering/RenderLayer.cpp +++ b/engine/core/rendering/RenderLayer.cpp @@ -80,8 +80,6 @@ namespace blink { RenderLayer::RenderLayer(RenderBox* renderer, LayerType type) : m_layerType(type) - , m_hasSelfPaintingLayerDescendant(false) - , m_hasSelfPaintingLayerDescendantDirty(false) , m_isRootLayer(renderer->isRenderView()) , m_3DTransformedDescendantStatusDirty(true) , m_has3DTransformedDescendant(false) @@ -140,35 +138,6 @@ void RenderLayer::updateLayerPositionsAfterLayout() m_clipper.clearClipRectsIncludingDescendants(); } -void RenderLayer::updateHasSelfPaintingLayerDescendant() const -{ - ASSERT(m_hasSelfPaintingLayerDescendantDirty); - - m_hasSelfPaintingLayerDescendant = false; - - for (RenderLayer* child = firstChild(); child; child = child->nextSibling()) { - if (child->isSelfPaintingLayer() || child->hasSelfPaintingLayerDescendant()) { - m_hasSelfPaintingLayerDescendant = true; - break; - } - } - - m_hasSelfPaintingLayerDescendantDirty = false; -} - -void RenderLayer::dirtyAncestorChainHasSelfPaintingLayerDescendantStatus() -{ - for (RenderLayer* layer = this; layer; layer = layer->parent()) { - layer->m_hasSelfPaintingLayerDescendantDirty = true; - // If we have reached a self-painting layer, we know our parent should have a self-painting descendant - // in this case, there is no need to dirty our ancestors further. - if (layer->isSelfPaintingLayer()) { - ASSERT(!parent() || parent()->m_hasSelfPaintingLayerDescendantDirty || parent()->m_hasSelfPaintingLayerDescendant); - break; - } - } -} - void RenderLayer::updateTransformationMatrix() { if (m_transform) { @@ -427,8 +396,6 @@ void RenderLayer::addChild(RenderLayer* child, RenderLayer* beforeChild) // off dirty in that case anyway. child->stackingNode()->dirtyStackingContextZOrderLists(); } - - dirtyAncestorChainHasSelfPaintingLayerDescendantStatus(); } RenderLayer* RenderLayer::removeChild(RenderLayer* oldChild) @@ -457,8 +424,6 @@ RenderLayer* RenderLayer::removeChild(RenderLayer* oldChild) oldChild->setNextSibling(0); oldChild->m_parent = 0; - dirtyAncestorChainHasSelfPaintingLayerDescendantStatus(); - return oldChild; } @@ -765,18 +730,6 @@ bool RenderLayer::shouldBeSelfPaintingLayer() const return m_layerType == NormalLayer; } -void RenderLayer::updateSelfPaintingLayer() -{ - bool isSelfPaintingLayer = shouldBeSelfPaintingLayer(); - if (this->isSelfPaintingLayer() == isSelfPaintingLayer) - return; - - m_isSelfPaintingLayer = isSelfPaintingLayer; - - if (parent()) - parent()->dirtyAncestorChainHasSelfPaintingLayerDescendantStatus(); -} - bool RenderLayer::hasNonEmptyChildRenderers() const { // Some HTML can cause whitespace text nodes to have renderers, like: @@ -836,7 +789,7 @@ void RenderLayer::styleChanged(StyleDifference diff, const RenderStyle* oldStyle // Overlay scrollbars can make this layer self-painting so we need // to recompute the bit once scrollbars have been updated. - updateSelfPaintingLayer(); + m_isSelfPaintingLayer = shouldBeSelfPaintingLayer(); updateTransform(oldStyle, renderer()->style()); updateFilters(oldStyle, renderer()->style()); @@ -890,23 +843,3 @@ void RenderLayer::updateOrRemoveFilterEffectRenderer() } } // namespace blink - -#ifndef NDEBUG -void showLayerTree(const blink::RenderLayer* layer) -{ - if (!layer) - return; - - if (blink::LocalFrame* frame = layer->renderer()->frame()) { - WTF::String output = externalRepresentation(frame, blink::RenderAsTextShowAllLayers | blink::RenderAsTextShowLayerNesting | blink::RenderAsTextShowCompositedLayers | blink::RenderAsTextShowAddresses | blink::RenderAsTextShowIDAndClass | blink::RenderAsTextDontUpdateLayout | blink::RenderAsTextShowLayoutState); - fprintf(stderr, "%s\n", output.utf8().data()); - } -} - -void showLayerTree(const blink::RenderObject* renderer) -{ - if (!renderer) - return; - showLayerTree(renderer->enclosingLayer()); -} -#endif diff --git a/engine/core/rendering/RenderLayer.h b/engine/core/rendering/RenderLayer.h index 7891e6bbc5cc2a436209f486d82054345ed8bbb4..76ebf529b6025d718bafe604d95b1be5b1c494f8 100644 --- a/engine/core/rendering/RenderLayer.h +++ b/engine/core/rendering/RenderLayer.h @@ -214,38 +214,19 @@ public: } void updateOrRemoveFilterEffectRenderer(); - void updateSelfPaintingLayer(); void clipToRect(const LayerPaintingInfo&, GraphicsContext*, const ClipRect&, BorderRadiusClippingRule = IncludeSelfForBorderRadius); void restoreClip(GraphicsContext*, const LayoutRect& paintDirtyRect, const ClipRect&); private: - // TODO(ojan): Get rid of this. These are basically layer-tree-only paint phases. - enum PaintLayerFlags { - PaintContent, - }; - // Bounding box in the coordinates of this layer. LayoutRect logicalBoundingBox() const; - void setAncestorChainHasSelfPaintingLayerDescendant(); - void dirtyAncestorChainHasSelfPaintingLayerDescendantStatus(); - void setNextSibling(RenderLayer* next) { m_next = next; } void setPreviousSibling(RenderLayer* prev) { m_previous = prev; } void setFirstChild(RenderLayer* first) { m_first = first; } void setLastChild(RenderLayer* last) { m_last = last; } - void updateHasSelfPaintingLayerDescendant() const; - - bool hasSelfPaintingLayerDescendant() const - { - if (m_hasSelfPaintingLayerDescendantDirty) - updateHasSelfPaintingLayerDescendant(); - ASSERT(!m_hasSelfPaintingLayerDescendantDirty); - return m_hasSelfPaintingLayerDescendant; - } - LayoutPoint renderBoxLocation() const { return renderer()->location(); } bool shouldBeSelfPaintingLayer() const; @@ -267,11 +248,6 @@ private: // FIXME(crbug.com/332791): Self-painting layer should be merged into the overflow-only concept. unsigned m_isSelfPaintingLayer : 1; - // If have no self-painting descendants, we don't have to walk our children during painting. This can lead to - // significant savings, especially if the tree has lots of non-self-painting layers grouped together (e.g. table cells). - mutable unsigned m_hasSelfPaintingLayerDescendant : 1; - mutable unsigned m_hasSelfPaintingLayerDescendantDirty : 1; - const unsigned m_isRootLayer : 1; unsigned m_3DTransformedDescendantStatusDirty : 1; @@ -299,10 +275,4 @@ private: } // namespace blink -#ifndef NDEBUG -// Outside the WebCore namespace for ease of invocation from gdb. -void showLayerTree(const blink::RenderLayer*); -void showLayerTree(const blink::RenderObject*); -#endif - #endif // SKY_ENGINE_CORE_RENDERING_RENDERLAYER_H_