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

Unified Diff: third_party/WebKit/Source/core/layout/svg/LayoutSVGRoot.cpp

Issue 2511353002: Repaint SVG subtree on viewport changes (resize) (Closed)
Patch Set: Created 4 years, 1 month 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/paint/invalidation/svg/resize-svg-invalidate-children-2-expected.txt ('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/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);
« no previous file with comments | « third_party/WebKit/LayoutTests/paint/invalidation/svg/resize-svg-invalidate-children-2-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698