I've been struggling hard today tracking down the origin of a problem we have with Firefox 3.6 (the hard part being that the perceived problem was involving some quite complex mechanism including synchronous/asynchronous dispatching and actionscript/javascript boundary crossing).
Ultimately, I narrowed it down to a relatively simple test case.
- Have a very simple swf application, that listens to *flash* mouse events (over, out down, up, click, move)
- Launch in Firefox 3.5 (I'm on mac). Click on the swf app. Here's what you get back:
mouseDown [MouseEvent type="mouseDown" bubbles=true cancelable=false eventPhase=2 localX=279 localY=64 stageX=279 stageY=64 relatedObject=null ctrlKey=false altKey=false shiftKey=false buttonDown=true delta=0]
mouseUp [MouseEvent type="mouseUp" bubbles=true cancelable=false eventPhase=2 localX=279 localY=64 stageX=279 stageY=64 relatedObject=null ctrlKey=false altKey=false shiftKey=false buttonDown=false delta=0]
click [MouseEvent type="click" bubbles=true cancelable=false eventPhase=2 localX=279 localY=64 stageX=279 stageY=64 relatedObject=null ctrlKey=false altKey=false shiftKey=false buttonDown=false delta=0]That's expected, normal.
Now, same swf application, same flash version, same html page. Launch in Firefox 3.6. Here is what you get back.
mouseDown [MouseEvent type="mouseDown" bubbles=true cancelable=false eventPhase=2 localX=309 localY=69 stageX=309 stageY=69 relatedObject=null ctrlKey=false altKey=false shiftKey=false buttonDown=true delta=0]
mouseUp [MouseEvent type="mouseUp" bubbles=true cancelable=false eventPhase=2 localX=309 localY=69 stageX=309 stageY=69 relatedObject=null ctrlKey=false altKey=false shiftKey=false buttonDown=false delta=0]
click [MouseEvent type="click" bubbles=true cancelable=false eventPhase=2 localX=309 localY=69 stageX=309 stageY=69 relatedObject=null ctrlKey=false altKey=false shiftKey=false buttonDown=false delta=0]
mouseOut [MouseEvent type="mouseOut" bubbles=true cancelable=false eventPhase=2 localX=-1 localY=-1 stageX=-1 stageY=-1 relatedObject=null ctrlKey=false altKey=false shiftKey=false buttonDown=false delta=0]
Noticed the extra mouseOut event? Along with the odd stageX localX coordinates? Right now I have no idea if either a change in 3.6 revealed an old bug in Flash, or if 3.6 is at fault, but it's obvious that something did change in 3.6, likely in nsplugin.
While I would certainly be glad to report the bug to either/both Adobe or/and Mozilla, I would first love to learn more (if someone has the info) about what exactly changed in Gecko regarding these areas (plugin + event) that could relate to this, in order to report the problem to the most appropriate place with the most accurate description.
Clues?
[Update]
The description above is only one (specific) manifestation of the problem.
Actually, most time, what you get is:
click [MouseEvent type="click" bubbles=true cancelable=false eventPhase=2 localX=184 localY=46 stageX=184 stageY=46 relatedObject=null ctrlKey=false altKey=false shiftKey=false buttonDown=false delta=0]
mouseMove [MouseEvent type="mouseMove" bubbles=true cancelable=false eventPhase=2 localX=184 localY=24 stageX=184 stageY=24 relatedObject=null ctrlKey=false altKey=false shiftKey=false buttonDown=false delta=0]
mouseMove [MouseEvent type="mouseMove" bubbles=true cancelable=false eventPhase=2 localX=184 localY=46 stageX=184 stageY=46 relatedObject=null ctrlKey=false altKey=false shiftKey=false buttonDown=false delta=0]
Look at the stageX/Y coordinates.
You get correct coordinates for the click, then extremely quickly, a bogus update of the position (offset by -22 on Y <- and this is always 22), then immediately a new (correct) update of the cursor position.
We obviously don't speak about DOM events here, given plugins handle events themselves (or are supposed to).
So, my lecture tend to become now: "doing a click on a swf node causes firefox 3.6 to temporarily alter the cursor position by -22". I'm clueless about the meaning of "22" (it's not 42 :-)) - graphic cursor size?
Maybe after all this has nothing to do with nsplugin...
[Update 2]
Haha! It's not "22", it's exactly the value of window.screenY, and the same is true for screenX.
So, let's reformulate one last time:
"When you do click on a swf node in firefox 3.6, flash then successively receive a notification that the mouse has moved from its previous position (x, y), to (x - window.screenX, y - window.screenY), and immediately after, back to (x, y)".
Comments
#1
Thomas
Saturday, January 23 2010, 00:36
Could it be related to the following bug? https://bugzilla.mozilla.org/show_b...
#2
dmp
Saturday, January 23 2010, 01:04
@thomas: Could be. Could be not. Hard to tell without knowing how street-view handles events, or without digging into this deeply. Laurentj already forwarded me that bug, among (a lot) others. There seems to be a bunch of regressions with 3.6 on mac (related to how events are dispatched).
Either way, this looks bad for us. Given how things go, I would rather work on a patch to workaround ff3.6 in our product rather than dig our way into Gecko npapi (or whichever part is responsible).
The only idea that comes to mind right now is a dirty trigger-routine on clicks that captures the upcoming mousemove (or mouseout) and prevent them from getting further to the app. I still need to think more about that.
#3
David Tristram
Saturday, February 27 2010, 02:45
yes, Firefox 3.6 appears to be delivering a new mouseMove event that is offset from where the Player expects it to be. Flash Player interprets this as being outside the current control and generates the mouseOut. That may be something the Player will be able to accomodate. I'm looking into it.
#4
dmp
Saturday, February 27 2010, 16:11
@david: yes, I think the player should be able to workaround this.
FWIW, we already do that in AS for our projects.
See follow-up post here: http://blog.zoomodev.com/post/2010/...
and some code here: http://blog.zoomodev.com/public/Mou...
#5
David Tristram
Monday, March 1 2010, 17:18
I've developed workarounds in Flash Player that accommodate the FF 3.6 behavior and restores reliable double click and mouseOut event generation. Subject to release planning, the workarounds will be available in the "next" Player release. Thanks for your comments and discussion here.
#6
dmp
Monday, March 1 2010, 19:36
Great!
Mozilla landed something as well: http://hg.mozilla.org/releases/mozi... but I haven't tested it yet.
Thanks for the patch. Looking forward for the upcoming beta/release containing it.
#7
dmp
Wednesday, March 3 2010, 17:22
David, if by any chance you are reading this post comments' feed, could you possibly spare a few cycles for us shedding some light on this new post? -> http://blog.zoomodev.com/post/2010/03/03/Adobe-developer-around-help-wanted
Thanks anyhow!