Closed Bug 1420241 Opened 2 years ago Closed 2 years ago

Autoscroll popup displayed outside Firefox window

Categories

(Toolkit :: XUL Widgets, defect, P2)

x86_64
macOS
defect

Tracking

()

RESOLVED FIXED
mozilla59
Tracking Status
firefox-esr52 --- unaffected
firefox57 --- unaffected
firefox58 --- unaffected
firefox59 --- fixed

People

(Reporter: sg.mozilla, Assigned: Gijs)

References

Details

(Keywords: nightly-community, regression)

Attachments

(1 file)

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:59.0) Gecko/20100101 Firefox/59.0
Build ID: 20171123100420

Steps to reproduce:

(Assumes autoscrolling is enabled.)

- Open any page that overflows the extents of a Firefox window.
- Middle click to start autoscrolling.



Actual results:

Autoscrolling cursor is displayed at seemingly random positions; sometimes within the Firefox window, sometimes outside the Firefox window.

Behaviour appears to vary with the position of the mouse cursor at the moment autoscrolling is enabled.  On some pages (and perhaps window sizes?), the autoscrolling cursor is correctly displayed over the position of the mouse cursor -- but only when autoscrolling is engaged with the mouse cursor in a specific position.


Expected results:

Autoscrolling cursor (circle with arrows) is displayed over the same position as the mouse cursor at the moment autoscrolling is enabled.
OS: Unspecified → Mac OS X
Hardware: Unspecified → x86_64
20171121220115 consistently displayed the autoscrolling cursor in the correct position.

20171122220056 exhibits this problem.
Sorry, I misspoke:

> AR: [...] Behaviour appears to vary with the position of the mouse cursor at the moment autoscrolling is enabled.

> ER: Autoscrolling cursor (circle with arrows) is displayed over the same position as the mouse cursor at the moment autoscrolling is enabled.

s/enabled/engaged/ in both sentences above.

I am referring to the act of striking the middle mouse button to commence autoscrolling -- not the act of enabling autoscrolling in the preference pane.
Can you please use https://mozilla.github.io/mozregression/ to determine a specific bug introduced the regression?
 9:40.74 INFO: Narrowed inbound regression window from [6de57103, a77dc524] (3 builds) to [3c7a4c69, a77dc524] (2 builds) (~1 steps left)
 9:40.74 INFO: No more inbound revisions, bisection finished.
 9:40.74 INFO: Last good revision: 3c7a4c69bb8cc50c080c66e49ca36a0f3a2528a9
 9:40.74 INFO: First bad revision: a77dc52424ef72a2c419b8497d1e24af50d8aa26
 9:40.74 INFO: Pushlog:
https://hg.mozilla.org/integration/autoland/pushloghtml?fromchange=3c7a4c69bb8cc50c080c66e49ca36a0f3a2528a9&tochange=a77dc52424ef72a2c419b8497d1e24af50d8aa26
Summary: Autoscrolling cursor displayed outside Firefox window → Autoscroll popup displayed outside Firefox window
Blocks: 1401477
Status: UNCONFIRMED → NEW
Component: Untriaged → XUL Widgets
Ever confirmed: true
Product: Firefox → Toolkit
Can you share more details about your display and window setup? That is, how many screens do you have, what resolution do they operate on, are they hidpi, which is the primary screen, and is Firefox taking up the entire screen or a fraction of it, or...? Do you get this issue on all screens, or just some of them, on all window positions, or just some of them, etc. ?
Flags: needinfo?(sg.mozilla)
Sure.

Display setup:

- I use two identical monitors.
- The monitors are laid out in a vertically stacked landscape orientation -- one on top of the other.  The top-most monitor is the primary monitor.
- The monitors are attached to a laptop.  The laptop's internal monitor is not used.  The lid remains closed at all times.
- Each monitor has a native resolution of 3840 x 2160.  I think this qualifies for Hi-DPI.
- macOS has been configured to scale each display.[1]  The OS presents each monitor to software with a resolution of 2560 x 1440.  (https://www.whatismyscreenresolution.com/ shows this figure.)  However, each monitor still sees a 3840 x 2160 video stream from the machine.  The OS and/or graphics hardware presumably interpolate desktop widgets up to the final, higher, resolution.  (The same feature is available on the laptop's internal monitor.)

Window setup:

- I most commonly use Firefox with a window that is sized to fill one half of one monitor.  Either the left side or the right side.  (This provides four 'quadrants' of total space in which to work.)
- I seldom use Firefox with a maximised window.
- I never span a single Firefox window across multiple monitors.
- I sometimes use Firefox with windows that have been sized manually.  These windows take up a fraction of the display.

Observations:

- Behaviour varies with Firefox window position:
- Engaging autoscroll in a small Firefox window placed in the top-left quadrant of the primary (top most) monitor results in correct behaviour.
- Engaging autoscroll in an identically sized Firefox window placed in the bottom-right quadrant of the primary monitor results in incorrect behaviour.  The autoscroll popup is displayed outside the Firefox window, roughly at the horizontal and vertical mid point of the primary monitor.
- Engaging autoscroll in an identically sized Firefox window placed in the top-left quadrant of the secondary (bottom most) monitor results in incorrect behaviour.  The autoscroll popup is displayed outside the Firefox window on the primary monitor.  The popup is vertically aligned with the bottom of the primary monitor, but horizontally aligned with the position of the mouse cursor.
- Engaging autoscroll in an identically sized Firefox window placed in the bottom-right quadrant of the secondary monitor results in incorrect behaviour.  The autoscroll popup is displayed outside the Firefox window on the primary monitor.  The popup is vertically aligned with the bottom of the primary monitor, and its horizontal position seems 'capped' at about half the width of the monitor.

They say pictures are worth a thousand words.  Moving pictures must be worth a million.

This first capture illustrates behaviour with Firefox windows on the primary (top most) monitor.  (video/mp4)

https://share.redu.cx/ss/675eeeb04289467abd4236bd600c3953

This second capture illustrates behaviour with Firefox windows on the secondary (bottom most) monitor.  I was unable to capture output to both monitors so I have instead captured the bottom row of the primary monitor.  This is where the autoscroll popup appears when autoscrolling is engaged on the secondary monitor.  Firefox windows were placed in roughly the same positions as in the first capture.

https://share.redu.cx/ss/903b0d406f23440e81b0be710a84b73c

(The odd blinking is not visible in normal use.  I'm writing it off as a bug in the capture software.)


1: https://support.apple.com/en-au/HT202471 - See section titled 'Adjust your Retina display's resolution'
Flags: needinfo?(sg.mozilla)
No matter where the autoscroll popup appears, autoscrolling always functions correctly.  Moving the cursor upwards, above the point where the popup _should_ have appeared, will scroll the page upwards.  The bug is cosmetic.
On a hunch, I disabled display scaling in the macOS System Preferences.  This change made the problem go away.  (A Firefox restart was not necessary.)  The problem returned when scaling was enabled again.

I think display scaling is enabled by default by Apple on late-model Macs.
Thanks, that's really helpful. I'll try to find time to set up a similar setup myself. I do have access to an mbp, but I don't use it with an external screen regularly... If I can't find time soon, we'll have to back out bug 1401477.
Assignee: nobody → gijskruitbosch+bugs
Status: NEW → ASSIGNED
OK, so this actually reproduces on a regular mbp no problem. STR:

1. turn on scaling on a 15" hidpi mbp
2. set to anything higher than default
3. middle click somewhere in the bottom right quadrant of the screen (within a Fx window)

:spohl / :jfkthame: I don't really know how this is supposed to work. It doesn't seem to make much sense. Right now, the code in browser.xml fetches the screen rect in display pixels using GetAvailRectDisplayPix. It then gets CSS pixels by dividing through defaultCSSScaleFactor, plus some messing with the magical app unit number to match window.devicePixelRatio (which we can't use directly because there's no guarantee that the window's devicePixelRatio matches the screen on which the popup appears, if the window is partway between screens).

When I set the scale factor higher on macOS, the width/height of the display in display pixels changes, but the scale factor does not. This despite the docs saying that the defaultCSSScaleFactor is "device pixels per unscaled CSS pixel". The `dpi` number *does* change, but it wasn't clear to me that that was a sane number to use to convert these coordinates...

From the documentation, and use elsewhere in JS, I'm pretty sure I want DisplayPix rather than the unsuffixed version, but it's not clear to me how to get the numbers to convert them back. Add to that that on Windows, irrespective of scaling/dpi (1.75 on my main system), both methods report exactly the same number (they do not on macOS when the display is scaled).

TL;DR I'm just some chrome JS and I have some CSS coordinates and I want to bound them by the current screen, how hard can it be?

(I can't use window.screen directly because the numbers are negative in some multi-screen setups on Windows)
Flags: needinfo?(spohl.mozilla.bugs)
Flags: needinfo?(jfkthame)
Priority: -- → P2
I would have to dig into this quite a bit myself to give any kind of helpful feedback. Maybe Markus has some ideas?
Flags: needinfo?(spohl.mozilla.bugs) → needinfo?(mstange)
Per talking to jfkthame, this code should just not be using DisplayPix. On Windows, both numbers are the same, and this is not true on macOS.
Flags: needinfo?(mstange)
Flags: needinfo?(jfkthame)
Comment on attachment 8938010 [details]
Bug 1420241 - fix positioning of autoscroll popup on macOS,

https://reviewboard.mozilla.org/r/208740/#review214812
Attachment #8938010 - Flags: review?(dao+bmo) → review+
Pushed by gijskruitbosch@gmail.com:
https://hg.mozilla.org/integration/autoland/rev/4469bfc6aff5
fix positioning of autoscroll popup on macOS, r=dao
https://hg.mozilla.org/mozilla-central/rev/4469bfc6aff5
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla59
You need to log in before you can comment on or make changes to this bug.