MouseEvent.offsetX/Y for SVG <tspan> uses wrong origin
Categories
(Core :: SVG, defect)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox156 | --- | fixed |
People
(Reporter: seb.p.mueller, Assigned: longsonr)
Details
Attachments
(1 file, 1 external file)
|
2.45 KB,
text/html
|
Details |
Steps to reproduce:
Open the attached tspan-offset.html.
Move the pointer over RECT, TEXT, and TSPAN.
Compare event.offsetX/Y with coordinates calculated from event.clientX/Y and the outer SVG's getBoundingClientRect().
Actual results:
For <tspan>, Firefox uses a different/local origin, while <text> and ordinary SVG elements remain outer-SVG-relative.
Expected results:
offsetX/Y use the same outer-SVG origin for <tspan> as for <text> and other SVG elements. This is inline with what happens with all other SVG elements in FF and how other UAs implement offsetX/Y
| Reporter | ||
Comment 1•2 months ago
|
||
I did some more research (with the help of an agent) and found this in the FF sources:
Event::GetPrimaryFrameOfEventTarget() applies the root-SVG compatibility behavior when the target frame has NS_FRAME_SVG_LAYOUT.
However, Gecko constructs <tspan> using NS_NewInlineFrame. SVG text descendants are tracked separately using NS_FRAME_IS_SVG_TEXT / IsInSVGTextSubtree().
This looks like <tspan> may simply fall through the SVG compatibility special case.
This is the related material that was found during the research - most importantly there is an existing WebCompat report that is still open, that is basically the same report (last):
Relevant specs:
CSSOM View: https://drafts.csswg.org/cssom-view/#dom-mouseevent-offsetx
CSSWG SVG offset discussion: https://github.com/w3c/csswg-drafts/issues/1508
Firefox bug 1684973: https://bugzilla.mozilla.org/show_bug.cgi?id=1684973 (where work was done to harmonize this exact behavior on other SVG elements)
Existing WPT: css/cssom-view/mouseEvent-offsetXY-svg.html (tests rect only, but misses tspan)
Existing WebCompat report showing the same misbehavior for Firefox 124.0.2: https://webcompat.com/issues/135876
Comment 2•2 months ago
|
||
The Bugbug bot thinks this bug should belong to the 'Core::SVG' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.
| Assignee | ||
Comment 3•2 months ago
|
||
Updated•2 months ago
|
| Assignee | ||
Comment 5•2 months ago
|
||
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/62179 for changes under testing/web-platform/tests
Comment 8•2 months ago
|
||
| bugherder | ||
Upstream PR merged by moz-wptsync-bot
Upstream PR was closed without merging
Updated•2 months ago
|
Description
•