The macOS Profile Manager (toolkit/profile/content/profileSelection.xhtml) and the Create Profile wizard (createProfileWizard.xhtml) are presented very early in startup, before the hidden window is created, and ship with no <menubar> of their own. As a result the system menu bar shows only the auto-populated "Firefox" application menu while either window is up. The wizard can open a native NSOpenPanel sheet via its "Choose Folder..." button and from there a "New Folder" sub-sheet, which is the canonical reproducer for the bug: without a parent <menubar>, the sub-sheet's text field has no key equivalents to invoke, so Cmd+V (and the other Edit menu shortcuts) don't reach the field via the macOS responder chain.
This patch:
* Adds a `<menubar>` to both windows containing the standard Edit menu items, wrapped in `#ifdef XP_MACOSX` so non-macOS platforms don't gain a visible in-window menu strip. The menubar fragment lives in a new shared include, `toolkit/content/editMenubar.inc.xhtml`, which is consumed by both call sites. It pulls in the existing toolkit `editMenuKeys.inc.xhtml` for the shortcut <key> nodes; each consumer also loads `editMenuOverlay.js` for the matching <command> set.
* Marks both xhtml files for preprocessing (`*` prefix in toolkit/profile/jar.mn) so the `#ifdef` / `#include` directives are resolved at packaging time, and adds them to .prettierignore so Prettier doesn't collapse adjacent preprocessor directives.
* Adds a `profile-window-menu-edit` Fluent string in toolkit/locales/en-US/toolkit/global/textActions.ftl, co-located with the existing `text-action-*` strings the new menubar already references for its child menu items. The ID names the Edit menu in its profile-window use case, rather than placing it in the `text-action-*` namespace where every sibling string is an action item rather than the menu that contains them.
* Updates AppWindow::OnChromeLoaded() in xpfe/appshell/AppWindow.cpp so that native menu loading is no longer indefinitely queued waiting for the hidden window in flows where no hidden window will be created. Without this, the Profile Manager and wizard windows hit OnChromeLoaded with `sWaitingForHiddenWindowToLoadNativeMenus = true` and queue themselves into a list that no one drains until normal startup runs `createHiddenWindow`, which happens only after the Profile Manager dialog returns. The workaround is to check `nsIAppShellService::hasHiddenWindow` at OnChromeLoaded time: if no hidden window exists by then, none is coming, and we can proceed with native menu setup.
With this, the wizard's New Folder sub-sheet (and the Profile Manager's own modal sub-prompts, e.g. Rename Profile) get a real parent Edit menu, AppKit's responder chain dispatches Cmd+C/V/X/Z correctly into the sheet's NSText field, and the system menu bar shows the Edit menu while either window is up.
Depends on bug 2040844 (the ChildView undo:/redo: overrides) and bug 2040851 (don't mirror the XUL command disabled state to the NSMenuItem for standard Edit menu items) so that the menu-bar shortcuts, not just paste, work and stay enabled inside native sheets.
Differential Revision: https://phabricator.services.mozilla.com/D301466
Default resizable titled top-level windows to FullScreenPrimary +
FullScreenAllowsTiling so the green window-control button keeps its
fullscreen-enter arrows; non-resizable titled windows default to
FullScreenAuxiliary + FullScreenDisallowsTiling. SetSupportsNativeFullscreen
sets all four bits consistently so AppKit never falls back to the
non-deterministic _implicitlyAllowsFullScreenPrimary heuristic that
caused the bug 2031249 crash.
In AppWindow.cpp, only call SetSupportsNativeFullscreen when the XUL
macnativefullscreen attribute is actually present, and read its value as
a boolean. With HasAttribute as the previous gate, windows without the
attribute were forced to FullScreenAuxiliary, which would regress the
zoom button to '+' on every XHTML window that doesn't carry the
attribute (only two do today). Leaving them at the creation-time default
preserves the existing fullscreen UX without requiring per-window XHTML
edits.
Differential Revision: https://phabricator.services.mozilla.com/D301471
Default resizable titled top-level windows to FullScreenPrimary +
FullScreenAllowsTiling so the green window-control button keeps its
fullscreen-enter arrows; non-resizable titled windows default to
FullScreenAuxiliary + FullScreenDisallowsTiling. SetSupportsNativeFullscreen
sets all four bits consistently so AppKit never falls back to the
non-deterministic _implicitlyAllowsFullScreenPrimary heuristic that
caused the bug 2031249 crash.
In AppWindow.cpp, only call SetSupportsNativeFullscreen when the XUL
macnativefullscreen attribute is actually present, and read its value as
a boolean. With HasAttribute as the previous gate, windows without the
attribute were forced to FullScreenAuxiliary, which would regress the
zoom button to '+' on every XHTML window that doesn't carry the
attribute (only two do today). Leaving them at the creation-time default
preserves the existing fullscreen UX without requiring per-window XHTML
edits.
Differential Revision: https://phabricator.services.mozilla.com/D301471
The changeset has been generated automatically through:
./mach static-analysis check --output ./clang-tidy-bugprone.json --format json --fix
followed by manual adjustment when needed or when the auto-fixer bailed out.
This paves the way for Bug 2023527
Differential Revision: https://phabricator.services.mozilla.com/D287941
The changeset has been generated automatically through:
./mach static-analysis check --output ./clang-tidy-bugprone.json --format json --fix
followed by manual adjustment when needed or when the auto-fixer bailed out.
This paves the way for Bug 2023527
Differential Revision: https://phabricator.services.mozilla.com/D287941
Set IsDocumentPiP immediately after creating the chrome window, instead of
after the browser chrome loads. This ensures browser CSS immediately gets the
picture-in-picture display-mode.
Differential Revision: https://phabricator.services.mozilla.com/D276863
Bug 543435 changed nsDocShell::Initialize from always returning true to
returning whether CreateInitialDocumentViewer succeeded. If this fails,
it is propagated up to ContentChild::RecvConstructBrowser where we crash.
The call to CreateDocumentViewerForActor that existed before bug 543435 in
nsWebBrowser::Create would've failed silently.
This commit restores avoids a crash by restoring the silent failure.
Differential Revision: https://phabricator.services.mozilla.com/D277765
To improve perceived performance, bug 1336227 showed a blank window early after
start-up. Bug 543435 (sync-about-blank) broke this because the navigation for
the initial about:blank cannot be stopped. win.stop() wouldn't cause a state
stop and to prevent the completing load from breaking other code, we loaded
nothing at all.
This commit introduces a more explicit method to show the initial document.
Differential Revision: https://phabricator.services.mozilla.com/D277151
Implement a basic UI/UX for Document Picture-in-Picture.
- The opener URI is shown in the PiP window's location bar.
- Fullscreen via F11 and session restore are blocked for PiP windows.
Differential Revision: https://phabricator.services.mozilla.com/D267248
This changes the widget size constraints to be applied once per frame
before painting (like popups), but that seems acceptable.
Differential Revision: https://phabricator.services.mozilla.com/D272831
This changes the widget size constraints to be applied once per frame
before painting (like popups), but that seems acceptable.
Differential Revision: https://phabricator.services.mozilla.com/D272831
It is replaced by a standard-conforming cast to (void) which is
understood the same by the compiler.
In some cases this could be replaced by `[[maybe_unused]]` but for
expression whose value is ignored, this requires storing to a temporary
variable first, so not going that way.
One notable change is that marking an object of type already_AddRefed as
unused used to implicitly leak memory. This is now made explicit.
Most of the heavy lifting was done through:
$ git grep -l '\<Unused\> <<' | xargs sed -i -e 's/Unused << /(void)/g'
$ git grep -l mozilla/Unused.h | xargs sed -i -e '/mozilla\/Unused.h/ d'
Differential Revision: https://phabricator.services.mozilla.com/D268706
It is replaced by a standard-conforming cast to (void) which is
understood the same by the compiler.
In some cases this could be replaced by `[[maybe_unused]]` but for
expression whose value is ignored, this requires storing to a temporary
variable first, so not going that way.
One notable change is that marking an object of type already_AddRefed as
unused used to implicitly leak memory. This is now made explicit.
Most of the heavy lifting was done through:
$ git grep -l '\<Unused\> <<' | xargs sed -i -e 's/Unused << /(void)/g'
$ git grep -l mozilla/Unused.h | xargs sed -i -e '/mozilla\/Unused.h/ d'
Differential Revision: https://phabricator.services.mozilla.com/D268706
It is replaced by a standard-conforming cast to (void) which is
understood the same by the compiler.
In some cases this could be replaced by `[[maybe_unused]]` but for
expression whose value is ignored, this requires storing to a temporary
variable first, so not going that way.
One notable change is that marking an object of type already_AddRefed as
unused used to implicitly leak memory. This is now made explicit.
Most of the heavy lifting was done through:
$ git grep -l '\<Unused\> <<' | xargs sed -i -e 's/Unused << /(void)/g'
$ git grep -l mozilla/Unused.h | xargs sed -i -e '/mozilla\/Unused.h/ d'
Differential Revision: https://phabricator.services.mozilla.com/D268706
It is replaced by a standard-conforming cast to (void) which is
understood the same by the compiler.
In some cases this could be replaced by `[[maybe_unused]]` but for
expression whose value is ignored, this requires storing to a temporary
variable first, so not going that way.
One notable change is that marking an object of type already_AddRefed as
unused used to implicitly leak memory. This is now made explicit.
Most of the heavy lifting was done through:
$ git grep -l '\<Unused\> <<' | xargs sed -i -e 's/Unused << /(void)/g'
$ git grep -l mozilla/Unused.h | xargs sed -i -e '/mozilla\/Unused.h/ d'
Differential Revision: https://phabricator.services.mozilla.com/D268706
We no longer have child windows which means that all widgets use desktop
pixels. Make the type system enforce that.
We want to start storing coordinates in DesktopPixels for GTK, to deal
correctly with fractional scaling, so move mBounds to the relevant
subclasses.
There's no behavior change. Some of the changes uncover coordinate
system confusions in Windows that I plan to fix in followups.
Android / iOS / PuppetWidgets don't care about the coordinate
differences, because their DesktopToLayoutDeviceScale is 1.0. Still I
made puppet widgets go through the coordinate conversion because it
seemed easier than casting or what not.
Differential Revision: https://phabricator.services.mozilla.com/D269091
widget/cocoa was already dereferencing without checking. There were two
callers with null init data which were for headless / puppet widgets,
but this is clearer.
Differential Revision: https://phabricator.services.mozilla.com/D268978
Avoid having to create an NSWindow, which is expensive, by performing
two changes:
* Compute titlebar layout direction per document, instead of globally.
* Make the unified toolbar looks work by removing the titlebar
separator (macos 11.0+), instead of having to know how tall the
titlebar is. It might look a bit funky on older macOS but I think we
should be able to live with that, 11.0 is big sur which has been
around for a while now...
This avoids the contention here (plus our regular windows are not titled
so they shouldn't need to grab that lock at that point at least).
Differential Revision: https://phabricator.services.mozilla.com/D260561
Allow to use the nonnative attribute to exclude them from the native
menu code. This will be used by the places window which is currently
working around this by creating a totally different DOM on macOS.
This doesn't even work on Linux if you enable the (disabled by default
but on the works) native menu support.
Differential Revision: https://phabricator.services.mozilla.com/D259793
AppWindow::GetMainWidget() is just mWindow. Add a helper to simplify
GetMainWidget() usage and use it across the tree, simplifying users.
Differential Revision: https://phabricator.services.mozilla.com/D258744
Bug 1902315 removed a PlaceBehind call here, which in this case happened
to also activate the window (via the aActivate = true parameter).
Keep raising the window manually, but with simpler APIs.
Differential Revision: https://phabricator.services.mozilla.com/D258743
There's a Gnome Kiosk [1] compositor which allows to set window position,
size and state during start. Firefox restoring state conflicts with
this feature. This patch adds browser.restoreWindowState.disabled preference
which disables the state restoration for this case.
[1] https://github.com/GNOME/gnome-kiosk
Differential Revision: https://phabricator.services.mozilla.com/D249071
This patch reuses the existing but unused `mWindowless` flag. The flag is now
propagated to the BrowsingContext created under the windowless browser.
Differential Revision: https://phabricator.services.mozilla.com/D238584
I stumbled upon this bug while realizing that some of the math I'm doing
for PiP windows doesn't work at all on Linux (bug 1934760), because
screenX != mozInnerScreenX, even though outerWidth == innerWidth.
I've tested this on X11 and Wayland (plasma and Gnome) with CSD and SSD,
and in general, this is the same thing Windows does, so should be fine.
The basic idea is:
* Keep mBounds being frame manager bounds (so, outer* and screen*),
relative to mShell.
* Keep mClientMargin to translate from mBounds to client bounds.
This is both simpler and makes the math consistent.
Differential Revision: https://phabricator.services.mozilla.com/D230981
Otherwise windows we want to be fully transparent get a backdrop, or
windows that don't have a tab list get the wrong backdrop (bug 1934140).
Differential Revision: https://phabricator.services.mozilla.com/D236372