Open Bug 1167959 Opened 9 years ago Updated 2 years ago

Svg events misbehavior on small viewbox

Categories

(Core :: SVG, defect)

14 Branch
defect

Tracking

()

REOPENED
Tracking Status
firefox38 --- wontfix
firefox38.0.5 --- wontfix
firefox39 --- wontfix
firefox40 --- wontfix
firefox41 --- wontfix
firefox-esr31 --- wontfix
firefox-esr38 --- wontfix

People

(Reporter: simon, Unassigned)

References

()

Details

(Keywords: regression, reproducible, testcase)

Attachments

(4 files, 1 obsolete file)

User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Firefox/38.0 Build ID: 20150515071002 Steps to reproduce: (on firefox 38.0.0.1 // linux 4.0.4 // Xorg) -> Create a svg with a very small viewbox (~0.1) -> Add an svg-shape with event-handler attached -> fire event a few times (~5-10x) example: -> http://jsfiddle.net/uxnj7emv/3/ -> drag a few times -> drag stops working, mousedown not fired anymore Actual results: events stop firing completely Expected results: events should continue to work
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Firefox/38.0 Build ID: 20150513174244 Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:41.0) Gecko/20100101 Firefox/41.0 Build ID: 20150524030234 In the current Nightly, if I keep clicking the circle, it's eventually possible to drag it again.
Component: Untriaged → SVG
OS: Unspecified → All
Product: Firefox → Core
Hardware: Unspecified → All
Reproduced on Nightly41.0a1
Status: UNCONFIRMED → NEW
Ever confirmed: true
You must call preventDefault in event handlers. In d3 I think that's written d3.event.sourceEvent.preventDefault();
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → INVALID
I don't know exactly if that resolves the problem. The strange behavior is still existent with preventDefault. http://jsfiddle.net/uxnj7emv/8/ also using stopPropagation() http://jsfiddle.net/uxnj7emv/9/ further the bug report states misbehaviour on a small viewbox. Having a regular viewbox (size ~ 1) the behaviour is all right and event handlers remain existent. http://jsfiddle.net/uxnj7emv/7/ Please excuse me for reopening, but i can't see this neither resolved nor invalid. I dont think it is expected behavior and in my eyes it is at the very least inconsistent. (also the example given is very functional in chromium...)
Status: RESOLVED → REOPENED
Resolution: INVALID → ---
http://jsfiddle.net/uxnj7emv/8/ is not right, see comment 3 for the correct code.
here you go: http://jsfiddle.net/uxnj7emv/10/ http://jsfiddle.net/uxnj7emv/11/ in the end, i don't know if there is a default action to prevent, and even if so, the event handler shouldn't be dropped by accident (randomly)...
That seems to work OK for me. I'm on a Mac rather than Linux though.
(In reply to hiaselhans from comment #6) > here you go: > > http://jsfiddle.net/uxnj7emv/10/ > http://jsfiddle.net/uxnj7emv/11/ > > in the end, i don't know if there is a default action to prevent, and even > if so, the event handler shouldn't be dropped by accident (randomly)... > http://jsfiddle.net/uxnj7emv/10/ easily reproduce the problem for me. > http://jsfiddle.net/uxnj7emv/11/ easily reproduce the problem for me. Tested with Windows7 Nightly41.01 disabled e10s. https://hg.mozilla.org/mozilla-central/rev/b6623a27fa64 Mozilla/5.0 (Windows NT 6.1; WOW64; rv:41.0) Gecko/20100101 Firefox/41.0 ID:20150525030205
Attached file svg_event_small_viewbox.html (obsolete) (deleted) —
Open Web Console and Click black circle event not fire
Attached file svg_event_not_small_viewbox .html (deleted) —
this is not so small viewbox event fire as expected
Attached file svg_event_small_viewbox.html (deleted) —
Attachment #8610366 - Attachment is obsolete: true
(In reply to Robert Longson from comment #7) > That seems to work OK for me. I'm on a Mac rather than Linux though. Just tested on OSX as well and it seems to NOT work using a small viewbox
(In reply to hiaselhans from comment #13) Do you have a retina display?
Flags: needinfo?(simon)
(In reply to Robert Longson from comment #14) > (In reply to hiaselhans from comment #13) > > Do you have a retina display? No, using a regular macbook air 2013
Flags: needinfo?(simon)
Flags: needinfo?(jwatt)
This is basically the same as Alice's small viewbox testcase, just with the svg dimension changed and the <g> removed. (This is the testcase I wound up working with, so just attaching so I can reference it without caveats.)
This example turned out to be instructive for me regarding hit testing and the use of app units in general, so I wrote it up in some detail in the attached html (where I can reference images). The short version is that when we apply the viewBox transform to the point we're testing (in nsDisplayTransform::HitTest), we convert out of app units and apply the transform, which puts us (in this case) in svg user units with exact values. But we're not at the end of the hitTest pipeline yet, so we round that exact point back into int app units, which is pretty much game over in this case. IF my analysis is right here, it looks to me like it's impossible in firefox to hit test any svg object that doesn't contain a point that's a 1/60 multiple of a point with integer coordinates. i.e. if the object (in user space - i.e. the .01, .007 coordinates in my attached example) doesn't contain a point of the form (x / 60, y / 60), where x and y are integers, then hit testing will always fail. That seems to be a direct consequence of the final hit testing point being passed to nsDisplaySVGGeometry::HitTest (and through the entire display list hit testing pipeline) with nscoord units. I don't think I know how to fix that without changing display list hit testing's use of app units (nsRect) throughout... I haven't traced it through, but I suspect that in the original reported testcase, sometimes you move the circle and the new location contains a 1/60 point, other times you move the circle and the new location contains no such points, and then you can no longer move.
Also note from the description in the explanation attachment that at similar scales on similar svgs we can get successful hit testing outside the bounds of the object in question - that's because (or should be because - I haven't tested it on any actual examples in the debugger) big blocks of css pixel space are getting mapped down to a single point in svg user space (as the colored blue, red, green, and yellow blocks in that explanation). If such a block happens to map down to a 1/60 point that _does_ lie inside the object in svg user space, then the entire pixel block will register as hitting, whether the click actually occurred within the onscreen visible region of the object or not. I'm seeing that in the larger rectangle in bug 1310625 for example: the click region on the left side of the rectangle extends to the left outside its border; on the right side of the rectangle the right portion isn't clickable at all.
Severity: normal → S3

The severity field for this bug is relatively low, S3. However, the bug has 3 duplicates.
:jwatt, could you consider increasing the bug severity?

For more information, please visit auto_nag documentation.

Flags: needinfo?(jwatt)

The last needinfo from me was triggered in error by recent activity on the bug. I'm clearing the needinfo since this is a very old bug and I don't know if it's still relevant.

Flags: needinfo?(jwatt)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: