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

Unified Diff: third_party/WebKit/Source/core/paint/SVGRootPainter.cpp

Issue 1847983002: [SVG] Compensate for container size snapping (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: more expectations Created 4 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 | « third_party/WebKit/LayoutTests/svg/custom/zoomed-background-alignment-expected.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/paint/SVGRootPainter.cpp
diff --git a/third_party/WebKit/Source/core/paint/SVGRootPainter.cpp b/third_party/WebKit/Source/core/paint/SVGRootPainter.cpp
index 55218db6f5ff8b4ea98f60415498422491891d80..38ebea3c703a63393ffaf90d58d4be354c0624c4 100644
--- a/third_party/WebKit/Source/core/paint/SVGRootPainter.cpp
+++ b/third_party/WebKit/Source/core/paint/SVGRootPainter.cpp
@@ -22,8 +22,11 @@ namespace blink {
void SVGRootPainter::paint(const PaintInfo& paintInfo, const LayoutPoint& paintOffset)
{
+ // Pixel-snap to match BoxPainter's alignment.
+ const IntRect adjustedRect = pixelSnappedIntRect(paintOffset, m_layoutSVGRoot.size());
+
// An empty viewport disables rendering.
- if (m_layoutSVGRoot.pixelSnappedBorderBoxRect().isEmpty())
+ if (adjustedRect.isEmpty())
return;
// SVG outlines are painted during PaintPhaseForeground.
@@ -70,8 +73,14 @@ void SVGRootPainter::paint(const PaintInfo& paintInfo, const LayoutPoint& paintO
// Convert from container offsets (html layoutObjects) to a relative transform (svg layoutObjects).
// Transform from our paint container's coordinate system to our local coords.
- IntPoint adjustedPaintOffset = roundedIntPoint(paintOffset);
- AffineTransform paintOffsetToBorderBox = AffineTransform::translation(adjustedPaintOffset.x(), adjustedPaintOffset.y()) * m_layoutSVGRoot.localToBorderBoxTransform();
+ AffineTransform paintOffsetToBorderBox =
+ AffineTransform::translation(adjustedRect.x(), adjustedRect.y());
+ // Compensate for size snapping.
+ paintOffsetToBorderBox.scale(
+ adjustedRect.width() / m_layoutSVGRoot.size().width().toFloat(),
+ adjustedRect.height() / m_layoutSVGRoot.size().height().toFloat());
+ paintOffsetToBorderBox.multiply(m_layoutSVGRoot.localToBorderBoxTransform());
+
paintInfoBeforeFiltering.updateCullRect(paintOffsetToBorderBox);
TransformRecorder transformRecorder(paintInfoBeforeFiltering.context, m_layoutSVGRoot, paintOffsetToBorderBox);
« no previous file with comments | « third_party/WebKit/LayoutTests/svg/custom/zoomed-background-alignment-expected.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698