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

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

Issue 1749423005: Don't use a SubtreeLayoutScope object for SVG resource layout (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Simplify the test Created 4 years, 10 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
Index: third_party/WebKit/Source/core/layout/svg/SVGLayoutSupport.cpp
diff --git a/third_party/WebKit/Source/core/layout/svg/SVGLayoutSupport.cpp b/third_party/WebKit/Source/core/layout/svg/SVGLayoutSupport.cpp
index ae891e952ff47c2cedc1e46039b703a561cd24e5..30448f29d8aaaf4532ccd41fe0783eceb8fd545a 100644
--- a/third_party/WebKit/Source/core/layout/svg/SVGLayoutSupport.cpp
+++ b/third_party/WebKit/Source/core/layout/svg/SVGLayoutSupport.cpp
@@ -295,17 +295,26 @@ void SVGLayoutSupport::layoutChildren(LayoutObject* start, bool selfNeedsLayout)
}
}
- SubtreeLayoutScope layoutScope(*child);
// Resource containers are nasty: they can invalidate clients outside the current SubtreeLayoutScope.
// Since they only care about viewport size changes (to resolve their relative lengths), we trigger
// their invalidation directly from SVGSVGElement::svgAttributeChange() or at a higher
- // SubtreeLayoutScope (in LayoutView::layout()).
- if (forceLayout && !child->isSVGResourceContainer())
- layoutScope.setNeedsLayout(child, LayoutInvalidationReason::SvgChanged);
-
- // Lay out any referenced resources before the child.
- layoutResourcesIfNeeded(child);
- child->layoutIfNeeded();
+ // SubtreeLayoutScope (in LayoutView::layout()). We do not create a SubtreeLayoutScope for
+ // resources because their ability to reference each other leads to circular layout. We protect
+ // against that within the layout code for resources, but it causes assertions if we use a
+ // SubTreeLayoutScope for them.
+ if (child->isSVGResourceContainer()) {
+ // Lay out any referenced resources before the child.
+ layoutResourcesIfNeeded(child);
+ child->layoutIfNeeded();
+ } else {
+ SubtreeLayoutScope layoutScope(*child);
+ if (forceLayout)
+ layoutScope.setNeedsLayout(child, LayoutInvalidationReason::SvgChanged);
+
+ // Lay out any referenced resources before the child.
+ layoutResourcesIfNeeded(child);
+ child->layoutIfNeeded();
+ }
}
}

Powered by Google App Engine
This is Rietveld 408576698