Commit 56263f18 authored by chrishtr@chromium.org's avatar chrishtr@chromium.org

Issue paint invalidations *before* and after changing offsetFromRenderer

and reconfiguring the squashing GraphicsLayer.

Previously we were issuing them only after.

BUG=385103

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

git-svn-id: svn://svn.chromium.org/blink/trunk@176466 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 74c8b628
......@@ -123,6 +123,7 @@ CASE 4, overlap1 gets removed:
(bounds 100.00 100.00)
(drawsContent 1)
(repaint rects
(rect 160.00 160.00 100.00 100.00)
(rect 0.00 0.00 100.00 100.00)
(rect 0.00 0.00 100.00 100.00)
)
......@@ -163,7 +164,6 @@ CASE 5, overlap2 gets added back:
(rect 80.00 80.00 100.00 100.00)
(rect 0.00 0.00 100.00 100.00)
(rect 0.00 0.00 100.00 100.00)
(rect 0.00 0.00 100.00 100.00)
)
)
)
......
......@@ -17,6 +17,7 @@
(bounds 500.00 500.00)
(drawsContent 1)
(repaint rects
(rect 55.00 55.00 500.00 500.00)
(rect 55.00 55.00 500.00 500.00)
(rect 0.00 0.00 500.00 500.00)
(rect 0.00 0.00 50.00 50.00)
......
......@@ -525,7 +525,7 @@ void CompositedLayerMapping::computeBoundsOfOwningLayer(const RenderLayer* compo
}
void CompositedLayerMapping::updateSquashingLayerGeometry(const LayoutPoint& offsetFromCompositedAncestor, const IntPoint& graphicsLayerParentLocation, const RenderLayer& referenceLayer,
Vector<GraphicsLayerPaintInfo>& layers, GraphicsLayer* squashingLayer, LayoutPoint* offsetFromTransformedAncestor)
Vector<GraphicsLayerPaintInfo>& layers, GraphicsLayer* squashingLayer, LayoutPoint* offsetFromTransformedAncestor, Vector<RenderLayer*>& layersNeedingPaintInvalidation)
{
if (!squashingLayer)
return;
......@@ -560,12 +560,6 @@ void CompositedLayerMapping::updateSquashingLayerGeometry(const LayoutPoint& off
IntPoint squashLayerOrigin = squashLayerBounds.location();
LayoutSize squashLayerOriginInOwningLayerSpace = squashLayerOrigin - offsetFromReferenceLayerToParentGraphicsLayer;
squashingLayer->setPosition(squashLayerBounds.location());
squashingLayer->setSize(squashLayerBounds.size());
*offsetFromTransformedAncestor = referenceOffsetFromTransformedAncestor;
offsetFromTransformedAncestor->move(squashLayerOriginInOwningLayerSpace);
// Now that the squashing bounds are known, we can convert the RenderLayer painting offsets
// from CLM owning layer space to the squashing layer space.
//
......@@ -583,8 +577,10 @@ void CompositedLayerMapping::updateSquashingLayerGeometry(const LayoutPoint& off
// It is ok to repaint here, because all of the geometry needed to correctly repaint is computed by this point.
IntSize newOffsetFromRenderer = -IntSize(offsetFromSquashLayerOrigin.width().round(), offsetFromSquashLayerOrigin.height().round());
LayoutSize subpixelAccumulation = offsetFromSquashLayerOrigin + newOffsetFromRenderer;
if (layers[i].offsetFromRendererSet && layers[i].offsetFromRenderer != newOffsetFromRenderer)
if (layers[i].offsetFromRendererSet && layers[i].offsetFromRenderer != newOffsetFromRenderer) {
layers[i].renderLayer->repainter().repaintIncludingNonCompositingDescendants();
layersNeedingPaintInvalidation.append(layers[i].renderLayer);
}
layers[i].offsetFromRenderer = newOffsetFromRenderer;
layers[i].offsetFromRendererSet = true;
......@@ -595,11 +591,17 @@ void CompositedLayerMapping::updateSquashingLayerGeometry(const LayoutPoint& off
layers[i].renderLayer->setOffsetFromSquashingLayerOrigin(layers[i].offsetFromRenderer);
}
squashingLayer->setPosition(squashLayerBounds.location());
squashingLayer->setSize(squashLayerBounds.size());
*offsetFromTransformedAncestor = referenceOffsetFromTransformedAncestor;
offsetFromTransformedAncestor->move(squashLayerOriginInOwningLayerSpace);
for (size_t i = 0; i < layers.size(); ++i)
layers[i].localClipRectForSquashedLayer = localClipRectForSquashedLayer(referenceLayer, layers[i], layers);
}
void CompositedLayerMapping::updateGraphicsLayerGeometry(GraphicsLayerUpdater::UpdateType updateType, const RenderLayer* compositingContainer)
void CompositedLayerMapping::updateGraphicsLayerGeometry(GraphicsLayerUpdater::UpdateType updateType, const RenderLayer* compositingContainer, Vector<RenderLayer*>& layersNeedingPaintInvalidation)
{
if (!shouldUpdateGraphicsLayer(updateType))
return;
......@@ -637,7 +639,7 @@ void CompositedLayerMapping::updateGraphicsLayerGeometry(GraphicsLayerUpdater::U
FloatSize contentsSize = relativeCompositingBounds.size();
updateMainGraphicsLayerGeometry(relativeCompositingBounds, localCompositingBounds, graphicsLayerParentLocation);
updateSquashingLayerGeometry(offsetFromCompositedAncestor, graphicsLayerParentLocation, m_owningLayer, m_squashedLayers, m_squashingLayer.get(), &m_squashingLayerOffsetFromTransformedAncestor);
updateSquashingLayerGeometry(offsetFromCompositedAncestor, graphicsLayerParentLocation, m_owningLayer, m_squashedLayers, m_squashingLayer.get(), &m_squashingLayerOffsetFromTransformedAncestor, layersNeedingPaintInvalidation);
// If we have a layer that clips children, position it.
IntRect clippingBox;
......@@ -651,7 +653,7 @@ void CompositedLayerMapping::updateGraphicsLayerGeometry(GraphicsLayerUpdater::U
updateTransformGeometry(snappedOffsetFromCompositedAncestor, relativeCompositingBounds);
updateForegroundLayerGeometry(contentsSize, clippingBox);
updateBackgroundLayerGeometry(contentsSize);
updateReflectionLayerGeometry();
updateReflectionLayerGeometry(layersNeedingPaintInvalidation);
updateScrollingLayerGeometry(localCompositingBounds);
updateChildClippingMaskLayerGeometry();
......@@ -811,13 +813,13 @@ void CompositedLayerMapping::updateTransformGeometry(const IntPoint& snappedOffs
}
}
void CompositedLayerMapping::updateReflectionLayerGeometry()
void CompositedLayerMapping::updateReflectionLayerGeometry(Vector<RenderLayer*>& layersNeedingPaintInvalidation)
{
if (!m_owningLayer.reflectionInfo() || !m_owningLayer.reflectionInfo()->reflectionLayer()->hasCompositedLayerMapping())
return;
CompositedLayerMappingPtr reflectionCompositedLayerMapping = m_owningLayer.reflectionInfo()->reflectionLayer()->compositedLayerMapping();
reflectionCompositedLayerMapping->updateGraphicsLayerGeometry(GraphicsLayerUpdater::ForceUpdate, &m_owningLayer);
reflectionCompositedLayerMapping->updateGraphicsLayerGeometry(GraphicsLayerUpdater::ForceUpdate, &m_owningLayer, layersNeedingPaintInvalidation);
}
void CompositedLayerMapping::updateScrollingLayerGeometry(const IntRect& localCompositingBounds)
......
......@@ -87,7 +87,7 @@ public:
bool updateGraphicsLayerConfiguration(GraphicsLayerUpdater::UpdateType);
// Update graphics layer position and bounds.
void updateGraphicsLayerGeometry(GraphicsLayerUpdater::UpdateType, const RenderLayer* compositingContainer);
void updateGraphicsLayerGeometry(GraphicsLayerUpdater::UpdateType, const RenderLayer* compositingContainer, Vector<RenderLayer*>& layersNeedingPaintInvalidation);
// Update whether layer needs blending.
void updateContentsOpaque();
......@@ -217,7 +217,7 @@ private:
// Helper methods to updateGraphicsLayerGeometry:
void computeGraphicsLayerParentLocation(const RenderLayer* compositingContainer, const IntRect& ancestorCompositingBounds, IntPoint& graphicsLayerParentLocation);
void updateSquashingLayerGeometry(const LayoutPoint& offsetFromCompositedAncestor, const IntPoint& graphicsLayerParentLocation, const RenderLayer& referenceLayer, Vector<GraphicsLayerPaintInfo>& layers, GraphicsLayer*, LayoutPoint* offsetFromTransformedAncestor);
void updateSquashingLayerGeometry(const LayoutPoint& offsetFromCompositedAncestor, const IntPoint& graphicsLayerParentLocation, const RenderLayer& referenceLayer, Vector<GraphicsLayerPaintInfo>& layers, GraphicsLayer*, LayoutPoint* offsetFromTransformedAncestor, Vector<RenderLayer*>& layersNeedingPaintInvalidation);
void updateMainGraphicsLayerGeometry(const IntRect& relativeCompositingBounds, const IntRect& localCompositingBounds, IntPoint& graphicsLayerParentLocation);
void updateAncestorClippingLayerGeometry(const RenderLayer* compositingContainer, const IntPoint& snappedOffsetFromCompositedAncestor, IntPoint& graphicsLayerParentLocation);
void updateChildContainmentLayerGeometry(const IntRect& clippingBox, const IntRect& localCompositingBounds);
......@@ -226,7 +226,7 @@ private:
void updateTransformGeometry(const IntPoint& snappedOffsetFromCompositedAncestor, const IntRect& relativeCompositingBounds);
void updateForegroundLayerGeometry(const FloatSize& relativeCompositingBoundsSize, const IntRect& clippingBox);
void updateBackgroundLayerGeometry(const FloatSize& relativeCompositingBoundsSize);
void updateReflectionLayerGeometry();
void updateReflectionLayerGeometry(Vector<RenderLayer*>& layersNeedingPaintInvalidation);
void updateScrollingLayerGeometry(const IntRect& localCompositingBounds);
void updateChildClippingMaskLayerGeometry();
......
......@@ -62,7 +62,7 @@ GraphicsLayerUpdater::~GraphicsLayerUpdater()
{
}
void GraphicsLayerUpdater::update(RenderLayer& layer, UpdateType updateType, const UpdateContext& context)
void GraphicsLayerUpdater::update(Vector<RenderLayer*>& layersNeedingPaintInvalidation, RenderLayer& layer, UpdateType updateType, const UpdateContext& context)
{
if (layer.hasCompositedLayerMapping()) {
CompositedLayerMappingPtr mapping = layer.compositedLayerMapping();
......@@ -84,7 +84,7 @@ void GraphicsLayerUpdater::update(RenderLayer& layer, UpdateType updateType, con
if (mapping->updateGraphicsLayerConfiguration(updateType))
m_needsRebuildTree = true;
mapping->updateGraphicsLayerGeometry(updateType, compositingContainer);
mapping->updateGraphicsLayerGeometry(updateType, compositingContainer, layersNeedingPaintInvalidation);
updateType = mapping->updateTypeForChildren(updateType);
mapping->clearNeedsGraphicsLayerUpdate();
......@@ -98,7 +98,7 @@ void GraphicsLayerUpdater::update(RenderLayer& layer, UpdateType updateType, con
UpdateContext childContext(context, layer);
for (RenderLayer* child = layer.firstChild(); child; child = child->nextSibling())
update(*child, updateType, childContext);
update(layersNeedingPaintInvalidation, *child, updateType, childContext);
}
#if ASSERT_ENABLED
......
......@@ -59,7 +59,7 @@ public:
ForceUpdate,
};
void update(RenderLayer&, UpdateType = DoNotForceUpdate, const UpdateContext& = UpdateContext());
void update(Vector<RenderLayer*>& layersNeedingPaintInvalidation, RenderLayer&, UpdateType = DoNotForceUpdate, const UpdateContext& = UpdateContext());
void rebuildTree(RenderLayer&, GraphicsLayerVector& childLayersOfEnclosingLayer);
bool needsRebuildTree() const { return m_needsRebuildTree; }
......
......@@ -333,7 +333,7 @@ void RenderLayerCompositor::updateIfNeeded()
if (updateType != CompositingUpdateNone) {
TRACE_EVENT0("blink_rendering", "GraphicsLayerUpdater::updateRecursive");
GraphicsLayerUpdater updater;
updater.update(*updateRoot);
updater.update(layersNeedingRepaint, *updateRoot);
if (updater.needsRebuildTree())
updateType = std::max(updateType, CompositingUpdateRebuildTree);
......
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