Commit Graph

1015 Commits

Author SHA1 Message Date
Emilio Cobos Álvarez
bcabeab0f8 Bug 1773813 - Incorporate OS zoom factor in window sizing calculations. r=tnikkel
In bug 1773342 I made OS text scale factor behave like a full zoom
factor which applies to all pages (including the browser chrome). That's
generally straight forward but it makes some callsites that use unzoomed
CSS coordinates misbehave (or behave correctly accidentally actually in
some other cases).

The main fix here is making
nsIBaseWindow::UnscaledDevicePixelsPerCSSPixel() and
nsIScreen::GetDefaultCSSScaleFactor() account for OS zoom as necessary.
However, I also went through the relevant code and cleaned it up to use
typed units and operations when possible.

The setup means:

 * nsIWidget::GetDefaultScale() doesn't account for OS full zoom.
 * nsIBaseWindow and nsIScreen does.

These are the places where this should matter and stuff can get
confused, but this works surprisingly well for all callers (except one
nsDeviceContext one which we use only for PuppetWidget and we can
remove by falling back to 1.0 like all other widgets until the update
comes).

Differential Revision: https://phabricator.services.mozilla.com/D149033
2022-06-14 15:01:52 +00:00
Norisz Fay
994a679882 Backed out changeset da5c71190673 (bug 1773813) for causing build bustages CLOSED TREE 2022-06-14 15:13:58 +03:00
Emilio Cobos Álvarez
bbb4f4acce Bug 1773813 - Incorporate OS zoom factor in window sizing calculations. r=tnikkel
In bug 1773342 I made OS text scale factor behave like a full zoom
factor which applies to all pages (including the browser chrome). That's
generally straight forward but it makes some callsites that use unzoomed
CSS coordinates misbehave (or behave correctly accidentally actually in
some other cases).

The main fix here is making
nsIBaseWindow::UnscaledDevicePixelsPerCSSPixel() and
nsIScreen::GetDefaultCSSScaleFactor() account for OS zoom as necessary.
However, I also went through the relevant code and cleaned it up to use
typed units and operations when possible.

The setup means:

 * nsIWidget::GetDefaultScale() doesn't account for OS full zoom.
 * nsIBaseWindow and nsIScreen does.

These are the places where this should matter and stuff can get
confused, but this works surprisingly well for all callers (except one
nsDeviceContext one which we use only for PuppetWidget and we can
remove by falling back to 1.0 like all other widgets until the update
comes).

Differential Revision: https://phabricator.services.mozilla.com/D149033
2022-06-14 11:37:25 +00:00
Benjamin VanderSloot
c7836e865b Bug 1765313, part 3 - Rename ContentBlocking to StorageAccessAPIHelper, r=anti-tracking-reviewers,necko-reviewers,dragana,timhuang
The only functions that remain are used as helper functions in the various variants of the Storage Access API.
To make this clearer, I have renamed this class and file that contains it.

Differential Revision: https://phabricator.services.mozilla.com/D148286
2022-06-08 21:57:17 +00:00
Benjamin VanderSloot
3625dae128 Bug 1770403, part 2 - Remove mStorageAccessPermissionGranted from the outer window, r=anti-tracking-reviewers,timhuang
With the use of mStorageAccessPermissionGranted reduced to a single meaning, it turns out to be entirely redundant with the variable on the inner window.

Depends on D147867

Differential Revision: https://phabricator.services.mozilla.com/D147868
2022-06-08 21:57:15 +00:00
Benjamin VanderSloot
a899e97869 Bug 1770403, part 1 - Change initialization of mStorageAccessPermissionGranted on outer window, r=anti-tracking-reviewers,timhuang
mStorageAccessPermissionGranted was initialized to ShouldAllowAccessFor(...).
This had logic that has nothing to do with this the permission being granted.
A few bugs with my helpers were covered up by this default value, so I fixed the helpers in the same patch here.

This also required adding a new helper to the RejectForeignAllowList and exposing it to the Document.cpp file.
I'm not enthused about making that available, but we don't have a good component boundary for now, so I don't hate it.
Ideally the implementation of the rSA and hSA funcitons (and the like) would be in our component, but that is outside of this change's scope.

Differential Revision: https://phabricator.services.mozilla.com/D147867
2022-06-08 21:57:15 +00:00
Marian-Vasile Laza
bd44a1b4a8 Backed out 5 changesets (bug 1765313, bug 1770403) for causing bc failures on browser_storageAccessPrivilegeAPI.js. CLOSED TREE
Backed out changeset 22153c8641e1 (bug 1765313)
Backed out changeset 588d54f796a0 (bug 1765313)
Backed out changeset 2376ca53eb9c (bug 1765313)
Backed out changeset 9cf02ec5657a (bug 1770403)
Backed out changeset 7d8147ba25e8 (bug 1770403)
2022-06-08 22:07:37 +03:00
Benjamin VanderSloot
19dd5cb3c4 Bug 1765313, part 3 - Rename ContentBlocking to StorageAccessAPIHelper, r=anti-tracking-reviewers,necko-reviewers,dragana,timhuang
The only functions that remain are used as helper functions in the various variants of the Storage Access API.
To make this clearer, I have renamed this class and file that contains it.

Differential Revision: https://phabricator.services.mozilla.com/D148286
2022-06-08 17:11:19 +00:00
Benjamin VanderSloot
68fc2d1b39 Bug 1770403, part 2 - Remove mStorageAccessPermissionGranted from the outer window, r=anti-tracking-reviewers,timhuang
With the use of mStorageAccessPermissionGranted reduced to a single meaning, it turns out to be entirely redundant with the variable on the inner window.

Depends on D147867

Differential Revision: https://phabricator.services.mozilla.com/D147868
2022-06-08 17:11:18 +00:00
Benjamin VanderSloot
2f02e91868 Bug 1770403, part 1 - Change initialization of mStorageAccessPermissionGranted on outer window, r=anti-tracking-reviewers,timhuang
mStorageAccessPermissionGranted was initialized to ShouldAllowAccessFor(...).
This had logic that has nothing to do with this the permission being granted.
A few bugs with my helpers were covered up by this default value, so I fixed the helpers in the same patch here.

This also required adding a new helper to the RejectForeignAllowList and exposing it to the Document.cpp file.
I'm not enthused about making that available, but we don't have a good component boundary for now, so I don't hate it.
Ideally the implementation of the rSA and hSA funcitons (and the like) would be in our component, but that is outside of this change's scope.

Differential Revision: https://phabricator.services.mozilla.com/D147867
2022-06-08 17:11:17 +00:00
Molnar Sandor
cb1c2d7987 Backed out 5 changesets (bug 1765313, bug 1770403) for causing lint failure in tools/lint/rejected-words.yml CLOSED TREE
Backed out changeset c76671d99573 (bug 1765313)
Backed out changeset f0895e88c27e (bug 1765313)
Backed out changeset 81a0f8c40381 (bug 1765313)
Backed out changeset a11f5453e441 (bug 1770403)
Backed out changeset df452028881c (bug 1770403)
2022-06-08 15:48:57 +03:00
Benjamin VanderSloot
24bacd6c07 Bug 1765313, part 3 - Rename ContentBlocking to StorageAccessAPIHelper, r=anti-tracking-reviewers,necko-reviewers,dragana,timhuang
The only functions that remain are used as helper functions in the various variants of the Storage Access API.
To make this clearer, I have renamed this class and file that contains it.

Differential Revision: https://phabricator.services.mozilla.com/D148286
2022-06-08 12:18:23 +00:00
Benjamin VanderSloot
ae8d206f99 Bug 1770403, part 2 - Remove mStorageAccessPermissionGranted from the outer window, r=anti-tracking-reviewers,timhuang
With the use of mStorageAccessPermissionGranted reduced to a single meaning, it turns out to be entirely redundant with the variable on the inner window.

Depends on D147867

Differential Revision: https://phabricator.services.mozilla.com/D147868
2022-06-08 12:18:22 +00:00
Benjamin VanderSloot
b3514610b6 Bug 1770403, part 1 - Change initialization of mStorageAccessPermissionGranted on outer window, r=anti-tracking-reviewers,timhuang
mStorageAccessPermissionGranted was initialized to ShouldAllowAccessFor(...).
This had logic that has nothing to do with this the permission being granted.
A few bugs with my helpers were covered up by this default value, so I fixed the helpers in the same patch here.

This also required adding a new helper to the RejectForeignAllowList and exposing it to the Document.cpp file.
I'm not enthused about making that available, but we don't have a good component boundary for now, so I don't hate it.
Ideally the implementation of the rSA and hSA funcitons (and the like) would be in our component, but that is outside of this change's scope.

Differential Revision: https://phabricator.services.mozilla.com/D147867
2022-06-08 12:18:21 +00:00
Emilio Cobos Álvarez
1c58e2a928 Bug 1773070 - Unify Gecko and Servo EventState/ElementState bits. r=smaug
Add a dom/base/rust crate called just "dom" where we can share these.

Most of the changes are automatic:

  s/mozilla::EventStates/mozilla::dom::ElementState/
  s/EventStates/ElementState/
  s/NS_EVENT_STATE_/ElementState::/
  s/NS_DOCUMENT_STATE_/DocumentState::/

And so on. This requires a new cbindgen version to avoid ugly casts for
large shifts.

Differential Revision: https://phabricator.services.mozilla.com/D148537
2022-06-07 23:09:52 +00:00
Edgar Chen
8de138b9c9 Bug 1757531 - Do not forward focus to child frame when calling window.focus() on parent frame; r=hsivonen
Differential Revision: https://phabricator.services.mozilla.com/D146446
2022-05-31 19:59:39 +00:00
Butkovits Atila
63dc4585ea Backed out changeset 630c31f32767 (bug 1757531) for causing wpt failures at activeelement-after-calling-window-focus.sub.html. CLOSED TREE 2022-05-30 18:03:23 +03:00
Edgar Chen
80f336e9c1 Bug 1757531 - Do not forward focus to child frame when calling window.focus() on parent frame; r=hsivonen
Differential Revision: https://phabricator.services.mozilla.com/D146446
2022-05-30 12:59:48 +00:00
Masayuki Nakano
60e856a8ab Bug 1680611 - part 8: Mark nsFocusManager::Blur and its callers in nsFocusManager as MOZ_CAN_RUN_SCRIPT r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D147067
2022-05-26 04:37:20 +00:00
Masayuki Nakano
26e31d62cf Bug 1680611 - part 3: Mark nsFocusManager::WindowLowered() and its callers in nsFocusManager as MOZ_CAN_RUN_SCRIPT r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D147062
2022-05-26 04:37:18 +00:00
Emilio Cobos Álvarez
9e65df1038 Bug 1769758 - Remove window.mozPaintCount. r=webidl,peterv
We unshipped it successfully a while ago (bug 1591968).

Differential Revision: https://phabricator.services.mozilla.com/D146575
2022-05-17 14:14:10 +00:00
Jonathan Watt
e5a8eb1650 Bug 1432651 p1 - Pass RemotePrintJobChild through to the places where it's needed. r=emilio
Given how nsIPrintSettings is passed around, stored and copied all over the
place, it's very hard to reason about where and when a RemotePrintJobChild is
needed or valid. This patch avoids all that by explicitly passing a
RemotePrintJobChild when it's needed.

Another reason to make this change is because RemotePrintJobChild really does
not belong on nsIPrintSettings. That interface is supposed to represent a
collection of settings for laying out the document that is to be printed.

Differential Revision: https://phabricator.services.mozilla.com/D146380
2022-05-16 08:38:01 +00:00
Cristian Tuns
fa5ade6c28 Backed out 3 changesets (bug 1758745, bug 1758740, bug 1762462) for causing mochitest failures on test_storagePermissionsAccept.html CLOSED TREE
Backed out changeset fa222c0a9a26 (bug 1762462)
Backed out changeset 9daa04b239f9 (bug 1758745)
Backed out changeset c18aecb431c0 (bug 1758740)
2022-05-10 20:12:45 -04:00
Thomas Wisniewski
c131738709 Bug 1758745 - Refactor EffectiveStoragePrincipal to EffectiveCookiePrincipal and create new function EffectiveStoragePrincipal that is never unpartitioned; r=twisniewski
Depends on D143626

Differential Revision: https://phabricator.services.mozilla.com/D143627
2022-05-10 21:49:42 +00:00
Butkovits Atila
5ee4443154 Backed out 3 changesets (bug 1758745, bug 1758740, bug 1762462) for causing failures at browser_storage_dfpi.js. CLOSED TREE
Backed out changeset a3024e8b2a58 (bug 1762462)
Backed out changeset 8bc1291b9bdb (bug 1758745)
Backed out changeset c7b693b2fd05 (bug 1758740)
2022-05-10 16:17:59 +03:00
Thomas Wisniewski
ed22a3aadb Bug 1758745 - Refactor EffectiveStoragePrincipal to EffectiveCookiePrincipal and create new function EffectiveStoragePrincipal that is never unpartitioned; r=twisniewski
Depends on D143626

Differential Revision: https://phabricator.services.mozilla.com/D143627
2022-05-10 12:05:51 +00:00
Jonathan Watt
343324b433 Bug 1712104 p2 - Support printing directly via the system print dialog. r=emilio
This is behind the bool pref print.prefer_system_dialog

Differential Revision: https://phabricator.services.mozilla.com/D135452
2022-05-06 14:30:25 +00:00
Emilio Cobos Álvarez
9a6f39ff3f Bug 1765961 - Avoid some warning spam in nsGlobalWindowOuter. r=smaug
NS_ENSURE_TRUE prints to stderr, which is noisy (this can happen
legitimately).

Differential Revision: https://phabricator.services.mozilla.com/D144416
2022-04-23 10:21:20 +00:00
Michel Le Bihan
247683e691 Bug 1764541 - Add telemetry for window.open with empty url argument r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D143590
2022-04-20 13:39:34 +00:00
Edgar Chen
6ab647fc40 Bug 1758164 - Align the behavior of defining non-configurable properties on a WindowProxy on Nightly with Release/Beta; r=peterv
Differential Revision: https://phabricator.services.mozilla.com/D141732
2022-03-29 20:33:24 +00:00
Emilio Cobos Álvarez
c7c5de6781 Bug 1759163 - Add origin trial support for worklets. r=asuth
Move the trial getter to nsIGlobalObject, make every implementation
provide a reasonable value, and add a test.

Differential Revision: https://phabricator.services.mozilla.com/D140848
2022-03-15 23:16:14 +00:00
Marian-Vasile Laza
b328ae122e Backed out changeset 558e256fcb31 (bug 1759163) for causing mochitest failures on test_header_simple.html. 2022-03-15 15:23:04 -07:00
Emilio Cobos Álvarez
7b2db77ff1 Bug 1759163 - Add origin trial support for worklets. r=asuth
Move the trial getter to nsIGlobalObject, make every implementation
provide a reasonable value, and add a test.

Differential Revision: https://phabricator.services.mozilla.com/D140848
2022-03-15 17:50:03 +00:00
Edgar Chen
cf1eed086b Bug 1683281 - Part 2: Move proxy handler utility functions from DOMJSProxyHandler.h to ProxyHandlerUtils.h; r=peterv
Depends on D103469

Differential Revision: https://phabricator.services.mozilla.com/D112277
2022-03-10 22:44:27 +00:00
Jon Coppeard
222416decc Bug 1757956 - Part 3: Rename JSFreeOp to JS::GCContext in the JS engine r=jandem
Differential Revision: https://phabricator.services.mozilla.com/D140525
2022-03-10 08:40:03 +00:00
Emilio Cobos Álvarez
20ba7daa1c Bug 1753836 - Make window screen and event screen coordinates consistent. r=jfkthame
This basically undoes bug 1246346. The current behavior is pretty bizarre,
the screenX origin / position doesn't match the mouse event coordinates,
because on windows we return device pixels rather than CSS pixels for the
window coordinates.

This makes behavior consistent with how other browsers report these coordinates
at least on Windows in non-mixed DPI mode, and I think is fine.

In mixed DPI mode, there might indeed be overlapping coordinates, but again I
think that's fine, because the CSS coordinate space of the different monitors
is different.  You need to multiply by the devicePixelRatio if you want
coordinates not to overlap.

Depends on D138039

Differential Revision: https://phabricator.services.mozilla.com/D138130
2022-02-16 12:18:12 +00:00
smolnar
ac36389b37 Backed out 6 changesets (bug 1753836) for causing mochitest failures in test_event_screenXY_with_zoom. CLOSED TREE
Backed out changeset a572cbc0fac2 (bug 1753836)
Backed out changeset 371a495ff728 (bug 1753836)
Backed out changeset 774af76be463 (bug 1753836)
Backed out changeset faa8a8f2d40f (bug 1753836)
Backed out changeset 9209832ecffe (bug 1753836)
Backed out changeset db443ce0406d (bug 1753836)
2022-02-16 01:47:51 +02:00
Emilio Cobos Álvarez
314f6c7716 Bug 1753836 - Make window screen and event screen coordinates consistent. r=jfkthame
This basically undoes bug 1246346. The current behavior is pretty bizarre,
the screenX origin / position doesn't match the mouse event coordinates,
because on windows we return device pixels rather than CSS pixels for the
window coordinates.

This makes behavior consistent with how other browsers report these coordinates
at least on Windows in non-mixed DPI mode, and I think is fine.

In mixed DPI mode, there might indeed be overlapping coordinates, but again I
think that's fine, because the CSS coordinate space of the different monitors
is different.  You need to multiply by the devicePixelRatio if you want
coordinates not to overlap.

Depends on D138039

Differential Revision: https://phabricator.services.mozilla.com/D138130
2022-02-15 22:25:05 +00:00
Emilio Cobos Álvarez
f7c36a8d26 Bug 1754858 - Simplify screen orientation API implementation. r=smaug,m_kato,geckoview-reviewers
Make the ScreenOrientation part of the screen struct, as it should. Stop
using HAL to propagate just screen orientation updates, use the more
general screen manager.

Instead of HAL observers, add a simple observer service notification,
and clean a bunch of the code.

This will simplify bug 1754802 a bit, and is generally simpler.
Shouldn't change behavior. I've tested the events and some common
orientation locking use cases like Youtube, and they behave the same.

Differential Revision: https://phabricator.services.mozilla.com/D138477
2022-02-15 20:22:54 +00:00
Jan de Mooij
41c0fad9d9 Bug 1754405 part 5 - Remove INT_FITS_IN_JSID/INT_TO_JSID. r=evilpie
Differential Revision: https://phabricator.services.mozilla.com/D138276
2022-02-13 12:01:45 +00:00
Sylvestre Ledru
35a175aa33 Bug 1754767 - Remove duplicate includes r=media-playback-reviewers,padenot
Differential Revision: https://phabricator.services.mozilla.com/D138441
2022-02-11 10:01:15 +00:00
Jan de Mooij
7282ab4669 Bug 1754405 part 1 - Remove JSID_IS_STRING/JSID_TO_STRING. r=evilpie
Differential Revision: https://phabricator.services.mozilla.com/D138272
2022-02-10 09:13:17 +00:00
Emilio Cobos Álvarez
05297ebcf4 Bug 1753995 - Move devicePixelRatio getter from outer to inner window. r=smaug
It only pokes at the document's pres context, there's no need to
roundtrip through the outer window. No behavior change.

Differential Revision: https://phabricator.services.mozilla.com/D138019
2022-02-07 18:23:35 +00:00
Chris Martin
75956faa71 Bug 1752619 - Remove aTargetScreen from nsIWidget::MakeFullScreen() r=handyman,spohl,agi,emilio
Differential Revision: https://phabricator.services.mozilla.com/D137336
2022-01-31 22:07:23 +00:00
Jonathan Watt
1757bcbadb Bug 1704178. Remove platform print.tab_modal.enabled=false code. r=bobowen
Differential Revision: https://phabricator.services.mozilla.com/D136736
2022-01-28 15:52:51 +00:00
Jonathan Watt
79109555b9 Bug 1702501 - Remove print.tab_modal.enabled pref and old frontend print preview code. r=mstriemer
Differential Revision: https://phabricator.services.mozilla.com/D134699
2022-01-06 18:55:38 +00:00
Jonathan Watt
4bd6fa9eb2 Bug 1741698 - Fix silent printing for both window.print() and print to file. r=emilio
Printing was failing for silent window.print() printing because we need a
RemotePrintJobChild. The content process side of the print now asks the parent
process to send a valid nsIPrintSettings object and a RemotePrintJobChild
before it starts printing.

Printing was also failing for silent print-to-file printing in the case that
the user omits to set the `printer.print_to_filename` pref. That was because
we weren't setting a fallback value for nsIPrintSettings.toFileName.

Differential Revision: https://phabricator.services.mozilla.com/D134799
2022-01-02 13:05:54 +00:00
criss
694ce29c46 Backed out changeset 8105d0c98b35 (bug 1741698) for causing wpt failures on Devices-without-focus.https.html. CLOSED TREE 2021-12-31 23:10:31 +02:00
Jonathan Watt
31bf88a168 Bug 1741698 - Fix silent printing for both window.print() and print to file. r=emilio
Printing was failing for silent window.print() printing because we need a
RemotePrintJobChild. The content process side of the print now asks the parent
process to send a valid nsIPrintSettings object and a RemotePrintJobChild
before it starts printing.

Printing was also failing for silent print-to-file printing in the case that
the user omits to set the `printer.print_to_filename` pref. That was because
we weren't setting a fallback value for nsIPrintSettings.toFileName.

Differential Revision: https://phabricator.services.mozilla.com/D134799
2021-12-31 14:50:35 +00:00
Kagami Sascha Rosylight
88f38b19c2 Bug 1539884 - Part 21: Mark nsIDOMXULCommandDispatcher::updateCommands as can_run_script r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D134353
2021-12-23 16:27:20 +00:00