chromiumembedded / cef

Chromium Embedded Framework (CEF). A simple framework for embedding Chromium-based browsers in other applications.
https://bitbucket.org/chromiumembedded/cef/
Other
3.28k stars 456 forks source link

mac: Fullscreen window exit doesn't properly update CSS elements #3597

Closed magreenblatt closed 11 months ago

magreenblatt commented 11 months ago

Describe the bug Exiting fullscreen mode via the green traffic light (window) button doesn't remove the ::backdrop pseudo-element or :fullscreen pseudo-class as expected.

To Reproduce Steps to reproduce the behavior:

  1. Run cefclient --enable-chrome-runtime --url=https://davidwalsh.name/demo/fullscreen.php
  2. Fullscreen the window using the green traffic light button.
  3. Click the "Launch Fullscreen" button. Background turns pink.
  4. Restore the window using the green traffic light button. Background stays pink.

Expected behavior The background should turn white after step 4 (":fullscreen" pseudo-class and "top-layer" indicator should be removed).

Screenshots image

Versions (please complete the following information):

Additional context The problem reproduces with CEF Chrome and Alloy runtime. The problem does not reproduce with Google Chrome.

magreenblatt commented 11 months ago

The problem does not reproduce with cefsimple --enable-chrome-runtime --url=https://davidwalsh.name/demo/fullscreen.php (full Chrome UI). In that case we get a call to FullscreenController::ExitFullscreenModeForTab via:

  * frame #0: 0x00000001d3320bb3 Chromium Embedded Framework`FullscreenController::ExitFullscreenModeForTab(this=0x00007fc95c067b68, web_contents=0x00007fc95c975000) at fullscreen_controller.cc:242:29
    frame #1: 0x00000001d3296508 Chromium Embedded Framework`Browser::ExitFullscreenModeForTab(this=0x00007fc95c85b600, web_contents=0x00007fc95c975000) at browser.cc:2143:55
    frame #2: 0x00000001b7c0b637 Chromium Embedded Framework`content::WebContentsImpl::ExitFullscreenMode(this=0x00007fc95c975000, will_cause_resize=false) at web_contents_impl.cc:3774:16
    frame #3: 0x00000001b7c1f4b5 Chromium Embedded Framework`content::WebContentsImpl::ExitFullscreen(this=0x00007fc95c975000, will_cause_resize=false) at web_contents_impl.cc:5895:3
    frame #4: 0x00000001d3321fe9 Chromium Embedded Framework`FullscreenController::NotifyTabExclusiveAccessLost(this=0x00007fc95c067b68) at fullscreen_controller.cc:449:19
    frame #5: 0x00000001d332139e Chromium Embedded Framework`FullscreenController::WindowFullscreenStateChanged(this=0x00007fc95c067b68) at fullscreen_controller.cc:361:5
    frame #6: 0x00000001d328f4b0 Chromium Embedded Framework`Browser::WindowFullscreenStateChanged(this=0x00007fc95c85b600) at browser.cc:1088:9
    frame #7: 0x00000001d3dbfb96 Chromium Embedded Framework`BrowserView::FullscreenStateChanged(this=0x00007fc95c879400) at browser_view.cc:2018:13
    frame #8: 0x00000001d3026ae4 Chromium Embedded Framework`BrowserFrameMac::OnWindowFullscreenTransitionComplete(this=0x0000600002842260) at browser_frame_mac.mm:179:18
    frame #9: 0x00000001ca29c99b Chromium Embedded Framework`views::NativeWidgetMacNSWindowHost::OnWindowFullscreenTransitionComplete(this=0x00007fc95c476530, actual_fullscreen_state=false) at native_widget_mac_ns_window_host.mm:1190:23
    frame #10: 0x00000001c3d25d20 Chromium Embedded Framework`remote_cocoa::NativeWidgetNSWindowBridge::FullscreenControllerTransitionComplete(this=0x00007fc95c147030, is_fullscreen=false) at native_widget_ns_window_bridge.mm:1326:10
    frame #11: 0x00000001c3d4e6a8 Chromium Embedded Framework`remote_cocoa::NativeWidgetNSWindowFullscreenController::OnWindowDidExitFullscreen(this=0x00007fc95c147128) at native_widget_ns_window_fullscreen_controller.mm:223:14
    frame #12: 0x00000001c3d3a427 Chromium Embedded Framework`-[ViewsNSWindowDelegate windowDidExitFullScreen:](self=0x0000600001603240, _cmd="windowDidExitFullScreen:", notification="NSWindowDidExitFullScreenNotification") at views_nswindow_delegate.mm:275:36
magreenblatt commented 11 months ago

For Alloy, we'll need to call WebContents::ExitFullscreen.

magreenblatt commented 11 months ago

Filed https://bugs.chromium.org/p/chromium/issues/detail?id=1500371 for a related issue with Google Chrome 119.0.6045.105 (Official Build)

magreenblatt commented 11 months ago

Fixing this issue involves the following changes:

Which supports the desired behavior:

[1] Chrome examples:

Restore to window fullscreen.

  1. Run cefclient --enable-chrome-runtime --url=https://tests/window to start as a normal window with white background.
  2. Click the "Toggle Window Fullscreen" button. Window is fullscreen with white background (window fullscreen)
  3. Click the "Toggle Browser Fullscreen" button. Window is fullscreen with pink background (browser fullscreen)
  4. Click the "Toggle Browser Fullscreen" button. Window is restored to state 2 (window fullscreen with white background).

Restore to normal window.

  1. Run cefclient --enable-chrome-runtime --url=https://tests/window to start as a normal window with white background.
  2. Click the "Toggle Browser Fullscreen" button. Window is fullscreen with pink background (browser fullscreen)
  3. Click the "Toggle Window Fullscreen" or "Toggle Browser Fullscreen" button. Window is restored to state 1 (normal window with white background).

[2] Alloy examples:

Restore to normal window.

  1. Run cefclient --use-views --url=https://tests/window
  2. Click the "Toggle Window Fullscreen" button. Window is fullscreen with white background (window fullscreen)
  3. Click the "Toggle Browser Fullscreen" button. Window is fullscreen with pink background (browser fullscreen)
  4. Click the "Toggle Browser Fullscreen" button. Window is restored to state 1 (normal window with white background).

Restore to normal window.

  1. Run cefclient --use-views --url=https://tests/window
  2. Click the "Toggle Browser Fullscreen" button. Window is fullscreen with pink background (browser fullscreen)
  3. Click the "Toggle Window Fullscreen" or "Toggle Browser Fullscreen" button. Window is restored to state 1 (normal window with white background).