Chromium Code Reviews| Index: Source/core/rendering/compositing/CompositedLayerMapping.cpp |
| diff --git a/Source/core/rendering/compositing/CompositedLayerMapping.cpp b/Source/core/rendering/compositing/CompositedLayerMapping.cpp |
| index 1997accd403e335080362befcb932f53bcb2f9ff..3212e17039b1700bae759a6027ecce80fa486c4b 100644 |
| --- a/Source/core/rendering/compositing/CompositedLayerMapping.cpp |
| +++ b/Source/core/rendering/compositing/CompositedLayerMapping.cpp |
| @@ -599,12 +599,13 @@ void CompositedLayerMapping::updateSquashingLayerGeometry(const IntPoint& delta) |
| // The totalSquashBounds is positioned with respect to m_owningLayer of this CompositedLayerMapping. |
| // But the squashingLayer needs to be positioned with respect to the ancestor CompositedLayerMapping. |
| // The conversion between m_owningLayer and the ancestor CLM is already computed in the caller as |delta|. |
| - // FIXME: probably not the right place to round from LayoutPoint to IntPoint? |
| - IntPoint squashLayerPosition = pixelSnappedIntRect(totalSquashBounds).location(); |
| - squashLayerPosition.moveBy(delta); |
| + totalSquashBounds.move(m_subpixelAccumulation); |
|
chrishtr
2014/03/13 21:46:05
Why still use m_subpixelAccumulation at all? The a
ajuma
2014/03/13 21:55:48
The reason we use m_subpixelAccumulation here and
chrishtr
2014/03/17 20:20:33
Sure, but it looks like you are using that to set
|
| + IntRect squashLayerBounds = enclosingIntRect(totalSquashBounds); |
| + IntPoint squashLayerOrigin = squashLayerBounds.location(); |
| + squashLayerBounds.moveBy(delta); |
| - m_squashingLayer->setPosition(squashLayerPosition); |
| - m_squashingLayer->setSize(totalSquashBounds.size()); |
| + m_squashingLayer->setPosition(squashLayerBounds.location()); |
| + m_squashingLayer->setSize(squashLayerBounds.size()); |
| // Now that the squashing bounds are known, we can convert the RenderLayer painting offsets |
| // from CLM owning layer space to the squashing layer space. |
| @@ -613,11 +614,13 @@ void CompositedLayerMapping::updateSquashingLayerGeometry(const IntPoint& delta) |
| // the squashed RenderLayer described w.r.t. m_squashingLayer's origin. For this purpose we already cached |
| // offsetFromSquashingCLM before, which describes where the squashed RenderLayer is located w.r.t. |
| // m_owningLayer. So we just need to convert that point from m_owningLayer space to m_squashingLayer |
| - // space. This is simply done by subtracing totalSquashBounds... but then the offset overall needs to be |
| + // space. This is simply done by subtracing squashLayerOrigin... but then the offset overall needs to be |
| // negated because that's the direction that the painting code expects the offset to be. |
| for (size_t i = 0; i < m_squashedLayers.size(); ++i) { |
| - m_squashedLayers[i].offsetFromRenderer = IntSize(-m_squashedLayers[i].offsetFromSquashingCLM.width() + totalSquashBounds.x(), |
| - -m_squashedLayers[i].offsetFromSquashingCLM.height() + totalSquashBounds.y()); |
| + LayoutSize offsetFromSquashLayerOrigin = LayoutSize(m_squashedLayers[i].offsetFromSquashingCLM.width() - squashLayerOrigin.x() + m_subpixelAccumulation.width(), |
|
chrishtr
2014/03/17 20:20:33
Isn't this wrong to use m_subpixelAccumulation? Ea
ajuma
2014/03/18 17:32:17
I've cleaned up the code (here and above) to make
|
| + m_squashedLayers[i].offsetFromSquashingCLM.height() - squashLayerOrigin.y() + m_subpixelAccumulation.height()); |
| + m_squashedLayers[i].offsetFromRenderer = -flooredIntSize(offsetFromSquashLayerOrigin); |
| + m_squashedLayers[i].subpixelAccumulation = offsetFromSquashLayerOrigin.fraction(); |
| // FIXME: find a better design to avoid this redundant value - most likely it will make |
| // sense to move the paint task info into RenderLayer's m_compositingProperties. |
| @@ -1900,10 +1903,10 @@ void CompositedLayerMapping::doPaintTask(GraphicsLayerPaintInfo& paintInfo, Grap |
| if (!(paintInfo.paintingPhase & GraphicsLayerPaintOverflowContents)) { |
| LayoutRect bounds = paintInfo.compositedBounds; |
| - bounds.move(m_subpixelAccumulation); |
| + bounds.move(paintInfo.subpixelAccumulation); |
| dirtyRect.intersect(pixelSnappedIntRect(bounds)); |
| } else { |
| - dirtyRect.move(roundedIntSize(m_subpixelAccumulation)); |
| + dirtyRect.move(roundedIntSize(paintInfo.subpixelAccumulation)); |
| } |
| #ifndef NDEBUG |
| @@ -1912,7 +1915,7 @@ void CompositedLayerMapping::doPaintTask(GraphicsLayerPaintInfo& paintInfo, Grap |
| if (paintInfo.renderLayer->compositingState() != PaintsIntoGroupedBacking) { |
| // FIXME: GraphicsLayers need a way to split for RenderRegions. |
| - LayerPaintingInfo paintingInfo(paintInfo.renderLayer, dirtyRect, PaintBehaviorNormal, m_subpixelAccumulation); |
| + LayerPaintingInfo paintingInfo(paintInfo.renderLayer, dirtyRect, PaintBehaviorNormal, paintInfo.subpixelAccumulation); |
| paintInfo.renderLayer->paintLayerContents(context, paintingInfo, paintFlags); |
| ASSERT(!paintInfo.isBackgroundLayer || paintFlags & PaintLayerPaintingRootBackgroundOnly); |
| @@ -1921,7 +1924,7 @@ void CompositedLayerMapping::doPaintTask(GraphicsLayerPaintInfo& paintInfo, Grap |
| paintInfo.renderLayer->paintLayerContents(context, paintingInfo, paintFlags | PaintLayerPaintingOverlayScrollbars); |
| } else { |
| ASSERT(compositor()->layerSquashingEnabled()); |
| - LayerPaintingInfo paintingInfo(paintInfo.renderLayer, dirtyRect, PaintBehaviorNormal, LayoutSize()); |
| + LayerPaintingInfo paintingInfo(paintInfo.renderLayer, dirtyRect, PaintBehaviorNormal, paintInfo.subpixelAccumulation); |
| paintInfo.renderLayer->paintLayer(context, paintingInfo, paintFlags); |
| } |
| @@ -1970,6 +1973,7 @@ void CompositedLayerMapping::paintContents(const GraphicsLayer* graphicsLayer, G |
| paintInfo.offsetFromRenderer = graphicsLayer->offsetFromRenderer(); |
| paintInfo.paintingPhase = paintingPhase; |
| paintInfo.isBackgroundLayer = (graphicsLayer == m_backgroundLayer); |
| + paintInfo.subpixelAccumulation = m_subpixelAccumulation; |
| // We have to use the same root as for hit testing, because both methods can compute and cache clipRects. |
| doPaintTask(paintInfo, &context, clip); |
| @@ -2039,7 +2043,7 @@ void CompositedLayerMapping::setCompositedBounds(const LayoutRect& bounds) |
| m_compositedBounds = bounds; |
| } |
| -bool CompositedLayerMapping::updateSquashingLayerAssignment(RenderLayer* layer, IntSize offsetFromSquashingCLM, size_t nextSquashedLayerIndex) |
| +bool CompositedLayerMapping::updateSquashingLayerAssignment(RenderLayer* layer, LayoutSize offsetFromSquashingCLM, size_t nextSquashedLayerIndex) |
| { |
| ASSERT(compositor()->layerSquashingEnabled()); |