Bug 211282 - getBBox on tspan returns bbox for the containing text element
Summary: getBBox on tspan returns bbox for the containing text element
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: SVG (show other bugs)
Version: Safari 12
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar, WPTImpact
Depends on:
Blocks:
 
Reported: 2020-05-01 04:21 PDT by fabswt
Modified: 2023-08-01 05:30 PDT (History)
6 users (show)

See Also:


Attachments
Demo of the issue, open the Console and check the dimensions output there (2.19 KB, image/svg+xml)
2020-05-01 04:21 PDT, fabswt
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description fabswt 2020-05-01 04:21:03 PDT
Created attachment 398172 [details]
Demo of the issue, open the Console and check the dimensions output there

EXPECTED BEHAVIOR:
- When using an SVG element's getBBox() method, the browser should return the correct dimensions of the bounding box for <tspan> elements.

OBSERVED BEHAVIOR:
- The browser is returning the bounding box of its parent <text> element instead. i.e. all tspans return the dimensions of their parent element in place of their own real dimensions.

OTHER BROWSERS:
- This works fine in Firefox.
- Chromium had the same bug and fixed it recently: https://bugs.chromium.org/p/chromium/issues/detail?id=349835 (OK in Chromium Version 84.0.4133.0 (Developer Build) (64-bit); still not OK in Chrome Version 81.0.4044.129 (Official Build) (64-bit).)

Interestingly enough, unlike getBBox(), Safari's Inspector does return the correct dimensions (rounded), so a way to fetch the correct value might already be in the codebase.


Attaching a demo of my own; the Chromium thread has plenty of other examples if needed.
Comment 1 Radar WebKit Bug Importer 2020-05-01 10:33:08 PDT
<rdar://problem/62735569>
Comment 2 fabswt 2020-05-06 02:35:27 PDT
Anyone?

While the report is new, the bug has been around for at least 6 years and breaks basic SVG functionality.