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

Unified Diff: third_party/WebKit/Source/core/layout/LayoutView.cpp

Issue 2835153002: Fix percent height calc for svg docs. (Closed)
Patch Set: test Created 3 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/LayoutView.cpp
diff --git a/third_party/WebKit/Source/core/layout/LayoutView.cpp b/third_party/WebKit/Source/core/layout/LayoutView.cpp
index 343bec145d51e2d224f9cf1f4b36e1d2322d635b..030045dc0256ace612c9c0346c96c6d19eac7968 100644
--- a/third_party/WebKit/Source/core/layout/LayoutView.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutView.cpp
@@ -280,6 +280,33 @@ void LayoutView::UpdateLayout() {
!ShouldUsePrintingLayout() &&
(!frame_view_ || LogicalWidth() != ViewLogicalWidthForBoxSizing() ||
LogicalHeight() != ViewLogicalHeightForBoxSizing());
+
+ // For a pure SVG doc, the svg root will have percentage height, which will be
pdr. 2017/04/26 04:56:47 Is this the tree we're considering? frameview -> l
szager1 2017/04/26 12:11:35 Not exactly. First layout is typically not a prob
+ // resolved against the LayoutView's logical height, which comes from the
+ // FrameView's visible content height. If the FrameView was resized during
+ // the previous layout, then the LayoutView's logical height would have
+ // changed *after* the svg root finished layout, so the logical height of
+ // the svg root would have been computed based on a stale container height.
+ // Check here whether the svg root's logical height matches what we would
+ // expect based on the LayoutView's now-up-to-date logical height.
+ if (!relayout_children && GetDocument().IsSVGDocument()) {
pdr. 2017/04/26 04:56:47 Can you use GetDocument().AccessSVGExtensions().ro
szager1 2017/04/26 12:11:35 Yep, this works; I updated the patch.
+ for (LayoutObject* child = FirstChild(); child;
+ child = child->NextSibling()) {
+ if (!child->IsSVGRoot())
+ continue;
+ const Length& child_height = child->Style()->LogicalHeight();
+ if (!child_height.IsPercentOrCalc())
+ continue;
+ if (ToLayoutBox(child)->LogicalHeight() !=
+ ValueForLength(child_height,
+ AvailableLogicalHeightUsing(
+ child_height, kExcludeMarginBorderPadding))) {
+ relayout_children = true;
+ layout_scope.SetChildNeedsLayout(child);
+ }
+ }
+ }
+
if (relayout_children) {
layout_scope.SetChildNeedsLayout(this);
for (LayoutObject* child = FirstChild(); child;

Powered by Google App Engine
This is Rietveld 408576698