Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1323)

Unified Diff: Source/core/rendering/compositing/CompositedLayerMapping.cpp

Issue 204053002: Fix pixel snapping of stacked sub-pixel composited layers (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/rendering/compositing/CompositedLayerMapping.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..136118ad029de170fc03c93fd1f32edcb189f742 100644
--- a/Source/core/rendering/compositing/CompositedLayerMapping.cpp
+++ b/Source/core/rendering/compositing/CompositedLayerMapping.cpp
@@ -566,6 +566,8 @@ void CompositedLayerMapping::adjustBoundsForSubPixelAccumulation(const RenderLay
LayoutRect localRawCompositingBounds = compositedBounds();
LayoutPoint rawDelta;
m_owningLayer.convertToLayerCoords(compositedAncestor, rawDelta);
+ if (compositedAncestor)
+ rawDelta.move(compositedAncestor->compositedLayerMapping()->subpixelAccumulation());
delta = flooredIntPoint(rawDelta);
m_subpixelAccumulation = toLayoutSize(rawDelta).fraction();
RELEASE_ASSERT(m_subpixelAccumulation.width() < 1 && m_subpixelAccumulation.height() < 1);
@@ -668,7 +670,7 @@ GraphicsLayerUpdater::UpdateType CompositedLayerMapping::updateGraphicsLayerGeom
IntRect ancestorCompositingBounds;
if (compAncestor) {
ASSERT(compAncestor->hasCompositedLayerMapping());
- ancestorCompositingBounds = pixelSnappedIntRect(compAncestor->compositedLayerMapping()->compositedBounds());
+ ancestorCompositingBounds = compAncestor->compositedLayerMapping()->pixelSnappedCompositedBounds();
}
IntRect localCompositingBounds;
@@ -744,13 +746,14 @@ GraphicsLayerUpdater::UpdateType CompositedLayerMapping::updateGraphicsLayerGeom
}
if (m_owningLayer.hasTransform()) {
- const IntRect borderBox = toRenderBox(renderer())->pixelSnappedBorderBoxRect();
+ const LayoutRect borderBox = toRenderBox(renderer())->borderBoxRect();
// Get layout bounds in the coords of compAncestor to match relativeCompositingBounds.
- IntRect layerBounds(delta + roundedIntSize(m_subpixelAccumulation), borderBox.size());
+ IntRect layerBounds = pixelSnappedIntRect(toLayoutPoint(m_subpixelAccumulation), borderBox.size());
+ layerBounds.moveBy(delta);
// Update properties that depend on layer dimensions
- FloatPoint3D transformOrigin = computeTransformOrigin(borderBox);
+ FloatPoint3D transformOrigin = computeTransformOrigin(IntRect(IntPoint(), layerBounds.size()));
// Compute the anchor point, which is in the center of the renderer box unless transform-origin is set.
FloatPoint3D anchor(
relativeCompositingBounds.width() ? (layerBounds.x() - relativeCompositingBounds.x() + transformOrigin.x()) / relativeCompositingBounds.width() : 0.5f,
@@ -2029,9 +2032,11 @@ void CompositedLayerMapping::notifyAnimationStarted(const GraphicsLayer*, double
renderer()->node()->document().cssPendingAnimations().notifyCompositorAnimationStarted(monotonicTime);
}
-LayoutRect CompositedLayerMapping::compositedBounds() const
+IntRect CompositedLayerMapping::pixelSnappedCompositedBounds() const
{
- return m_compositedBounds;
+ LayoutRect bounds = m_compositedBounds;
+ bounds.move(m_subpixelAccumulation);
+ return pixelSnappedIntRect(bounds);
}
void CompositedLayerMapping::setCompositedBounds(const LayoutRect& bounds)
« no previous file with comments | « Source/core/rendering/compositing/CompositedLayerMapping.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698