提交 cec128f4 编写于 作者: O Ojan Vafai

Remove some dead RenderLayer code.

-m_hasSelfPaintingLayerDescendant is never read.
-remove showLayerTree. The layer tree is going away. We won't need this.

R=abarth@chromium.org

Review URL: https://codereview.chromium.org/952343003
上级 95a2e778
...@@ -80,8 +80,6 @@ namespace blink { ...@@ -80,8 +80,6 @@ namespace blink {
RenderLayer::RenderLayer(RenderBox* renderer, LayerType type) RenderLayer::RenderLayer(RenderBox* renderer, LayerType type)
: m_layerType(type) : m_layerType(type)
, m_hasSelfPaintingLayerDescendant(false)
, m_hasSelfPaintingLayerDescendantDirty(false)
, m_isRootLayer(renderer->isRenderView()) , m_isRootLayer(renderer->isRenderView())
, m_3DTransformedDescendantStatusDirty(true) , m_3DTransformedDescendantStatusDirty(true)
, m_has3DTransformedDescendant(false) , m_has3DTransformedDescendant(false)
...@@ -140,35 +138,6 @@ void RenderLayer::updateLayerPositionsAfterLayout() ...@@ -140,35 +138,6 @@ void RenderLayer::updateLayerPositionsAfterLayout()
m_clipper.clearClipRectsIncludingDescendants(); 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() void RenderLayer::updateTransformationMatrix()
{ {
if (m_transform) { if (m_transform) {
...@@ -427,8 +396,6 @@ void RenderLayer::addChild(RenderLayer* child, RenderLayer* beforeChild) ...@@ -427,8 +396,6 @@ void RenderLayer::addChild(RenderLayer* child, RenderLayer* beforeChild)
// off dirty in that case anyway. // off dirty in that case anyway.
child->stackingNode()->dirtyStackingContextZOrderLists(); child->stackingNode()->dirtyStackingContextZOrderLists();
} }
dirtyAncestorChainHasSelfPaintingLayerDescendantStatus();
} }
RenderLayer* RenderLayer::removeChild(RenderLayer* oldChild) RenderLayer* RenderLayer::removeChild(RenderLayer* oldChild)
...@@ -457,8 +424,6 @@ RenderLayer* RenderLayer::removeChild(RenderLayer* oldChild) ...@@ -457,8 +424,6 @@ RenderLayer* RenderLayer::removeChild(RenderLayer* oldChild)
oldChild->setNextSibling(0); oldChild->setNextSibling(0);
oldChild->m_parent = 0; oldChild->m_parent = 0;
dirtyAncestorChainHasSelfPaintingLayerDescendantStatus();
return oldChild; return oldChild;
} }
...@@ -765,18 +730,6 @@ bool RenderLayer::shouldBeSelfPaintingLayer() const ...@@ -765,18 +730,6 @@ bool RenderLayer::shouldBeSelfPaintingLayer() const
return m_layerType == NormalLayer; 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 bool RenderLayer::hasNonEmptyChildRenderers() const
{ {
// Some HTML can cause whitespace text nodes to have renderers, like: // Some HTML can cause whitespace text nodes to have renderers, like:
...@@ -836,7 +789,7 @@ void RenderLayer::styleChanged(StyleDifference diff, const RenderStyle* oldStyle ...@@ -836,7 +789,7 @@ void RenderLayer::styleChanged(StyleDifference diff, const RenderStyle* oldStyle
// Overlay scrollbars can make this layer self-painting so we need // Overlay scrollbars can make this layer self-painting so we need
// to recompute the bit once scrollbars have been updated. // to recompute the bit once scrollbars have been updated.
updateSelfPaintingLayer(); m_isSelfPaintingLayer = shouldBeSelfPaintingLayer();
updateTransform(oldStyle, renderer()->style()); updateTransform(oldStyle, renderer()->style());
updateFilters(oldStyle, renderer()->style()); updateFilters(oldStyle, renderer()->style());
...@@ -890,23 +843,3 @@ void RenderLayer::updateOrRemoveFilterEffectRenderer() ...@@ -890,23 +843,3 @@ void RenderLayer::updateOrRemoveFilterEffectRenderer()
} }
} // namespace blink } // 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
...@@ -214,38 +214,19 @@ public: ...@@ -214,38 +214,19 @@ public:
} }
void updateOrRemoveFilterEffectRenderer(); void updateOrRemoveFilterEffectRenderer();
void updateSelfPaintingLayer();
void clipToRect(const LayerPaintingInfo&, GraphicsContext*, const ClipRect&, BorderRadiusClippingRule = IncludeSelfForBorderRadius); void clipToRect(const LayerPaintingInfo&, GraphicsContext*, const ClipRect&, BorderRadiusClippingRule = IncludeSelfForBorderRadius);
void restoreClip(GraphicsContext*, const LayoutRect& paintDirtyRect, const ClipRect&); void restoreClip(GraphicsContext*, const LayoutRect& paintDirtyRect, const ClipRect&);
private: 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. // Bounding box in the coordinates of this layer.
LayoutRect logicalBoundingBox() const; LayoutRect logicalBoundingBox() const;
void setAncestorChainHasSelfPaintingLayerDescendant();
void dirtyAncestorChainHasSelfPaintingLayerDescendantStatus();
void setNextSibling(RenderLayer* next) { m_next = next; } void setNextSibling(RenderLayer* next) { m_next = next; }
void setPreviousSibling(RenderLayer* prev) { m_previous = prev; } void setPreviousSibling(RenderLayer* prev) { m_previous = prev; }
void setFirstChild(RenderLayer* first) { m_first = first; } void setFirstChild(RenderLayer* first) { m_first = first; }
void setLastChild(RenderLayer* last) { m_last = last; } 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(); } LayoutPoint renderBoxLocation() const { return renderer()->location(); }
bool shouldBeSelfPaintingLayer() const; bool shouldBeSelfPaintingLayer() const;
...@@ -267,11 +248,6 @@ private: ...@@ -267,11 +248,6 @@ private:
// FIXME(crbug.com/332791): Self-painting layer should be merged into the overflow-only concept. // FIXME(crbug.com/332791): Self-painting layer should be merged into the overflow-only concept.
unsigned m_isSelfPaintingLayer : 1; 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; const unsigned m_isRootLayer : 1;
unsigned m_3DTransformedDescendantStatusDirty : 1; unsigned m_3DTransformedDescendantStatusDirty : 1;
...@@ -299,10 +275,4 @@ private: ...@@ -299,10 +275,4 @@ private:
} // namespace blink } // 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_ #endif // SKY_ENGINE_CORE_RENDERING_RENDERLAYER_H_
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册