RESOLVED FIXED Bug 81513
Relative-height block SVG root not layed out on container height change
https://bugs.webkit.org/show_bug.cgi?id=81513
Summary Relative-height block SVG root not layed out on container height change
Florin Malita
Reported 2012-03-19 08:51:00 PDT
https://bugs.webkit.org/show_bug.cgi?id=79490 missed a couple of explicit style()->logical{Min,Max,}Height tests in RenderView::layout() & RenderBlock::layoutBlockChildren(). These prevent relative-height block SVG elements from being resized on container height changes. Clicking the green rect in the attached test resizes the containing <div> vertically, but the SVG root element is not re-adjusted.
Attachments
The SVG element doesn't get adjusted on container height change. (608 bytes, text/html)
2012-03-19 08:52 PDT, Florin Malita
no flags
Patch (10.01 KB, patch)
2012-03-19 09:12 PDT, Florin Malita
no flags
Patch (9.19 KB, patch)
2012-03-19 13:44 PDT, Florin Malita
no flags
Florin Malita
Comment 1 2012-03-19 08:52:52 PDT
Created attachment 132589 [details] The SVG element doesn't get adjusted on container height change.
Florin Malita
Comment 2 2012-03-19 09:12:23 PDT
Nikolas Zimmermann
Comment 3 2012-03-19 09:31:25 PDT
Comment on attachment 132593 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=132593&action=review r=me, with some small nitpicks: > Source/WebCore/rendering/RenderBox.cpp:4032 > + RenderStyle* s = style(); You don't need to introduce style() local vars, its inlined. > Source/WebCore/rendering/RenderBox.cpp:4040 > + RenderStyle* s = style(); Ditto. > Source/WebCore/rendering/RenderView.cpp:120 > + // FIXME: can RenderView have non-RenderBox children to justify keeping the explicit style checks below? Can you try this, running regression tests with this fixed, and see if something changes? Ideally before you land this, even if I set r+ :-) > Source/WebCore/rendering/svg/RenderSVGRoot.cpp:428 > + return svg->intrinsicWidth(SVGSVGElement::IgnoreCSSProperties).isPercent() || RenderSVGRoot::hasRelativeLogicalHeight(); I'd leave this as-is to save a virtual function call.
Florin Malita
Comment 4 2012-03-19 13:44:14 PDT
Created attachment 132655 [details] Patch updated patch
Florin Malita
Comment 5 2012-03-19 14:02:26 PDT
(In reply to comment #3) > > Source/WebCore/rendering/RenderBox.cpp:4032 > > + RenderStyle* s = style(); > > You don't need to introduce style() local vars, its inlined. Done. > > Source/WebCore/rendering/RenderBox.cpp:4040 > > + RenderStyle* s = style(); > > Ditto. Done. > > Source/WebCore/rendering/RenderView.cpp:120 > > + // FIXME: can RenderView have non-RenderBox children to justify keeping the explicit style checks below? > > Can you try this, running regression tests with this fixed, and see if something changes? Ideally before you land this, even if I set r+ :-) Tried it (assuming child->isBox() == true), and it doesn't seem to introduce any regressions. But then I found this snippet in FrameView::embeddedContentBox() which seems to indicate that it's still possible for RenderView to have non-RenderBox children: RenderView* root = rootRenderer(this); if (!root) return 0; RenderObject* rootChild = root->firstChild(); if (!rootChild || !rootChild->isBox()) return 0; So the isBox() check is probably warranted and I will leave it in unless you think otherwise. > > Source/WebCore/rendering/svg/RenderSVGRoot.cpp:428 > > + return svg->intrinsicWidth(SVGSVGElement::IgnoreCSSProperties).isPercent() || RenderSVGRoot::hasRelativeLogicalHeight(); > > I'd leave this as-is to save a virtual function call. Hmm, I don't think that it would trigger a virtual dispatch because it's class-qualified. Nevertheless, it's probably not be worth the extra call so I've reverted it.
Dirk Schulze
Comment 6 2012-03-19 15:33:06 PDT
Comment on attachment 132655 [details] Patch Looks good for me. Since Niko already gave r+ and the concerns seems to be addressed (correct me if I am wrong), r=me from me as well.
WebKit Review Bot
Comment 7 2012-03-19 17:37:47 PDT
Comment on attachment 132655 [details] Patch Clearing flags on attachment: 132655 Committed r111279: <http://trac.webkit.org/changeset/111279>
WebKit Review Bot
Comment 8 2012-03-19 17:37:51 PDT
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.