Commit 0110067c authored by chrishtr@chromium.org's avatar chrishtr@chromium.org

Round in the range [-0.5, 0.5) when computing offsetFromRenderer and subpixelAccumulation

for squashed layers.

Also remove the assert that the subpixel accumulation matches
the subpixel accumulation if the layer was separately
composited. This doesn't make sense, since the squashing
layer is positioned relative to the compositing ancestor
of m_owningLayer, not the squashing layer, which can have
different subpixel accumulations since subpixel
accumulation is relative to the compositing container of
the graphics layer.

BUG=369526

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

git-svn-id: svn://svn.chromium.org/blink/trunk@176441 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent b960653b
<!doctype HTML>
<div style="position: absolute; width: 200px; height: 200px; left: 0px; top: 0px; background-color: lightgreen"></div>
<div style="position: absolute; width: 1px; height: 1px; left: 0px; top:0.6px; background-color: lightgray"></div>
<!doctype HTML>
<!-- The second div squashes into the first, and had a fractional position greater than 0.5. This tests that pixel snapping for squashed layers
matches that of non-squashed layers -->
<div style="position: absolute; width: 200px; height: 200px; left: 0px; top: 0px; transform: translateZ(0); background-color: lightgreen"></div>
<div style="position: absolute; width: 1px; height: 1px; left: 0px; top:0.6px; background-color: lightgray"></div>
......@@ -556,8 +556,8 @@ void CompositedLayerMapping::updateSquashingLayerGeometry(const LayoutPoint& off
// The totalSquashBounds is positioned with respect to referenceLayer of this CompositedLayerMapping.
// But the squashingLayer needs to be positioned with respect to the ancestor CompositedLayerMapping.
// The conversion between referenceLayer and the ancestor CLM is already computed in the caller as
// offsetFromReferenceLayerToCompositedAncestor.
// The conversion between referenceLayer and the ancestor CLM is already computed as
// offsetFromReferenceLayerToParentGraphicsLayer.
totalSquashBounds.moveBy(offsetFromReferenceLayerToParentGraphicsLayer);
IntRect squashLayerBounds = enclosingIntRect(totalSquashBounds);
IntPoint squashLayerOrigin = squashLayerBounds.location();
......@@ -581,15 +581,14 @@ void CompositedLayerMapping::updateSquashingLayerGeometry(const LayoutPoint& off
LayoutSize offsetFromSquashLayerOrigin = (offsetFromTransformedAncestorForSquashedLayer - referenceOffsetFromTransformedAncestor) - squashLayerOriginInOwningLayerSpace;
// It is ok to repaint here, because all of the geometry needed to correctly repaint is computed by this point.
IntSize newOffsetFromRenderer = -flooredIntSize(offsetFromSquashLayerOrigin);
IntSize newOffsetFromRenderer = -IntSize(offsetFromSquashLayerOrigin.width().round(), offsetFromSquashLayerOrigin.height().round());
LayoutSize subpixelAccumulation = offsetFromSquashLayerOrigin + newOffsetFromRenderer;
if (layers[i].offsetFromRendererSet && layers[i].offsetFromRenderer != newOffsetFromRenderer)
layers[i].renderLayer->repainter().repaintIncludingNonCompositingDescendants();
layers[i].offsetFromRenderer = newOffsetFromRenderer;
layers[i].offsetFromRendererSet = true;
layers[i].renderLayer->setSubpixelAccumulation(offsetFromSquashLayerOrigin.fraction());
ASSERT(layers[i].renderLayer->subpixelAccumulation() ==
toLayoutSize(computeOffsetFromCompositedAncestor(layers[i].renderLayer, layers[i].renderLayer->ancestorCompositingLayer())).fraction());
layers[i].renderLayer->setSubpixelAccumulation(subpixelAccumulation);
// 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.
......
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