Commit 89dd0eae authored by abarth@chromium.org's avatar abarth@chromium.org

CompositedLayerMapping should use dirty bits for bounds update

This CL teaches CompositedLayerMapping::updateCompositedBounds about the
m_needToUpdateGeometry dirty bit. Now we only update the composited bounds if
they could have possibly changed.

This CL saves 14% of the compositing update in Polymer's calculator sample app.

R=ojan@chromium.org

Review URL: https://codereview.chromium.org/208643002

git-svn-id: svn://svn.chromium.org/blink/trunk@169762 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 741f08a4
...@@ -350,8 +350,11 @@ bool CompositedLayerMapping::shouldClipCompositedBounds() const ...@@ -350,8 +350,11 @@ bool CompositedLayerMapping::shouldClipCompositedBounds() const
return false; return false;
} }
void CompositedLayerMapping::updateCompositedBounds() void CompositedLayerMapping::updateCompositedBounds(GraphicsLayerUpdater::UpdateType updateType)
{ {
if (!m_needToUpdateGeometry && updateType != GraphicsLayerUpdater::ForceUpdate)
return;
// We need to know if we draw content in order to update our bounds (this has an effect // We need to know if we draw content in order to update our bounds (this has an effect
// on whether or not descendands will paint into our backing). Update this value now. // on whether or not descendands will paint into our backing). Update this value now.
updateDrawsContent(); updateDrawsContent();
...@@ -425,7 +428,7 @@ void CompositedLayerMapping::updateAfterLayout(UpdateAfterLayoutFlags flags) ...@@ -425,7 +428,7 @@ void CompositedLayerMapping::updateAfterLayout(UpdateAfterLayoutFlags flags)
// //
// The solution is to update compositing children of this layer here, // The solution is to update compositing children of this layer here,
// via updateCompositingChildrenGeometry(). // via updateCompositingChildrenGeometry().
updateCompositedBounds(); updateCompositedBounds(GraphicsLayerUpdater::ForceUpdate);
layerCompositor->updateCompositingDescendantGeometry(m_owningLayer.stackingNode(), &m_owningLayer, flags & CompositingChildrenOnly); layerCompositor->updateCompositingDescendantGeometry(m_owningLayer.stackingNode(), &m_owningLayer, flags & CompositingChildrenOnly);
if (flags & IsUpdateRoot) { if (flags & IsUpdateRoot) {
......
...@@ -161,7 +161,7 @@ public: ...@@ -161,7 +161,7 @@ public:
LayoutRect compositedBounds() const { return m_compositedBounds; } LayoutRect compositedBounds() const { return m_compositedBounds; }
IntRect pixelSnappedCompositedBounds() const; IntRect pixelSnappedCompositedBounds() const;
void setCompositedBounds(const LayoutRect&); void setCompositedBounds(const LayoutRect&);
void updateCompositedBounds(); void updateCompositedBounds(GraphicsLayerUpdater::UpdateType);
void updateAfterWidgetResize(); void updateAfterWidgetResize();
void positionOverflowControlsLayers(const IntSize& offsetFromRoot); void positionOverflowControlsLayers(const IntSize& offsetFromRoot);
......
...@@ -166,11 +166,11 @@ GraphicsLayerUpdater::UpdateType GraphicsLayerUpdater::update(RenderLayer& layer ...@@ -166,11 +166,11 @@ GraphicsLayerUpdater::UpdateType GraphicsLayerUpdater::update(RenderLayer& layer
// Note carefully: here we assume that the compositing state of all descendants have been updated already, // Note carefully: here we assume that the compositing state of all descendants have been updated already,
// so it is legitimate to compute and cache the composited bounds for this layer. // so it is legitimate to compute and cache the composited bounds for this layer.
mapping->updateCompositedBounds(); mapping->updateCompositedBounds(updateType);
if (RenderLayerReflectionInfo* reflection = layer.reflectionInfo()) { if (RenderLayerReflectionInfo* reflection = layer.reflectionInfo()) {
if (reflection->reflectionLayer()->hasCompositedLayerMapping()) if (reflection->reflectionLayer()->hasCompositedLayerMapping())
reflection->reflectionLayer()->compositedLayerMapping()->updateCompositedBounds(); reflection->reflectionLayer()->compositedLayerMapping()->updateCompositedBounds(ForceUpdate);
} }
mapping->updateGraphicsLayerConfiguration(); mapping->updateGraphicsLayerConfiguration();
......
...@@ -1431,12 +1431,12 @@ void RenderLayerCompositor::updateCompositingDescendantGeometry(RenderLayerStack ...@@ -1431,12 +1431,12 @@ void RenderLayerCompositor::updateCompositingDescendantGeometry(RenderLayerStack
if (layer->stackingNode() != compositingAncestor) { if (layer->stackingNode() != compositingAncestor) {
if (layer->hasCompositedLayerMapping()) { if (layer->hasCompositedLayerMapping()) {
CompositedLayerMappingPtr compositedLayerMapping = layer->compositedLayerMapping(); CompositedLayerMappingPtr compositedLayerMapping = layer->compositedLayerMapping();
compositedLayerMapping->updateCompositedBounds(); compositedLayerMapping->updateCompositedBounds(GraphicsLayerUpdater::ForceUpdate);
if (layer->reflectionInfo()) { if (layer->reflectionInfo()) {
RenderLayer* reflectionLayer = layer->reflectionInfo()->reflectionLayer(); RenderLayer* reflectionLayer = layer->reflectionInfo()->reflectionLayer();
if (reflectionLayer->hasCompositedLayerMapping()) if (reflectionLayer->hasCompositedLayerMapping())
reflectionLayer->compositedLayerMapping()->updateCompositedBounds(); reflectionLayer->compositedLayerMapping()->updateCompositedBounds(GraphicsLayerUpdater::ForceUpdate);
} }
compositedLayerMapping->updateGraphicsLayerGeometry(GraphicsLayerUpdater::ForceUpdate); compositedLayerMapping->updateGraphicsLayerGeometry(GraphicsLayerUpdater::ForceUpdate);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment