RESOLVED FIXED 118140
SVG relayout problem when displayed with different image box heights
https://bugs.webkit.org/show_bug.cgi?id=118140
Summary SVG relayout problem when displayed with different image box heights
Morten Stenshorne
Reported 2013-06-27 09:37:45 PDT
SVGs are not relaid out deeply enough when there are two images with the same SVG URL, and the only difference between the two images is the height.
Attachments
SVG helper file for TC (275 bytes, image/svg+xml)
2013-06-27 09:38 PDT, Morten Stenshorne
no flags
Test case (460 bytes, text/html)
2013-06-27 09:39 PDT, Morten Stenshorne
no flags
Patch (3.85 KB, patch)
2013-06-28 02:38 PDT, Morten Stenshorne
no flags
Morten Stenshorne
Comment 1 2013-06-27 09:38:38 PDT
Created attachment 205612 [details] SVG helper file for TC
Morten Stenshorne
Comment 2 2013-06-27 09:39:30 PDT
Created attachment 205613 [details] Test case
Morten Stenshorne
Comment 3 2013-06-28 02:38:39 PDT
Dirk Schulze
Comment 4 2013-06-28 08:01:36 PDT
Comment on attachment 205682 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=205682&action=review > LayoutTests/svg/as-image/same-source-different-height-expected.html:9 > + <img src="resources/circle.svg" type="image/svg+xml" style="width:100px; height:300px;"> > + <img src="resources/circle.svg?different-url" type="image/svg+xml" style="width:100px; height:100px;"> This looks like a problem with URL parsing. To force a relayout for each RenderView seems like shooting with guns. On the other hand it looks like we just rely on the image url instead of the image dimension. What happens exactly? Is the layout wrong, or does it look pixelated?
Morten Stenshorne
Comment 5 2013-06-28 09:51:52 PDT
Can you reproduce the problem if you open the testcase? I've only tested in Linux, but I've tested both the GTK port, Chromium content shell and official Chrome. All fail. If there are several IMG elements with the same SVG SRC attribute, there will be one shared SVGImage, and therefore a shared Page and FrameView, which has to be laid out over again every time we display the image with a different size. The problem is that if it is only the height that's different, the SVG root isn't re-aligned within the viewport. This only happens if the URLs are identical. Hence the "?blah" thing in the ref. Width-only changes are handled properly, though, but one can say that's expected from a layout engine. Traditionally, width changes requires children to be laid out again, while height changes "normally" (plain static block layout with no percentage heights, that is) don't affect the layout of chilren. My patch only forces re-layout of the SVG root element itself, not the children, and it only does so if the viewport size has changed.
Philip Rogers
Comment 6 2013-06-28 09:57:28 PDT
Comment on attachment 205682 [details] Patch r=me; nice find.
WebKit Commit Bot
Comment 7 2013-06-28 11:01:31 PDT
Comment on attachment 205682 [details] Patch Clearing flags on attachment: 205682 Committed r152178: <http://trac.webkit.org/changeset/152178>
WebKit Commit Bot
Comment 8 2013-06-28 11:01:34 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.