2687 Commits

Author SHA1 Message Date
Emilio Cobos Álvarez
8501b361e4 Bug 1801031 - Use attribute atoms for screenX/screenY in one more place. r=smaug
Otherwise we hit the weird HTML-specific lowercasing of attributes,
which make these attributes "screenx" and "screeny", which means we fail
to restore the persisted position.

We should consider adding screen-x/screen-y and migrate screenX/Y to
that probably...

Differential Revision: https://phabricator.services.mozilla.com/D162391
2022-11-18 13:32:33 +00:00
Emilio Cobos Álvarez
00750e17e2 Bug 1799394 - Make dialog sizing code consistent between C++ and JS. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D161429
2022-11-11 10:08:56 +00:00
Razvan Cojocaru
1629218702 Bug 1060421 - Change the type of [Int]PointTyped::[x|y] back to [Int]CoordTyped. r=botond
[Int]CoordTyped no longer inherits Units because otherwise
instances of [Int]IntPointTyped may get one Base subobject because
it inherits Units, and others because of BasePoint's Coord members,
which end up increasing the [Int]CoordTyped's objects size (since
according to the ISO C++ standard, different Base subobject are
required to have different addresses).

Differential Revision: https://phabricator.services.mozilla.com/D160713
2022-11-04 18:29:35 +00:00
Jens Stutte
027638529a Bug 1669836 - Bail out from modal dialog during shutdown. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D161038
2022-11-04 14:01:06 +00:00
Emilio Cobos Álvarez
e2a5d100fe Bug 1795804 - Persist sizemode synchronously. r=smaug
Much like everything else. This is important because the front-end uses
sizemode for styling.

The comment I'm removing doesn't really make much sense, since sizemode
and size are persisted separately (using different dirty flags) so it's
not like we're saving duplicate work or something.

The delay this fixes existed already on Linux since ~forever at least,
haven't tested macOS.

Depends on D159578

Differential Revision: https://phabricator.services.mozilla.com/D159579
2022-10-20 08:30:16 +00:00
Emilio Cobos Álvarez
69fbb7c1bc Bug 1795804 - Move code around a little bit to avoid calling GetRestoredBounds when not using them. r=smaug
This _actually_ avoids the assertion that got me backed out, sigh.

Differential Revision: https://phabricator.services.mozilla.com/D159737
2022-10-20 08:05:33 +00:00
Marian Laza
b55f521867 Backed out changeset 491ac50c7721 (bug 1795804) for causing mochitest failures on test_maximized_persist.xhtml. CLOSED TREE 2022-10-19 19:37:39 +03:00
Emilio Cobos Álvarez
7c40e2dade Bug 1795804 - Persist sizemode synchronously. r=smaug
Much like everything else. This is important because the front-end uses
sizemode for styling.

The comment I'm removing doesn't really make much sense, since sizemode
and size are persisted separately (using different dirty flags) so it's
not like we're saving duplicate work or something.

The delay this fixes existed already on Linux since ~forever at least,
haven't tested macOS.

Depends on D159578

Differential Revision: https://phabricator.services.mozilla.com/D159579
2022-10-19 14:02:46 +00:00
Emilio Cobos Álvarez
fb8908b850 Bug 1795804 - Persist only what's requested sync. r=smaug
This fixes issues like the one that got me backed out, where we have a
dirty size request, and we want to synchronously persist sizemode.

With this patch, we'd persist sizemode sync, but size would still be
updated async, preserving the previous size behavior.

Differential Revision: https://phabricator.services.mozilla.com/D159644
2022-10-19 12:40:25 +00:00
Sandor Molnar
94ca5702ed Backed out changeset d2e0da08b38f (bug 1795804) for causing assertion failures in widget/cocoa/nsCocoaWindow.mm 2022-10-18 21:07:02 +03:00
Emilio Cobos Álvarez
be7ce82637 Bug 1795804 - Persist sizemode synchronously. r=smaug
Much like everything else. This is important because the front-end uses
sizemode for styling.

The comment I'm removing doesn't really make much sense, since sizemode
and size are persisted separately (using different dirty flags) so it's
not like we're saving duplicate work or something.

The delay this fixes existed already on Linux since ~forever at least,
haven't tested macOS.

Depends on D159578

Differential Revision: https://phabricator.services.mozilla.com/D159579
2022-10-18 13:13:34 +00:00
Emilio Cobos Álvarez
0909519a3e Bug 1795804 - Centralize persistent attribute update code. r=smaug
This patch doesn't change behavior by itself, but it makes the
persistent attribute code a bit clearer by making it use typed enums
rather than raw integers for flags. Also centralizes the update.

Depends on D159577

Differential Revision: https://phabricator.services.mozilla.com/D159578
2022-10-18 13:13:33 +00:00
Emilio Cobos Álvarez
48ff081125 Bug 1795804 - Use atom version of attributes in persistence code when possible. r=smaug
Also drive-by, but it's faster.

Depends on D159576

Differential Revision: https://phabricator.services.mozilla.com/D159577
2022-10-18 13:13:33 +00:00
Emilio Cobos Álvarez
7881bdbb11 Bug 1795804 - Don't use lock to set persistent attribute timer. r=smaug
Drive-by, but this timer is main-thread only, I have no idea why it'd
need a lock.

Differential Revision: https://phabricator.services.mozilla.com/D159576
2022-10-18 13:13:32 +00:00
Emilio Cobos Álvarez
ab8ce397d0 Bug 1792337 - Add a more convenient API to size a window constrained to a default size. r=bytesized,extension-reviewers,robwu,TYLin
Differential Revision: https://phabricator.services.mozilla.com/D158235
2022-09-30 00:45:36 +00:00
Timothy Nikkel
daa8e98d8d Bug 1792156. Fix width/height mixup from bug 1773813. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D158008
2022-09-23 08:56:53 +00:00
Pier Angelo Vendrame
aa21b01cfa Bug 1768907 - Part 1: Make browser.privatebrowsing.autostart a static pref. r=handyman,necko-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D157843
2022-09-22 00:26:17 +00:00
Nika Layzell
c195a30e63 Bug 1694993 - Part 1: Be more explicit about principals used when creating pop-up windows, r=smaug
Previously we would pull this information frequently from the subject
principal, which is unreliable. With this new approach, we more explicitly pass
the principals around as-needed into where they're going to be used.

Some assertions about the subject principal were introduced to ensure that
assumptions made about chrome windows and the system principal are not
incorrect.

Differential Revision: https://phabricator.services.mozilla.com/D154563
2022-09-20 23:29:06 +00:00
Emilio Cobos Álvarez
db7ddc382a Bug 1789823 - Remove redundant SetSizeMode call from AppWindow::SizeModeChanged. r=stransky
This is the listener for a size mode change, shouldn't need to set the
size mode again. While at it, match coding style better.

This doesn't change behavior now, but with the next patch it would.

Differential Revision: https://phabricator.services.mozilla.com/D157597
2022-09-19 09:39:10 +00:00
Emilio Cobos Álvarez
fb6380190c Bug 1786525 - Don't update untransformed anchor rect when moved by move-to-rect. r=stransky
Otherwise, it changes the move-to-rect inputs, which can change the
output as well, making us move the anchor all the way to the right.

You could, I guess, consider this a mutter bug of sorts, because it
feels weird that you pass it an anchor that has been a `move-to-rect`
output and you get another rect as an output.

But also, it's kinda silly that we're doing that to begin with, so avoid
it by telling the popup frame whether it's been positioned / moved by
move-to-rect (and keeping the anchor in that case).

The reason this works on my setup without "Large text" is just dumb luck
(the front-end computes a max-height for the panel that is small enough
to fit on the screen).

Differential Revision: https://phabricator.services.mozilla.com/D155406
2022-08-30 09:30:27 +00:00
Sandor Molnar
9d7f9853a2 Backed out changeset bb1d2a4a5570 (bug 1786525) for causing build bustages in xpfe/appshell/AppWindow.cpp CLOSED TREE 2022-08-30 01:26:00 +03:00
Emilio Cobos Álvarez
cf74fba975 Bug 1786525 - Don't update untransformed anchor rect when moved by move-to-rect. r=stransky
Otherwise, it changes the move-to-rect inputs, which can change the
output as well, making us move the anchor all the way to the right.

You could, I guess, consider this a mutter bug of sorts, because it
feels weird that you pass it an anchor that has been a `move-to-rect`
output and you get another rect as an output.

But also, it's kinda silly that we're doing that to begin with, so avoid
it by telling the popup frame whether it's been positioned / moved by
move-to-rect (and keeping the anchor in that case).

The reason this works on my setup without "Large text" is just dumb luck
(the front-end computes a max-height for the panel that is small enough
to fit on the screen).

Differential Revision: https://phabricator.services.mozilla.com/D155406
2022-08-29 21:47:34 +00:00
Narcis Beleuzu
94d309143f Backed out 5 changesets (bug 1694993) for bc failure on browser_cross_process_csp_inheritance.js
Backed out changeset 1d21d911b3e7 (bug 1694993)
Backed out changeset 3b412d5fbdcf (bug 1694993)
Backed out changeset c9585ce37fe5 (bug 1694993)
Backed out changeset 05d7cbbfe9e2 (bug 1694993)
Backed out changeset 3821545ab46b (bug 1694993)
2022-08-22 20:32:02 +03:00
Nika Layzell
4c195ef117 Bug 1694993 - Part 1: Be more explicit about principals used when creating pop-up windows, r=smaug
Previously we would pull this information frequently from the subject
principal, which is unreliable. With this new approach, we more explicitly pass
the principals around as-needed into where they're going to be used.

Some assertions about the subject principal were introduced to ensure that
assumptions made about chrome windows and the system principal are not
incorrect.

Differential Revision: https://phabricator.services.mozilla.com/D154563
2022-08-22 15:35:27 +00:00
Fabrice Desré
c50cb528fc Bug 1761040 - Prefix thread safety macros with MOZ_ r=geckoview-reviewers,media-playback-reviewers,alwu,jesup,m_kato
Differential Revision: https://phabricator.services.mozilla.com/D152575
2022-08-03 16:39:41 +00:00
Andreea Pavel
3ccd75af8d Backed out changeset b9d2965591b9 (bug 1761040) for landing with wrong author CLOSED TREE DONTBUILD 2022-08-03 18:55:00 +03:00
Andreea Pavel
fdb7cb2ecd Bug 1761040 - Prefix thread safety macros with MOZ_ r=geckoview-reviewers,media-playback-reviewers,alwu,jesup,m_kato
Differential Revision: https://phabricator.services.mozilla.com/D152575
2022-08-03 15:27:43 +00:00
Mark Banner
7428be4a86 Bug 1782008 - Remove now unnecessary .eslintrc.js files. r=webcompat-reviewers,extension-reviewers,media-playback-reviewers,pip-reviewers,denschub,rpl,alwu,mossop
Differential Revision: https://phabricator.services.mozilla.com/D152736
2022-08-03 11:16:20 +00:00
Andreea Pavel
89d63c91e6 Backed out changeset a907159a482f (bug 1761040) for causing build bustages on a CLOSED TREE 2022-08-02 04:59:08 +03:00
Fabrice Desré
0f4ac7ad97 Bug 1761040 - Prefix thread safety macros with MOZ_ r=geckoview-reviewers,media-playback-reviewers,alwu,jesup,m_kato
Differential Revision: https://phabricator.services.mozilla.com/D152575
2022-08-02 00:49:41 +00:00
Nika Layzell
c15823d075 Bug 1772006 - Part 5: Simplify and move the string searching APIs from ns[T]StringObsolete, r=xpcom-reviewers,necko-reviewers,eeejay,dragana,barret
The biggest set of APIs from ns[T]StringObsolete which are still heavily used
are the string searching APIs. It appears the intention was for these to be
replaced by the `FindInReadable` APIs, however that doesn't appear to have
happened.

In addition, the APIs have some quirks around their handling of mixed character
widths. These APIs generally supported both narrow strings and the native
string type, probably because char16_t string literals weren't available until
c++11. Finally they also used easy-to-confuse unlabeled boolean and integer
optional arguments to control behaviour.

These patches do the following major changes to the searching APIs:

1. The ASCII case-insensitive search method was split out as
   LowerCaseFindASCII, rather than using a boolean. This should be less
   error-prone and more explicit, and allows the method to continue to use
   narrow string literals for all string types (as only ASCII is supported).
2. The other [R]Find methods were restricted to only support arguments with
   matching character types. I considered adding a FindASCII method which would
   use narrow string literals for both wide and narrow strings but it would've
   been the same amount of work as changing all of the literals to unicode
   literals.
   This ends up being the bulk of the changes in the patch.
3. All find methods were re-implemented using std::basic_string_view's find
   algorithm or stl algorithms to reduce code complexity, and avoid the need to
   carry around the logic from nsStringObsolete.cpp.
4. The implementations were moved to nsTStringRepr.cpp.
5. An overload of Find was added to try to catch callers which previously
   called `Find(..., false)` or `Find(..., true)` to set case-sensitivity, due
   to booleans normally implicitly coercing to `index_type`. This should
   probably be removed at some point, but may be useful during the transition.

Differential Revision: https://phabricator.services.mozilla.com/D148300
2022-07-30 00:12:48 +00:00
Emilio Cobos Álvarez
0170e759f8 Bug 1779559 - Do this in toolkit instead. r=Gijs
This simplifies a bit the tabbrowser/tab switcher code, and makes it
work in all windows.

The WPT failures are due to bug 1780212.

Differential Revision: https://phabricator.services.mozilla.com/D151822
2022-07-19 19:25:48 +00:00
Cristian Tuns
02571b9d37 Backed out 5 changesets (bug 1779559) for causing wpt failures on unload-bubbles.html CLOSED TREE
Backed out changeset fbb29df4aa9e (bug 1779559)
Backed out changeset eab896a61170 (bug 1779559)
Backed out changeset 645bdd59bb99 (bug 1779559)
Backed out changeset 23fe4f24d483 (bug 1779559)
Backed out changeset a68a015349ed (bug 1779559)
2022-07-19 13:27:32 -04:00
Emilio Cobos Álvarez
e08e5475c4 Bug 1779559 - Do this in toolkit instead. r=Gijs
This simplifies a bit the tabbrowser/tab switcher code, and makes it
work in all windows.

Differential Revision: https://phabricator.services.mozilla.com/D151822
2022-07-19 09:43:06 +00:00
Doug Thayer
ded0196a2a Bug 1773310 - Don't run native menu code if headless r=mstange
So, the problem was just that in LoadNativeMenus, we do our cleanup of the
sLoadNativeMenusListeners list. However, we were also early exiting from that
function if we're in headless mode. We have no good reason to be in that
function to begin with if we're in headless mode though, so I just hoisted
the check out to an earlier point.

Differential Revision: https://phabricator.services.mozilla.com/D151929
2022-07-16 16:25:30 +00:00
Doug Thayer
46492ad747 Bug 1773310 - Init sHiddenWindowLoadedNativeMenus to false r=mconley,mstange
Differential Revision: https://phabricator.services.mozilla.com/D151528
2022-07-16 16:25:30 +00:00
Iulian Moraru
a590e34e55 Backed out changeset bdb3f95ed1fd (bug 1773310) for causing wdspec leaks (bug 1779170). CLOSED TREE 2022-07-15 15:17:16 +03:00
Doug Thayer
f2d9b5992c Bug 1773310 - Init sHiddenWindowLoadedNativeMenus to false r=mconley,mstange
Differential Revision: https://phabricator.services.mozilla.com/D151528
2022-07-11 17:09:18 +00:00
Tooru Fujisawa
52c95734e7 Bug 1667455 - Part 9: Stop importing Services.jsm from chrome-priv HTML code, single-line cases. r=kmag,necko-reviewers,geckoview-reviewers,extension-reviewers,m_kato,dragana
Differential Revision: https://phabricator.services.mozilla.com/D150898
2022-07-11 12:41:52 +00:00
Doug Thayer
bd1610b4c3 Bug 1773310 - Ensure hidden window native menus init first r=mstange
Differential Revision: https://phabricator.services.mozilla.com/D148699
2022-07-06 16:48:27 +00:00
Bogdan Szekely
d3c2f51d89 Merge autoland to mozilla-central. a=merge 2022-06-16 12:29:41 +03:00
Emilio Cobos Álvarez
7397449189 Bug 1774511 - Use more typed units in AppWindow. r=tnikkel
Doesn't change behavior but hopefully makes code easier to follow /
prove correct.

Differential Revision: https://phabricator.services.mozilla.com/D149462
2022-06-16 05:03:04 +00:00
Emilio Cobos Álvarez
c2622fb9ce Bug 1774408 - Don't use widget scale in AppWindow. r=tnikkel
This does fix the Pre-XUL skeleton UI scaling for me, but the others are
harmless and I can't repro the bug as described.

I _guess_ this can happen if you have window borders on Windows, since we were
mishandling those? But I don't know how to get those on Win10+.

The other scalings are symmetrical so they ended up working out in the end. In
any case this is the right thing to do and I'm ~sure it will fix the bug in the
reporter's configuration.

Differential Revision: https://phabricator.services.mozilla.com/D149449
2022-06-15 23:42:37 +00:00
Emilio Cobos Álvarez
ee23efc9b5 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
60ea7706bd Backed out changeset da5c71190673 (bug 1773813) for causing build bustages CLOSED TREE 2022-06-14 15:13:58 +03:00
Emilio Cobos Álvarez
c64d0fcaa6 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
criss
c6b2c5db61 Backed out 9 changesets (bug 1772006) causing build bustages on nsTString.cpp. CLOSED TREE
Backed out changeset f17c7565707b (bug 1772006)
Backed out changeset c725fe1f5882 (bug 1772006)
Backed out changeset d19663161261 (bug 1772006)
Backed out changeset b6611ab002d9 (bug 1772006)
Backed out changeset 790f42b64af9 (bug 1772006)
Backed out changeset 79a734b4e4d9 (bug 1772006)
Backed out changeset 42730aae16ea (bug 1772006)
Backed out changeset b2542aef3054 (bug 1772006)
Backed out changeset 962bfea4a309 (bug 1772006)
2022-06-11 01:13:42 +03:00
Nika Layzell
b3c13bf114 Bug 1772006 - Part 6: Simplify and move the string searching APIs from ns[T]StringObsolete, r=xpcom-reviewers,necko-reviewers,eeejay,dragana,barret
The biggest set of APIs from ns[T]StringObsolete which are still heavily used
are the string searching APIs. It appears the intention was for these to be
replaced by the `FindInReadable` APIs, however that doesn't appear to have
happened.

In addition, the APIs have some quirks around their handling of mixed character
widths. These APIs generally supported both narrow strings and the native
string type, probably because char16_t string literals weren't available until
c++11. Finally they also used easy-to-confuse unlabeled boolean and integer
optional arguments to control behaviour.

These patches do the following major changes to the searching APIs:

1. The ASCII case-insensitive search method was split out as
   LowerCaseFindASCII, rather than using a boolean. This should be less
   error-prone and more explicit, and allows the method to continue to use
   narrow string literals for all string types (as only ASCII is supported).
2. The other [R]Find methods were restricted to only support arguments with
   matching character types. I considered adding a FindASCII method which would
   use narrow string literals for both wide and narrow strings but it would've
   been the same amount of work as changing all of the literals to unicode
   literals.
   This ends up being the bulk of the changes in the patch.
3. All find methods were re-implemented using std::basic_string_view's find
   algorithm or stl algorithms to reduce code complexity, and avoid the need to
   carry around the logic from nsStringObsolete.cpp.
4. The implementations were moved to nsTStringRepr.cpp.
5. An overload of Find was added to try to catch callers which previously
   called `Find(..., false)` or `Find(..., true)` to set case-sensitivity, due
   to booleans normally implicitly coercing to `index_type`. This should
   probably be removed at some point, but may be useful during the transition.

Differential Revision: https://phabricator.services.mozilla.com/D148300
2022-06-10 21:12:08 +00:00
Emilio Cobos Álvarez
5e438354e2 Bug 1772432 - Fix Windows build bustage.
MANUAL PUSH: Trivial fix CLOSED TREE
2022-06-03 12:23:00 +02:00
Emilio Cobos Álvarez
b44d1c0376 Bug 1772432 - Clean up nsWidgetInitData. r=stransky
Use inline initializers, remove dead code, use consistent naming.

No behavior change.

Differential Revision: https://phabricator.services.mozilla.com/D148209
2022-06-03 09:41:39 +00:00