Closed Bug 1994908 Opened 3 months ago Closed 3 months ago

New windows open with a flash of a smaller rectangle in the content area, if the first window is maximized and has a remembered-unmaximized-size that's relatively small

Categories

(Core :: Layout, defect)

defect

Tracking

()

VERIFIED FIXED
146 Branch
Tracking Status
firefox-esr140 --- unaffected
firefox144 --- unaffected
firefox145 --- verified
firefox146 --- verified

People

(Reporter: dholbert, Assigned: emilio)

References

(Regression)

Details

(Keywords: regression)

Attachments

(7 files)

STR:

  1. Create a new directory (e.g. /tmp/foo) that contains just the following file, named xulstore.json (this is a reduced version of what I had in my own xulstore.json file):
{"chrome://browser/content/browser.xhtml":{"main-window":{"sizemode":"maximized","screenX":"0","screenY":"0","width":"500","height":"630"}}}
  1. Start Firefox using that directory as your Firefox profile (e.g. firefox -profile /tmp/foo)
  2. Open a new window in that Firefox session with Ctrl+N and watch carefully.
  3. Repeat step 3 several times.

ACTUAL RESULTS:
When your new window opens, it's maximized (per "sizemode":"maximized" in xulstore.json), BUT the initial paint of the maximized window has a weird rectangle that's roughly the size of the viewport that was specified in xulstore.json` (so in this case, 500px by 630px). This ends up looking like a weird rendering glitch/artifact.

EXPECTED RESULTS:
No such off-color rectangle.

ADDITIONAL RESULTS:

  • This reproduces in light mode as well as dark mode.
  • This is easy to reproduce without needing to hand-edit xulstore.json; that's just a shortcut. I'll post additional slighlty-longer STR in a later comment that don't require any json-crafting.
  • I'm testing using Firefox Nightly 146.0a1 (2025-10-16) (64-bit) on Ubuntu 24.04
  • Not sure yet what component this belongs in; starting in Widget for now. I haven't tested any platforms beyond Linux as of yet.

STR that don't require you to mess with profile contents or JSON:

  1. Start Firefox with a fresh profile.
  2. Shrink your Firefox window to be relatively small.
  3. Click the Maximize button on your Firefox window.
  4. Open a new window (Ctrl + N) and watch carefully.
  5. Repeat step 4.

Actual/expected results are the same as in comment 0.

(Steps 1-3 here are equivalent to steps 1-2 in comment 0).

Here's a screencast starting with a completely fresh profile, using a light OS color-scheme preference. When the bug happens here, there's a smaller white square and a larger light-gray background for the rest of the window.

Here's a screenshot from t=13s in my just-attached screencast, showing the unwanted rendering. Note that the top-left corner of the viewport is a lighter shade of white from the light-gray in the rest of the window.

Attachment #9520657 - Attachment description: screenshot showing the misrendering → screenshot showing a moment with the misrendering (with light color-scheme)

Here's a screencast of how this looks with a dark color-scheme (where the color-difference is much more pronounced and hence this is much more noticeable/annoying).

Summary: New windows open with a flash of a discolored rectangle, if If a user's xulstore.json reflects that they prefer maximized windows → New windows open with a flash of a smaller rectangle in the content area, if the first window is maximized and has a remembered-unmaximized-size that's relatively small

(In reply to Daniel Holbert [:dholbert] from comment #0)

  • Not sure yet what component this belongs in; starting in Widget for now. I haven't tested any platforms beyond Linux as of yet.

Since this is only confirmed on Linux for now let's start with Widget:Gtk and expand as appropriate.

Component: Widget → Widget: Gtk

Pernosco recording (where I start Firefox, with the first window maximized; then I do Ctrl+N and see this bug in the new window)
https://pernos.co/debug/S9w484xgPxb3iHwhSmGz6Q/index.html

(I have a nagging feeling that there might already be a bug on this too, that I interacted with at some point in the past, when using a device where I had Firefox ~always maximized. Though it's possible the symptoms have evolved a bit.)

Is that a recent regression? Can you use mozregression to find broken commit?
Thanks.

Flags: needinfo?(dholbert)

I think it is, yeah. I'll bisect later today.

Component: Widget: Gtk → Layout
Flags: needinfo?(dholbert)
Keywords: regression
Regressed by: 1993570

(In reply to Daniel Holbert [:dholbert] from comment #0)

  • Not sure yet what component this belongs in [...] I haven't tested any platforms beyond Linux as of yet.

I tested on macOS now and confirms it repro's there, too, though I need slightly different steps.

My STR there are:

  1. Start with a profile that contains the same xulstore.json file as in comment 0.
  2. Open a new window (Cmd+N)
  3. Maximize that new window (click green button) to fill the display.
  4. Open more new windows by holding Cmd and mashing N.

ACTUAL RESULTS:
The new windows that open in step 4 will suffer from this problem, in a way that's worse than shown on linux - Firefox's own toolbar-UI (hamburger menu, etc) gets squished to fit the small rectangle as well, in the brief mis-rendering.

Set release status flags based on info from the regressing bug 1993570

:emilio, since you are the author of the regressor, bug 1993570, could you take a look? Also, could you set the severity field?

For more information, please visit BugBot documentation.

Flags: needinfo?(emilio)

I can reproduce on Windows 11 as well (using STR from comment 0), FWIW; so this is not platform-specific.

Triaging as S2 given that this is a fairly-visible cross-platform rendering glitch (and given that it's a new regression not yet shipped to release, rather than a longstanding behavior).

Severity: -- → S2

The problem is that we're painting an about:blank document which hasn't
been laid out yet (there's no root frame).

In that case, we used to get a widget from the view tree, but now we
don't.

Introduce PresShell::GetNearestWidget(), and use it to get the closest
widget if there's no root frame so that we don't paint an opaque
backdrop incorrectly.

Assignee: nobody → emilio
Status: NEW → ASSIGNED

If you could confirm on macOS that this also fixes the issue there (I don't see why not but...) that'd be great.

Thanks!

Flags: needinfo?(emilio) → needinfo?(dholbert)
Duplicate of this bug: 1995370

Thanks for the fix!

(In reply to Emilio Cobos Álvarez [:emilio] from comment #19)

If you could confirm on macOS that this also fixes the issue there (I don't see why not but...) that'd be great.

Sure, I'll rebuild with the patch on macOS to double-check.

Actually, the macOS bad-rendering shown in comment 14 is partly this, and partly an older regression:
(A) The severe dark-/light-gray differentiation is this bug here.
(B) The fact that we're squashing the hamburger-menu & location bar to fit that squished area is an older regression. [bisecting that now]

I imagine (and will confirm) that your patch fixes (A) but not the older (B) issue there. I'll file a bug for (B) once I've got a range for that.

Filed bug 1995424 on (B) from comment 22.

See Also: → 1995424
Pushed by ealvarez@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/0295e6c095d8 https://hg.mozilla.org/integration/autoland/rev/26f9db4da1ba Use nearest pres shell widget in ComputeBackstopColor if there's no frame. r=layout-reviewers,dshin

I built without & with this patch on macOS, and confirmed that the patch fixes (A) from comment 22. With this patch, the brief misrendering goes back to looking as it did before this regressed, i.e. it goes back to looking like the screenshot in bug 1995424 comment 2. Still two different gray colors, but not as severely-different as in comment 14.

Flags: needinfo?(dholbert)
Status: ASSIGNED → RESOLVED
Closed: 3 months ago
Resolution: --- → FIXED
Target Milestone: --- → 146 Branch

The patch landed in nightly and beta is affected.
:emilio, is this bug important enough to require an uplift?

For more information, please visit BugBot documentation.

Flags: needinfo?(emilio)
Flags: needinfo?(sheriffs)
Flags: needinfo?(emilio)

^

Flags: needinfo?(pascalc)

(In reply to Emilio Cobos Álvarez [:emilio] from comment #29)

Can we back out https://hg-edge.mozilla.org/integration/autoland/rev/160d4122399e6be7adec23b507ba7c1510f809c7 from beta only?

Reverted in https://github.com/mozilla-firefox/firefox/commit/286ce97ccb75d4a9f004e98266324e61e1e0c8a7

I am marking 145 as fixed in this bug by this backout.

Flags: needinfo?(pascalc)
Flags: needinfo?(sheriffs)

Can QA confirm that 145 is fixed? https://github.com/i3roly/firefox-dynasty/issues/85#issuecomment-3482285472 claims it's not fixed but I can't repro on 145.0b9

Flags: needinfo?(pascalc)
Flags: needinfo?(pascalc) → qe-verify+
QA Whiteboard: [uplift] [qa-ver-needed-c146/b145]

I’ve reproduced the issue on Firefox 145.0b3 on Windows 10. I verified the fix on Windows 10, Ubuntu 22.04 and macOS 15 using Nightly 146.0a1 and Firefox 145.0b9 following the STR from Comment 0 and Comment 1. The issue no longer occurs on Windows 10 and Ubuntu 22.04, but on macOS, following the STR from Comment 12 (maximizing the window using the green button and then opening new windows with Cmd + N), the flash still appears. Please see the recording for reference.
@Daniel, is the macOS issue related to Comment 22 which will be addressed in a separate bug? I'll update the flags accordingly after this confirmation.

QA Whiteboard: [uplift] [qa-ver-needed-c146/b145] → [uplift] [qa-ver-done-c146/b145]
Flags: qe-verify+ → needinfo?(dholbert)
QA Contact: epopescu

(In reply to Ina Popescu, Desktop QA from comment #33)

but on macOS, following the STR from Comment 12 (maximizing the window using the green button and then opening new windows with Cmd + N), the flash still appears. Please see the recording for reference.
@Daniel, is the macOS issue related to Comment 22 which will be addressed in a separate bug? I'll update the flags accordingly after this confirmation.

Thanks! Yeah, the macOS issue shown in your screencast is covered by bug 1995424. It matches my screenshot / screencast in bug 1995424 comment 1 and bug 1995424 comment 2, and it's not expected to be fixed by the patch that landed here.

(This bug here was responsible for a much-more-severe color-difference as shown in bug 1994908 comment 14; and your screenshot doesn't show that severe difference, which is good news.)

Flags: needinfo?(dholbert)

(In reply to Daniel Holbert [:dholbert] from comment #34)

(In reply to Ina Popescu, Desktop QA from comment #33)

but on macOS, following the STR from Comment 12 (maximizing the window using the green button and then opening new windows with Cmd + N), the flash still appears. Please see the recording for reference.
@Daniel, is the macOS issue related to Comment 22 which will be addressed in a separate bug? I'll update the flags accordingly after this confirmation.

Thanks! Yeah, the macOS issue shown in your screencast is covered by bug 1995424. It matches my screenshot / screencast in bug 1995424 comment 1 and bug 1995424 comment 2, and it's not expected to be fixed by the patch that landed here.

(This bug here was responsible for a much-more-severe color-difference as shown in bug 1994908 comment 14; and your screenshot doesn't show that severe difference, which is good news.)

Thanks for confirming! Updating the flags accordingly now.

Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: