Closed Bug 1246346 Opened 4 years ago Closed 4 years ago

screen.left and screen.top does not return the correct value with mixed DPI monitors

Categories

(Core :: Widget: Win32, defect)

All
Windows 10
defect
Not set

Tracking

()

RESOLVED FIXED
mozilla47
Tracking Status
firefox44 --- unaffected
firefox45 --- unaffected
firefox46 + unaffected
firefox47 + fixed
firefox-esr38 --- unaffected
firefox-esr45 --- unaffected

People

(Reporter: emk, Assigned: jfkthame)

References

Details

(Keywords: regression)

Attachments

(2 files)

Steps to reproduce.
1. Set two monitors to the following configuration:
   Monitor 1 (primary): 1280*960, 100% scale
   Monitor 2: 1920*1440, 150% scale
2. Open Nightly on the second monitor.
3. Open Web Console and type the following command:
  [screen.left,screen.top,screen.width,screen.height]

Actual result:
  Array [853, 0, 1280, 960]

Expected result:
  Array [1280, 0, 1280, 960]

We will need a similar fix to bug 1240085.
Summary: screen.width and screen.left does not return the correct value. → screen.width and screen.left does not return the correct value with mixed DPI monitors
Blocks: 890156
Summary: screen.width and screen.left does not return the correct value with mixed DPI monitors → screen.left and screen.top does not return the correct value with mixed DPI monitors
Tracking since this looks like a recent regression in 46.
Jonathan, can you take a look at this or help find an owner for this bug?
Flags: needinfo?(jfkthame)
Yes, I should be able to deal with this.
Assignee: nobody → jfkthame
Flags: needinfo?(jfkthame)
This is a helper to make the next patch much simpler; we already have the deviceContext, so exposing the Desktop-to-Device scale here avoids the need for a QI-dance via nsIBaseWindow or whatever. (I suspect this might turn out to be handy in other places, too.)
Attachment #8718793 - Flags: review?(VYV03354)
I don't have the exact same monitor configuration as yours in comment 0, but with this I'm seeing sensible results in similar mixed-dpi setups.
Attachment #8718794 - Flags: review?(VYV03354)
Attachment #8718793 - Flags: review?(VYV03354) → review+
Comment on attachment 8718794 [details] [diff] [review]
patch 2 - Correct the origin of the DOM screen coordinates (screen.left, screen.top) for secondary display on a mixed-DPI configuration

LGTM about the correctness (I don't consider about the performance such as talos regressions).
Attachment #8718794 - Flags: review?(VYV03354) → review+
https://hg.mozilla.org/integration/mozilla-inbound/rev/8c76ded2edb9adf8193020127f059d4b79d5c61c
Bug 1246346 - patch 1 - Expose a DesktopToDevice scale factor on nsDeviceContext. r=emk

https://hg.mozilla.org/integration/mozilla-inbound/rev/fc5233e55fec8b05f8284d407f5e1ff4be6795d0
Bug 1246346 - patch 2 - Correct the origin of the DOM screen coordinates (screen.left, screen.top) for secondary display on a mixed-DPI configuration. r=emk
https://hg.mozilla.org/mozilla-central/rev/8c76ded2edb9
https://hg.mozilla.org/mozilla-central/rev/fc5233e55fec
Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla47
Version: unspecified → Trunk
You need to log in before you can comment on or make changes to this bug.