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 14781968a9586066b8e4fc87adf5483ef4b190d7..b4a2d1f996b8e64e4f8440f54ae7e05dea6c6950 100644 |
--- a/third_party/WebKit/Source/core/paint/SVGRootPainter.cpp |
+++ b/third_party/WebKit/Source/core/paint/SVGRootPainter.cpp |
@@ -28,9 +28,12 @@ AffineTransform SVGRootPainter::transformToPixelSnappedBorderBox(const LayoutPoi |
const IntRect snappedSize = pixelSnappedSize(paintOffset); |
AffineTransform paintOffsetToBorderBox = |
AffineTransform::translation(snappedSize.x(), snappedSize.y()); |
- paintOffsetToBorderBox.scale( |
- snappedSize.width() / m_layoutSVGRoot.size().width().toFloat(), |
- snappedSize.height() / m_layoutSVGRoot.size().height().toFloat()); |
+ LayoutSize size = m_layoutSVGRoot.size(); |
+ if (!size.isEmpty()) { |
+ paintOffsetToBorderBox.scale( |
+ snappedSize.width() / size.width().toFloat(), |
+ snappedSize.height() / size.height().toFloat()); |
+ } |
paintOffsetToBorderBox.multiply(m_layoutSVGRoot.localToBorderBoxTransform()); |
return paintOffsetToBorderBox; |
} |