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

Side by Side 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, 7 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc.
4 * All rights reserved. 4 * All rights reserved.
5 * 5 *
6 * This library is free software; you can redistribute it and/or 6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public 7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either 8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version. 9 * version 2 of the License, or (at your option) any later version.
10 * 10 *
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 } 273 }
274 274
275 SubtreeLayoutScope layout_scope(*this); 275 SubtreeLayoutScope layout_scope(*this);
276 276
277 // Use calcWidth/Height to get the new width/height, since this will take the 277 // Use calcWidth/Height to get the new width/height, since this will take the
278 // full page zoom factor into account. 278 // full page zoom factor into account.
279 bool relayout_children = 279 bool relayout_children =
280 !ShouldUsePrintingLayout() && 280 !ShouldUsePrintingLayout() &&
281 (!frame_view_ || LogicalWidth() != ViewLogicalWidthForBoxSizing() || 281 (!frame_view_ || LogicalWidth() != ViewLogicalWidthForBoxSizing() ||
282 LogicalHeight() != ViewLogicalHeightForBoxSizing()); 282 LogicalHeight() != ViewLogicalHeightForBoxSizing());
283
284 // 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
285 // resolved against the LayoutView's logical height, which comes from the
286 // FrameView's visible content height. If the FrameView was resized during
287 // the previous layout, then the LayoutView's logical height would have
288 // changed *after* the svg root finished layout, so the logical height of
289 // the svg root would have been computed based on a stale container height.
290 // Check here whether the svg root's logical height matches what we would
291 // expect based on the LayoutView's now-up-to-date logical height.
292 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.
293 for (LayoutObject* child = FirstChild(); child;
294 child = child->NextSibling()) {
295 if (!child->IsSVGRoot())
296 continue;
297 const Length& child_height = child->Style()->LogicalHeight();
298 if (!child_height.IsPercentOrCalc())
299 continue;
300 if (ToLayoutBox(child)->LogicalHeight() !=
301 ValueForLength(child_height,
302 AvailableLogicalHeightUsing(
303 child_height, kExcludeMarginBorderPadding))) {
304 relayout_children = true;
305 layout_scope.SetChildNeedsLayout(child);
306 }
307 }
308 }
309
283 if (relayout_children) { 310 if (relayout_children) {
284 layout_scope.SetChildNeedsLayout(this); 311 layout_scope.SetChildNeedsLayout(this);
285 for (LayoutObject* child = FirstChild(); child; 312 for (LayoutObject* child = FirstChild(); child;
286 child = child->NextSibling()) { 313 child = child->NextSibling()) {
287 if (child->IsSVGRoot()) 314 if (child->IsSVGRoot())
288 continue; 315 continue;
289 316
290 if ((child->IsBox() && ToLayoutBox(child)->HasRelativeLogicalHeight()) || 317 if ((child->IsBox() && ToLayoutBox(child)->HasRelativeLogicalHeight()) ||
291 child->Style()->LogicalHeight().IsPercentOrCalc() || 318 child->Style()->LogicalHeight().IsPercentOrCalc() ||
292 child->Style()->LogicalMinHeight().IsPercentOrCalc() || 319 child->Style()->LogicalMinHeight().IsPercentOrCalc() ||
(...skipping 521 matching lines...) Expand 10 before | Expand all | Expand 10 after
814 // Frame scroll corner is painted using LayoutView as the display item client. 841 // Frame scroll corner is painted using LayoutView as the display item client.
815 if (!RuntimeEnabledFeatures::rootLayerScrollingEnabled() && 842 if (!RuntimeEnabledFeatures::rootLayerScrollingEnabled() &&
816 (GetFrameView()->HorizontalScrollbar() || 843 (GetFrameView()->HorizontalScrollbar() ||
817 GetFrameView()->VerticalScrollbar())) 844 GetFrameView()->VerticalScrollbar()))
818 return false; 845 return false;
819 846
820 return LayoutBlockFlow::PaintedOutputOfObjectHasNoEffectRegardlessOfSize(); 847 return LayoutBlockFlow::PaintedOutputOfObjectHasNoEffectRegardlessOfSize();
821 } 848 }
822 849
823 } // namespace blink 850 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698