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

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

Issue 1902073002: Hoist "layout size changed" check out of SVGLayoutSupport::layoutChildren (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@svg-container-layout-cleanup-2
Patch Set: Created 4 years, 8 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/Source/core/layout/svg/SVGLayoutSupport.h ('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/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 b223120dafd0ce1e9b5b7fd50a45e5bacee4c5b6..aee79b58225a7beefe0e802dff0376012e80571c 100644
--- a/third_party/WebKit/Source/core/layout/svg/SVGLayoutSupport.cpp
+++ b/third_party/WebKit/Source/core/layout/svg/SVGLayoutSupport.cpp
@@ -247,17 +247,16 @@ const LayoutSVGRoot* SVGLayoutSupport::findTreeRootObject(const LayoutObject* st
return toLayoutSVGRoot(start);
}
-inline bool SVGLayoutSupport::layoutSizeOfNearestViewportChanged(const LayoutObject* start)
+bool SVGLayoutSupport::layoutSizeOfNearestViewportChanged(const LayoutObject* start)
{
- while (start && !start->isSVGRoot() && !start->isSVGViewportContainer())
- start = start->parent();
-
- ASSERT(start);
- ASSERT(start->isSVGRoot() || start->isSVGViewportContainer());
- if (start->isSVGViewportContainer())
- return toLayoutSVGViewportContainer(start)->isLayoutSizeChanged();
-
- return toLayoutSVGRoot(start)->isLayoutSizeChanged();
+ for (; start; start = start->parent()) {
+ if (start->isSVGRoot())
+ return toLayoutSVGRoot(start)->isLayoutSizeChanged();
+ if (start->isSVGViewportContainer())
+ return toLayoutSVGViewportContainer(start)->isLayoutSizeChanged();
+ }
+ ASSERT_NOT_REACHED();
+ return false;
}
bool SVGLayoutSupport::transformToRootChanged(const LayoutObject* ancestor)
@@ -272,13 +271,8 @@ bool SVGLayoutSupport::transformToRootChanged(const LayoutObject* ancestor)
return false;
}
-void SVGLayoutSupport::layoutChildren(LayoutObject* start, bool forceLayout, bool transformChanged)
+void SVGLayoutSupport::layoutChildren(LayoutObject* start, bool forceLayout, bool transformChanged, bool layoutSizeChanged)
{
- // When hasRelativeLengths() is false, no descendants have relative lengths
- // (hence no one is interested in viewport size changes).
- bool layoutSizeChanged = toSVGElement(start->node())->hasRelativeLengths()
- && layoutSizeOfNearestViewportChanged(start);
-
for (LayoutObject* child = start->slowFirstChild(); child; child = child->nextSibling()) {
bool forceChildLayout = forceLayout;
« no previous file with comments | « third_party/WebKit/Source/core/layout/svg/SVGLayoutSupport.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698