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

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

Issue 1897263002: Hoist transformToRootChanged() out of SVGLayoutSupport::layoutChildren (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@svg-container-layout-cleanup-1
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
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 a7bdf9680f7f2dac68b94e3285a4ab87e027df77..b223120dafd0ce1e9b5b7fd50a45e5bacee4c5b6 100644
--- a/third_party/WebKit/Source/core/layout/svg/SVGLayoutSupport.cpp
+++ b/third_party/WebKit/Source/core/layout/svg/SVGLayoutSupport.cpp
@@ -34,6 +34,7 @@
#include "core/layout/svg/LayoutSVGRoot.h"
#include "core/layout/svg/LayoutSVGShape.h"
#include "core/layout/svg/LayoutSVGText.h"
+#include "core/layout/svg/LayoutSVGTransformableContainer.h"
#include "core/layout/svg/LayoutSVGViewportContainer.h"
#include "core/layout/svg/SVGResources.h"
#include "core/layout/svg/SVGResourcesCache.h"
@@ -259,35 +260,33 @@ inline bool SVGLayoutSupport::layoutSizeOfNearestViewportChanged(const LayoutObj
return toLayoutSVGRoot(start)->isLayoutSizeChanged();
}
-bool SVGLayoutSupport::transformToRootChanged(LayoutObject* ancestor)
+bool SVGLayoutSupport::transformToRootChanged(const LayoutObject* ancestor)
{
while (ancestor && !ancestor->isSVGRoot()) {
if (ancestor->isSVGTransformableContainer())
- return toLayoutSVGContainer(ancestor)->didTransformToRootUpdate();
+ return toLayoutSVGTransformableContainer(ancestor)->didTransformToRootUpdate();
if (ancestor->isSVGViewportContainer())
return toLayoutSVGViewportContainer(ancestor)->didTransformToRootUpdate();
ancestor = ancestor->parent();
}
-
return false;
}
-void SVGLayoutSupport::layoutChildren(LayoutObject* start, bool selfNeedsLayout)
+void SVGLayoutSupport::layoutChildren(LayoutObject* start, bool forceLayout, bool transformChanged)
{
// 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);
- bool transformChanged = transformToRootChanged(start);
for (LayoutObject* child = start->slowFirstChild(); child; child = child->nextSibling()) {
- bool forceLayout = selfNeedsLayout;
+ bool forceChildLayout = forceLayout;
if (transformChanged) {
// If the transform changed we need to update the text metrics (note: this also happens for layoutSizeChanged=true).
if (child->isSVGText())
toLayoutSVGText(child)->setNeedsTextMetricsUpdate();
- forceLayout = true;
+ forceChildLayout = true;
}
if (layoutSizeChanged) {
@@ -303,7 +302,7 @@ void SVGLayoutSupport::layoutChildren(LayoutObject* start, bool selfNeedsLayout)
toLayoutSVGText(child)->setNeedsPositioningValuesUpdate();
}
- forceLayout = true;
+ forceChildLayout = true;
}
}
}
@@ -321,7 +320,7 @@ void SVGLayoutSupport::layoutChildren(LayoutObject* start, bool selfNeedsLayout)
child->layoutIfNeeded();
} else {
SubtreeLayoutScope layoutScope(*child);
- if (forceLayout)
+ if (forceChildLayout)
layoutScope.setNeedsLayout(child, LayoutInvalidationReason::SvgChanged);
// Lay out any referenced resources before the child.

Powered by Google App Engine
This is Rietveld 408576698