RESOLVED FIXED 11686
WebKit draws Carto.net tabgroup example completely incorrectly (ff does fine)
https://bugs.webkit.org/show_bug.cgi?id=11686
Summary WebKit draws Carto.net tabgroup example completely incorrectly (ff does fine)
Eric Seidel (no email)
Reported 2006-11-23 04:10:27 PST
WebKit draws Carto.net tabgroup example completely incorrectly (ff does fine) http://www.carto.net/papers/svg/gui/tabgroup/index.svg It looks like there is an issue measuring the text which is causing the tabs to be so small. Then some text drawing issues, as well as some hit detection issues. The hit detection issues might be related to the measuring.
Attachments
First attempt (3.83 KB, patch)
2006-12-03 07:51 PST, Rob Buis
mitz: review-
Improved patch (3.81 KB, patch)
2006-12-03 08:28 PST, Rob Buis
no flags
Also test paths and images (6.92 KB, patch)
2006-12-03 10:17 PST, Rob Buis
no flags
Improved testcase + patch (6.30 KB, patch)
2006-12-05 01:36 PST, Rob Buis
no flags
Improved testcase (6.32 KB, patch)
2006-12-05 13:03 PST, Rob Buis
no flags
Improved patch (6.27 KB, patch)
2006-12-05 13:32 PST, Rob Buis
mitz: review+
Rob Buis
Comment 1 2006-12-02 08:19:29 PST
Hi Eric, (In reply to comment #0) > WebKit draws Carto.net tabgroup example completely incorrectly (ff does fine) > > http://www.carto.net/papers/svg/gui/tabgroup/index.svg > > It looks like there is an issue measuring the text which is causing the tabs to > be so small. Then some text drawing issues, as well as some hit detection > issues. The hit detection issues might be related to the measuring. I looked into it and getBBox is wrong on the text element that gets created dynamically. It is basically an empty rect (0, 0, 0, 0), causing indeed measuring problems. It seems the render object is created but not layouted. Not sure how to handle this yet... Cheers, Rob.
Eric Seidel (no email)
Comment 2 2006-12-02 10:40:02 PST
> I looked into it and getBBox is wrong on the text element that gets created > dynamically. It is > basically an empty rect (0, 0, 0, 0), causing indeed measuring problems. It > seems the render object > is created but not layouted. Not sure how to handle this yet... I expect that getBBox just needs to force a layout, similar to how offsetTop works for HTML.
Rob Buis
Comment 3 2006-12-03 07:51:36 PST
Created attachment 11719 [details] First attempt This could be a hack, but it works. Hyatt mentioned layoutIfNeeded being used a lot like this, but I couldn't really find it. Also I dislike the const_casts. I am wondering whether html text has the same problem as svg text, where the text is not layouted yet but the text dimensions are queried. Cheers, Rob.
mitz
Comment 4 2006-12-03 08:15:06 PST
Comment on attachment 11719 [details] First attempt You shouldn't try to force layout of a subtree like that, nor should the check be pushed down to the renderer. The way it's done in HTML is that the DOM method that needs layout information ensures that the document is laid out before querying the renderer. See Element::offsetTop() for example.
Rob Buis
Comment 5 2006-12-03 08:28:36 PST
Created attachment 11721 [details] Improved patch Just what I was looking for, thnx Mitz! Cheers, Rob.
Rob Buis
Comment 6 2006-12-03 10:17:34 PST
Created attachment 11722 [details] Also test paths and images Mitz was right, same problem can happen with images. This patch fixes it as well as does better testing. Cheers, Rob.
mitz
Comment 7 2006-12-03 23:04:50 PST
Comment on attachment 11722 [details] Also test paths and images I doubt that anything that doesn't apply to all SVGLocatables is correct and robust. For example, what if your element's renderer is a RenderSVGContainer? Can't it have text and image children? It could be my lack of familiarity with this code, but why would the straightforward solution of ensuring layout in SVGLocatable::getBBox not work? Minor style comments: please avoid "layouted" and use Sentence capitalization in comments.
Rob Buis
Comment 8 2006-12-05 01:36:49 PST
Created attachment 11735 [details] Improved testcase + patch As Mitz pointed out, may as well make sure there is a layout done for all svg render objects. Cheers, Rob.
Rob Buis
Comment 9 2006-12-05 13:03:28 PST
Created attachment 11744 [details] Improved testcase This patch has a fix in the comment. Furthermore it always performs the updateLayoutIgnorePendingStylesheets call, since potentially the element could have a parent that just had a display property changed from none. Cheers, Rob.
Rob Buis
Comment 10 2006-12-05 13:32:52 PST
Created attachment 11745 [details] Improved patch Moved the call back into the if since render style updating means the renderer() must be there. Apart from that some rewording of the WebCore/ChangeLog. Cheers, Rob.
mitz
Comment 11 2006-12-05 13:38:32 PST
Comment on attachment 11745 [details] Improved patch r=me if you uppercase "svg" and change "are layout" to "are laid out" in the ChangeLog. I still don't like that sentence :-)
Mark Rowe (bdash)
Comment 12 2006-12-05 17:45:08 PST
Landed by Rob in r18032.
Note You need to log in before you can comment on or make changes to this bug.