Open Bug 1402276 Opened 3 years ago Updated 3 years ago
X/client Y inconsistent between the same website loaded in non-e10s and e10s enabled Firefox
User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:47.0) Gecko/20100101 Firefox/47.0 Build ID: 20161031133903 Steps to reproduce: My add-on "Save Images" allows to save an image when the mouse is over an image and a shortcut key is pressed (later version allows pressing of middle mouse button to save). In a e10s disabled loaded webpage, the mouseEvent.clientX/clientY are correct and the image is saved no matter where the mouse cursor is over the image. In an e10s enabled loaded webpage, the clientX/clientY values are different when the mouse cursor is clicked in the exact same location on the webpage. It appears as if the clientX/clientY values are calculated from the edge of the Firefox window instead of the webpage document edge. I have a vertical toolbar on the left edge, the menu bar visible and tabs below the address bar. When e10s is enabled, the clientX value is offset by the width of the vertical toolbar (30px) and the clientY value by 101px. I found that when e10s is enabled, offsetX/offsetY values seemed to be correct and I could use these, but if the webpage is zoomed, then I get incorrect results. 1. Disable e10s by setting browser.tabs.remote.force-enable to false in about:config 2. Restart Firefox 3. Load a webpage containing images 4. Click a mouse button and examine the clientX/clientY values. 5. Enable e10s by setting browser.tabs.remote.force-enable to true in about:config 6. Restart Firefox 7. Load the same webpage containing images 8. Click a mouse button and examine the clientX/clientY values. 9. clientX/clientY values returned are different to previous values I have tried this in Firefox desktop versions 47, 53 and 55 and all present the same problem. Actual results: e10s disabled clientX = 491 clientY = 465 offsetX = 171 offsetY = 259 e10s enabled clientX = 521 clientY = 566 offsetX = 489 offsetY = 463 Expected results: e10s disabled clientX = 491 clientY = 465 e10s enabled clientX = 491 clientY = 465 The values should be the same.
I tried to get the clientX/clientY values via the test case https://software.hixie.ch/utilities/js/live-dom-viewer/?saved=5387 I don't think I have problems with differences b/w e10s and non-e10s. Dear Reporter, Would you mind testing the link https://software.hixie.ch/utilities/js/live-dom-viewer/?saved=5387 ? Thanks!
I tried your test case and there was no problem. I had a relook at my code. I am using addEventListener with "mouseup". I changed this to "click" and then the clientX/clientY values were the same. Changing back to "mouseup" and the values were again different. I also tried "mousedown" which also gave different values. mouseup / mousedown - different clientX/clientY vales click - same clientX/clientY vales
Here are some other inconsistencies I have found with pageX/pageY and layerX/layerY - client, page and layer all return the same values with e10s enabled click (e10s disabled) e.offsetX = 177 e.offsetY = 166 e.clientX = 466 e.clientY = 162 e.pageX = 466 e.pageY = 3913 e.layerX = 211 e.layerY = 3725 click (e10s enabled) e.offsetX = 438 e.offsetY = 64 e.clientX = 467 e.clientY = 163 e.pageX = 467 e.pageY = 163 e.layerX = 467 e.layerY = 163 mouseup (e10s disabled) e.offsetX = 178 e.offsetY = 166 e.clientX = 467 e.clientY = 162 e.pageX = 467 e.pageY = 3913 e.layerX = 212 e.layerY = 3725 mouseup (e10s enabled) e.offsetX = 467 e.offsetY = 164 e.clientX = 496 e.clientY = 263 e.pageX = 496 e.pageY = 263 e.layerX = 496 e.layerY = 263
Thanks plashcor for the updates. :) However, even listening to mouseup/mousedown (as link below), I still have no problems with the clientX/Y and offsetX/Y for both e10s and non-e10s. https://software.hixie.ch/utilities/js/live-dom-viewer/?saved=5394 It'd be very helpful you could attach your simple test case and share with us.
I have found the error. I was adding the event listener to the top most window. This obviously worked in a non e10s environment but not when e10s was enabled. window.top.gBrowser.addEventListener('mouseup', doMouseUpFunction, false); I will change the event listener to attached it to the document. Thanks for your efforts and help.
You need to log in before you can comment on or make changes to this bug.