Closed Bug 331421 Opened 19 years ago Closed 15 years ago

mouse event coordinates are not transformed for HTML inside a svg:foreignObject

Categories

(Core :: SVG, defect)

x86
Windows XP
defect
Not set
normal

Tracking

()

RESOLVED WORKSFORME

People

(Reporter: ted, Unassigned)

References

Details

Attachments

(1 file, 1 obsolete file)

In mouse event handlers on HTML elements inside a svg:foreignObject, the event coordinates (e.g. .clientX) are not transformed. This works poorly for things like Google Maps.
Attached file testcase (obsolete) —
Click to change the position of the little black div. The HTML is rotated by 90 degrees. Remember to invalidate the area to see the changes.
Blocks: 342107
Attached file updated testcase
foreignObject requires height parameters now apparently.
Attachment #215972 - Attachment is obsolete: true
if you run the test case via chrome it seems to work
I can see the problem you have. You're embedding third party content into a page which you're rotating (or otherwise transforming) and you still require any mouse event handling code in the third party content to work. The problem is that fixing this would require us to look up the parent chain of the mouse event target for each mouse event - including across document boundaries(!) - to figure out the global transform on the content. I guess the event coordinates would also need to change as it propagated along the target chain. This would introduce a fair bit of overhead for mouse events, and unfortunately I think changing the coordinates in either of the above ways would conflict with existing specifications and content.
This can and should be fixed. There is nothing unreasonable about it. The .client coordinates for events fired inside the IFRAME should be relative to the top-left of the IFRAME, no spec issues there.
Yeah, on reflection you're right. However, there's still the performance issue. nsDOMUIEvent::GetClientPoint seems nasty already, and I don't immediately see a good way to fit in the transforms that intermediary SVG may add.
I don't think performance is an issue. Events aren't fired at a high rate, nor do scripts need to get their client coordinates many times. We probably should add a virtual TransformPoint method to nsIFrame.
The testcase seems to work now.
Assignee: general → nobody
QA Contact: ian → general
Dunno when this got fixed, but WFM.
Status: NEW → RESOLVED
Closed: 15 years ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: