Closed Bug 1823284 Opened 2 years ago Closed 2 years ago

Widget minimization on windows exits DOM fullscreen. (was: Problem with Youtube full screen at version 111.0)

Categories

(Core :: DOM: Core & HTML, defect)

Firefox 111
defect

Tracking

()

VERIFIED FIXED
114 Branch
Tracking Status
firefox-esr102 --- unaffected
firefox111 --- wontfix
firefox112 --- wontfix
firefox113 --- verified
firefox114 --- verified

People

(Reporter: firefoxy, Assigned: edgar)

References

(Regression)

Details

(Keywords: nightly-community, regression)

Attachments

(2 files, 2 obsolete files)

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/111.0

Steps to reproduce:

Opened Youtube played any video with fullscreen , then used Win+D shortcut to return to desktop , after then returned back to the Firefox

Actual results:

Menu and address bar is hidden unless you move cursor

Expected results:

It should be as it was last time ( works at v110 btw )

The Bugbug bot thinks this bug should belong to the 'Core::Audio/Video: Playback' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.

Component: Untriaged → Audio/Video: Playback
Product: Firefox → Core
Status: UNCONFIRMED → NEW
Component: Audio/Video: Playback → Widget: Win32
Ever confirmed: true

This is reproduced not only in Youtube videos, but also in stand-alone videos.

Bad build:
Browser sizemode becomes window fullscreen instead of video fullscreen.
Taskbar is not hidden (This is an old bug and seems unrelated to this one.).

Good build:
video fullscreen is restored.
Taskbar is not hidden (this is an old bug).

Regression window:
https://hg.mozilla.org/integration/autoland/pushloghtml?fromchange=baf3448d460ba11e7118acca260e9781f9d29259&tochange=0577733e69fa9efbcac58d9ad61995e2b72b7a66

Regressed by: 1809757

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

For more information, please visit auto_nag documentation.

Flags: needinfo?(emilio)

So from the widget point of view this looks roughly as expected, in the sense that we're sending the right messages:

  • The window is minimized, so we send an willexitfullscreen message, then exit fullscreen.
  • Then it's restored, so we send an willenterfullscreen, then enter fullscreen.

It seems when we exit widget fullscreen we also exit DOM fullscreen, but we don't restore this.

So all-in-all I'd expect other platforms to behave like this as well.

Minimal STR:

We could go back to omitting some of those minimize / restore pairs (which is what the early-returns in fullscreen were doing), but that feels wrong on the widget side at least.

Flags: needinfo?(emilio)

(In reply to Emilio Cobos Álvarez (:emilio) from comment #4)

It seems when we exit widget fullscreen we also exit DOM fullscreen,

Yes, when widget exits fullscreen, we also exit DOM fullscreen.

but we don't restore this.

I am not sure if we want to restore the DOM fullscreen as we could not tell the willexitfullscreen/willenterfullscreen message is caused by minimizing/restoring window or user press F11 explicitly to exit/enter browser fullscreen. Furthermore, Chrome doesn't exit DOM fullscreen while window is minimized.

Summary: Problem with Youtube full screen at version 111.0 → Widget minimization on windows exits DOM fullscreen. (was: Problem with Youtube full screen at version 111.0)
Duplicate of this bug: 1824615

(In reply to Emilio Cobos Álvarez (:emilio) from comment #4)

So from the widget point of view this looks roughly as expected, in the sense that we're sending the right messages:

  • The window is minimized, so we send an willexitfullscreen message, then exit fullscreen.
  • Then it's restored, so we send an willenterfullscreen, then enter fullscreen.

(In reply to Edgar Chen [:edgar] from comment #5)

Furthermore, Chrome doesn't exit DOM fullscreen while window is minimized.

I think I agree with Chrome's behavior here. As far as the content is concerned — and possibly even the chrome, outside of TaskbarConcealer — minimizing shouldn't affect the fullscreen state.

(In reply to Emilio Cobos Álvarez (:emilio) from comment #4)

So all-in-all I'd expect other platforms to behave like this as well.

And indeed (as seen in the recently-merged duplicate bug), this also happens on Gtk. :emilio, should this be DOM: Core & HTML?

Severity: -- → S3
Priority: -- → P3
Component: Widget: Win32 → DOM: Core & HTML

The component has been changed since the backlog priority was decided, so we're resetting it.
For more information, please visit auto_nag documentation.

Priority: P3 → --

To carry over information from the now-duplicate bug, and post some new findings:

My read here is that there seem to be two seperate bugs/changesets causing the same regression at different times on different platforms.

on LINUX, mozregression yielded:
https://hg.mozilla.org/integration/autoland/pushloghtml?fromchange=81c9cc81146b08ed739c7218b206d4bcfed1d9b3&tochange=bf01dc27a9f3cad7d59ec3c65cd007b1338ba474
as the culprit. the issue seems to have existed there for a long time. I know emilio said he doesnt think its the cause but that was the conclusion of my tests with mozregression.

on WINDOWS, mozregression yielded:
https://hg.mozilla.org/integration/autoland/rev/0577733e69fa9efbcac58d9ad61995e2b72b7a66
as the cause, and the regression is much more recent.

I'd confirm this by building without those changesets, but I cant for the life of me get the bootstrap script to work right now so that'll have to wait.
(as an aside, sorry for the dupe, but i literally seached full screen and this bug didnt show up :/)

The communication between the widget and the DOM side is through the FullscreenWillChange and FullscreenChanged callbacks. The DOM side uses these callbacks to synchronize its fullscreen state with the widget. This is necessary to handle cases where the user directly toggles the fullscreen state of the widget, for example, by using a keyboard shortcut for "Toggle fullscreen mode" defined in the platform settings on Linux.

However, from the DOM side, it is not possible to determine whether the callback was triggered by the user explicitly toggling the fullscreen state or by minimizing/restoring the window, so it may be more appropriate to handle this in the widget and possibly not notify the FullscreenWillChange and FullscreenChanged callbacks when the window is being minimized/restored. I will check whether that might cause any side effects.

Flags: needinfo?(echen)

So on Windows, Android, and GTK at least, FullscreenWillChange / FullscreenChanged seem rather useless as they're always basically synchronous around the SizeModeChanged.

We could pass the old sizemode to SizeModeChanged quite easily now I believe, and the DOM could avoid exiting fullscreen in from/to-minimized changes.

Edgar, would that not work for any reason I'm missing? Maybe we should tweak the cocoa notifications to behave like other platforms and remove some of the complexity here.

(In reply to Emilio Cobos Álvarez (:emilio) from comment #11)

Edgar, would that not work for any reason I'm missing? Maybe we should tweak the cocoa notifications to behave like other platforms and remove some of the complexity here.

Ah, okay. I think that should also work. Thanks! The FullscreenWillChange for native fullscreen on Cocoa happens at a different timing which is determined by the OS, but I think it should be fine to delay it a bit until we handle SizeModeChanged. I will try this on Cocoa first.

Cocoa behaves differently when minimizing in fullscreen. It exits fullscreen to a normal window and then minimizes (previously it did not allow minimizing while in fullscreen), but it notifies SizeModeChanged with nsSizeMode_Minimized directly. When restoring, it does not enter fullscreen again, and notifies SizeModeChanged with nsSizeMode_Normal.

DOM could detect that and sync DOM fullscreen state while get the nsSizeMode_Normal, but which means DOM will still be in fullscreen state when minimizing. Or maybe Cocoa could notify nsSizeMode_Normal when it returns to a normal window before minimizing, so that the DOM can sync the fullscreen state with the widget earlier.

Bradley, is there any specific reason for not notifying nsSizeMode_Normal in this case, or is it possible to have nsSizeMode_Normal notified before minimizing?

Flags: needinfo?(echen) → needinfo?(bwerth)

(In reply to Edgar Chen [:edgar] from comment #13)

Cocoa behaves differently when minimizing in fullscreen. It exits fullscreen to a normal window and then minimizes (previously it did not allow minimizing while in fullscreen), but it notifies SizeModeChanged with nsSizeMode_Minimized directly. When restoring, it does not enter fullscreen again, and notifies SizeModeChanged with nsSizeMode_Normal.

DOM could detect that and sync DOM fullscreen state while get the nsSizeMode_Normal, but which means DOM will still be in fullscreen state when minimizing. Or maybe Cocoa could notify nsSizeMode_Normal when it returns to a normal window before minimizing, so that the DOM can sync the fullscreen state with the widget earlier.

Bradley, is there any specific reason for not notifying nsSizeMode_Normal in this case, or is it possible to have nsSizeMode_Normal notified before minimizing?

I made Cocoa go straight to nsSizeMode_Minimized from fullscreen because I was working under the assumption that one JS call = one sizemodechange event. But we could instead adopt the idea that leaving fullscreen always generates a nsSizeMode_Normal and then maybe another sizemodechange if that's the destination. There's only one test that checks this, browser_fullscreen_from_minimize.js and it could be changed to expect two sizemode events for that transition.

Flags: needinfo?(bwerth)

:echen is there any update here?

Flags: needinfo?(echen)
Assignee: nobody → echen
Status: NEW → ASSIGNED
Attachment #9328087 - Attachment description: Bug 1823284 - Avoid waiting for window resizing if it is already at expected dimensions; → Bug 1823284 - Avoid waiting for window resizing if it is already at expected dimensions; r?smaug!
Attachment #9328088 - Attachment description: Bug 1823284 - [Cocoa] Allow Dispatching sizemodechange event for intermediate transition; → Bug 1823284 - [Cocoa] Allow Dispatching sizemodechange event for intermediate transition; r?bradwerth!
Attachment #9328089 - Attachment description: Bug 1823284 - Use `SizeModeChanged` notification to handle fullscreen change; → Bug 1823284 - Use `SizeModeChanged` notification to handle fullscreen change; r?smaug!,bradwerth!
Flags: needinfo?(echen)

This makes Cocoa windows behave similarly to other widget windows in that
restoring a minimized window will return it to its pre-minimized state. It
does this by inserting an intermediate transition to normal/windowed mode,
but that transition does not fire a sizemodechange event.

Attachment #9328088 - Attachment is obsolete: true
Duplicate of this bug: 1828127
Duplicate of this bug: 1828211
See Also: → 1828706

Comment on attachment 9328406 [details]
Bug 1823284 - [Cocoa] Make nsCocoaWindow restore minimized window to former state.

Revision D175384 was moved to bug 1828706. Setting attachment 9328406 [details] to obsolete.

Attachment #9328406 - Attachment is obsolete: true
Duplicate of this bug: 1828851
Pushed by echen@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/65747f283949 Avoid waiting for window resizing if it is already at expected dimensions; r=smaug https://hg.mozilla.org/integration/autoland/rev/54bce7b5d558 Use `SizeModeChanged` notification to handle fullscreen change; r=geckoview-reviewers,rkraesig,stransky,bradwerth,smaug,m_kato

Backed out for causing failures on element-request-fullscreen-timing.html, test_fullscreen-api.html

Backout link

Push with failures - mochitest
Failure log - mochitest

Push with failures - wpt
Failure log - wpt

Flags: needinfo?(echen)
Blocks: 1828910
Pushed by echen@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/a62bae7b4710 Avoid waiting for window resizing if it is already at expected dimensions; r=smaug https://hg.mozilla.org/integration/autoland/rev/84f653809273 Use `SizeModeChanged` notification to handle fullscreen change; r=geckoview-reviewers,rkraesig,stransky,bradwerth,smaug,m_kato
Flags: needinfo?(echen)
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 114 Branch

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

  • If yes, please nominate the patch for beta approval.
  • If no, please set status-firefox113 to wontfix.

For more information, please visit auto_nag documentation.

Flags: needinfo?(echen)
Duplicate of this bug: 1828910
Duplicate of this bug: 1828965

Comment on attachment 9328089 [details]
Bug 1823284 - Use SizeModeChanged notification to handle fullscreen change; r?smaug!,bradwerth!

Beta/Release Uplift Approval Request

  • User impact if declined: Document exits fullscreen after minimizing the window.
  • Is this code covered by automated tests?: Yes
  • Has the fix been verified in Nightly?: Yes
  • Needs manual test from QE?: No
  • If yes, steps to reproduce:
  • List of other uplifts needed: None
  • Risk to taking this patch: Medium
  • Why is the change risky/not risky? (and alternatives if risky): The patch doesn't involve many changes (mostly code removal), and there are many tests for fullscreen. However, since it needs to tweak each platform, I'm hesitant to set to low.
  • String changes made/needed: None
  • Is Android affected?: No
Flags: needinfo?(echen)
Attachment #9328089 - Flags: approval-mozilla-beta?
Attachment #9328087 - Flags: approval-mozilla-beta?

Comment on attachment 9328087 [details]
Bug 1823284 - Avoid waiting for window resizing if it is already at expected dimensions; r?smaug!

Approved for 113.0b9.

Attachment #9328087 - Flags: approval-mozilla-beta? → approval-mozilla-beta+
Attachment #9328089 - Flags: approval-mozilla-beta? → approval-mozilla-beta+
QA Whiteboard: [qa-triaged]

Verified as fixed on Windows 10 x64 and on Ubuntu 20.04 x64.

Status: RESOLVED → VERIFIED
QA Whiteboard: [qa-triaged]
Flags: qe-verify+
Regressions: 1830585
Regressions: 1830681
No longer regressions: 1829403
No longer regressions: 1830585
Regressions: 1830721
Regressions: 1832027
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: