getBoundingClientRect returns the wrong result for an SVG <tspan>
Categories
(Core :: SVG, defect, P3)
Tracking
()
People
(Reporter: birtles, Assigned: violet.bugreport)
References
Details
Attachments
(7 files)
See attached test case which draws a red box over the area returned by getBoundingClientRect() when called in the <tspan> corresponding to DEF in that text run. This is similar to bug 1052356, but not the same, because in this test case I see incorrect results for a grandchild (the <tspan>), but more-or-less correct results for a child (the <text>) of the root <svg>.
Reporter | ||
Comment 1•6 years ago
|
||
Also, the test case uses Element.getBoundingClientRect() but I see the same result for Range.getBoundingClientRect().
Comment 2•6 years ago
|
||
Seems about right for me on Firefox 57 on a Mac.
Reporter | ||
Comment 3•6 years ago
|
||
This is what I see. (Sorry about the excessively large screenshot -- still need to find image editing software for this computer.)
Comment 4•6 years ago
|
||
What version of Firefox and what Operating System are you on here? Is this a regression at all?
Reporter | ||
Comment 5•6 years ago
|
||
Nightly Firefox / Ubuntu 16.04. No idea if it's a regression -- I don't have any other versions of Firefox on this computer.
Updated•6 years ago
|
Assignee | ||
Comment 6•5 years ago
|
||
I couldn't reproduce the bug on Ubuntu with latest Firefox, thus I mark it as WFM. Feel free to modify if anyone has more precise info.
Assignee | ||
Updated•5 years ago
|
Reporter | ||
Comment 7•5 years ago
|
||
Still reproduces for me on Nightly on Linux.
Reporter | ||
Comment 8•5 years ago
|
||
Assignee | ||
Comment 9•5 years ago
|
||
That's strange, my test was also on Ubuntu (Ubuntu 18.04) but it's fine. Is it a Ubuntu version problem or some particular setting on your machine?
Assignee | ||
Comment 10•5 years ago
|
||
Reporter | ||
Comment 11•5 years ago
|
||
I'm also on Ubuntu 18.04.2 LTS but the fonts we're getting are clearly different. I'm getting DejaVu Sans but you're getting some sort of serif font. I don't suppose you have any non-standard font settings? I checked mine but couldn't find anything obvious and running on a clean profile I still get DejaVu Sans.
Assignee | ||
Comment 12•5 years ago
|
||
I don't suppose you have any non-standard font settings?
I don't have non-standard settings. But I don't think that's relevant, since I still can't reproduce even if I add font-family: DejaVu Sans;
on a new profile with nightly.
Assignee | ||
Comment 13•5 years ago
|
||
Assignee | ||
Comment 14•5 years ago
|
||
Is it possible that your system font was corrupted somehow? Probably we can ask qa to test whether it works on their Ubuntu machine.
Reporter | ||
Comment 15•5 years ago
|
||
I can reproduce on Windows too using Meiryo.
Reporter | ||
Comment 16•5 years ago
|
||
Judging by the offset and dimensions of the misaligned rects, I wonder if it's a simple scaling difference due to display density. Both the Linux and Windows machines I am testing on have high dpi screens.
Assignee | ||
Updated•5 years ago
|
Assignee | ||
Updated•5 years ago
|
Assignee | ||
Comment 17•5 years ago
|
||
We need device pixel, but TransformFramePointToTextChild returns in css pixel,
thus a scaling is necessary.
Comment 18•5 years ago
|
||
Pushed by violet.bugreport@gmail.com: https://hg.mozilla.org/integration/autoland/rev/5c98e7a25bc0 Should convert rect from TransformFramePointToTextChild to device pixel r=longsonr
Comment 19•5 years ago
|
||
bugherder |
Comment 20•5 years ago
|
||
I just noticed you used the .1f multiplication trick here too. Could you replace that with float() instead please. r=me on that.
Assignee | ||
Comment 21•5 years ago
|
||
(In reply to Robert Longson [:longsonr] from comment #20)
I just noticed you used the .1f multiplication trick here too. Could you replace that with float() instead please. r=me on that.
Ok. Filed a new bug since I've also used that in other places (I personally found it more readable, but it's just some stylistic stuff ...)
Reporter | ||
Comment 22•5 years ago
|
||
Thanks for fixing this. Confirmed that it works for me now!
Updated•5 years ago
|
Updated•5 years ago
|
Updated•5 years ago
|
Comment 23•5 years ago
|
||
The TestCase works for me, I verified using Firefox 68.0b7 on Win 10 x64, macOS 10.13.6 and Ubuntu 18.04 x64.
Description
•