Index: third_party/WebKit/Source/core/layout/svg/LayoutSVGRoot.cpp |
diff --git a/third_party/WebKit/Source/core/layout/svg/LayoutSVGRoot.cpp b/third_party/WebKit/Source/core/layout/svg/LayoutSVGRoot.cpp |
index 0334e0451cb9a8dda061ed26e77323ed82dd79f3..1d6b33d7073a642a4917d97739335c65e6776b19 100644 |
--- a/third_party/WebKit/Source/core/layout/svg/LayoutSVGRoot.cpp |
+++ b/third_party/WebKit/Source/core/layout/svg/LayoutSVGRoot.cpp |
@@ -153,17 +153,22 @@ void LayoutSVGRoot::layout() { |
SVGLayoutSupport::layoutResourcesIfNeeded(this); |
+ // selfNeedsLayout() will cover changes to one (or more) of viewBox, |
+ // current{Scale,Translate} and decorations. |
+ const bool viewportMayHaveChanged = selfNeedsLayout() || oldSize != size(); |
+ |
+ // The scale of one or more of the SVG elements may have changed, or new |
+ // content may have been exposed, so mark the entire subtree as needing paint |
+ // invalidation checking. (It is only somewhat by coincidence that this |
+ // condition happens to be the same as the one for viewport changes.) |
+ if (viewportMayHaveChanged) |
+ setMayNeedPaintInvalidationSubtree(); |
+ |
SVGSVGElement* svg = toSVGSVGElement(node()); |
ASSERT(svg); |
// When hasRelativeLengths() is false, no descendants have relative lengths |
// (hence no one is interested in viewport size changes). |
- m_isLayoutSizeChanged = |
- svg->hasRelativeLengths() && (selfNeedsLayout() || oldSize != size()); |
- |
- // The scale of one or more of the SVG elements may have changed, so mark |
- // the entire subtree as needing paint invalidation checking. |
- if (m_isLayoutSizeChanged) |
- setMayNeedPaintInvalidationSubtree(); |
+ m_isLayoutSizeChanged = viewportMayHaveChanged && svg->hasRelativeLengths(); |
SVGLayoutSupport::layoutChildren( |
firstChild(), false, m_didScreenScaleFactorChange, m_isLayoutSizeChanged); |