electron/shell/browser/ui
michal-pichlinski-openfin 6953f5505f
refactor: remove InspectableWebContentsViewMac in favor of the Views version (#44628)
* refactor: remove InspectableWebContentsViewMac in favor of the Views version

* cherry-pick: refactor: remove InspectableWebContentsViewMac in favor of the Views version (#41326)

commit e67ab9a93d

Confilcts not resolved, except removal of the files removed
by the original commit.

* resolved conflicts and build issues after cherry-pick

* cherry-picked: fix: add method allowing to disable headless mode in native widget

https://github.com/electron/electron/pull/42996
fixing
https://github.com/electron/electron/issues/42995

* fix: displaying select popup in window created as fullscreen window

`constrainFrameRect:toScreen:` is not being call for windows created
with `fullscreen: true` therefore `headless` mode was not being removed
and `RenderWidgetHostNSViewBridge::DisplayPopupMenu` ignored displaying
popup.

Issue could be fixed by placing additional removal of `headless` mode
in the `toggleFullScreen:`, but `orderWindow:relativeTo:` is called
both for a regular and a fullscreen window, therefore there will be
a single place fixing both cases.

Because `electron::NativeWindowMac` lifetime may be shorter than
`ElectronNSWindow` on which macOS may execute `orderWindow:relativeTo:`
we need to clear `shell_` when `NativeWindow` is being closed.

Fixes #43010.

* fix: Content visibility when using `vibrancy`

We need to put `NSVisualEffectView` before `ViewsCompositorSuperview`
otherwise when using `vibrancy` in `BrowserWindow` `NSVisualEffectView`
will hide content displayed by the compositor.

Fixes #43003
Fixes #42336

In fact main issues reported in these tickets were not present after
cherry-picking original refactor switching to `views::WebView`, so
text could be selected and click event was properly generated. However
both issues testcases were using `vibrancy` and actual content was
invisible, because it was covered by the `NSVisualEffectView`.

* fix: EXCEPTION_ACCESS_VIOLATION crash on BrowserWindow.destroy()

Restored postponed deletion of the `NativeWindow`.

Restoration caused `DCHECK(new_parent_ui_layer->GetCompositor());` failure
in `BrowserCompositorMac::SetParentUiLayer` after the spec test:
`chrome extensions chrome.webRequest does not take precedence over Electron webRequest - http`
with stack:
```
7   Electron Framework 0x000000011fe07830 content::BrowserCompositorMac::SetParentUiLayer(ui::Layer*) + 628
8   Electron Framework 0x000000011fe0c154 content::RenderWidgetHostViewMac::SetParentUiLayer(ui::Layer*) + 220
9   Electron Framework 0x000000011fe226a8 content::WebContentsViewMac::CreateViewForWidget(content::RenderWidgetHost*) + 600
10  Electron Framework 0x000000011fd37e4c content::WebContentsImpl::CreateRenderWidgetHostViewForRenderManager(content::RenderViewHost*) + 164
11  Electron Framework 0x000000011fb32278 content::RenderFrameHostManager::CreateSpeculativeRenderFrame(content::SiteInstanceImpl*, bool, scoped_refptr<content::BrowsingContextState> const&) + 816
12  Electron Framework 0x000000011fb2ab8c content::RenderFrameHostManager::CreateSpeculativeRenderFrameHost(content::SiteInstanceImpl*, content::SiteInstanceImpl*, bool) + 1308
13  Electron Framework 0x000000011fb28598 content::RenderFrameHostManager::GetFrameHostForNavigation(content::NavigationRequest*, content::BrowsingContextGroupSwap*, std::__Cr::basic_string<char, std::__Cr::char_traits<char>, std::__Cr::allocator<char>>*) + 1796
14  Electron Framework 0x000000011fa78660 content::NavigationRequest::SelectFrameHostForOnRequestFailedInternal(bool, bool, std::__Cr::optional<std::__Cr::basic_string<char, std::__Cr::char_traits<char>, std::__Cr::allocator<char>>> const&) + 280
15  Electron Framework 0x000000011fa6a994 content::NavigationRequest::OnRequestFailedInternal(network::URLLoaderCompletionStatus const&, bool, std::__Cr::optional<std::__Cr::basic_string<char, std::__Cr::char_traits<char>, std::__Cr::allocator<char>>> const&, bo
+ 1008
16  Electron Framework 0x000000011fa7772c content::NavigationRequest::OnRequestFailed(network::URLLoaderCompletionStatus const&) + 72
17  Electron Framework 0x000000011f8554ac content::NavigationURLLoaderImpl::NotifyRequestFailed(network::URLLoaderCompletionStatus const&) + 248
```
This was probably the reason of removing `NativeWindow` immediately
in order to cleanup `views_host_` in `WebContentsViewMac` to prevent
using layer without compositor in `WebContentsViewMac::CreateViewForWidget`.

`[ElectronNSWindowDelegate windowWillClose:]` is deleting window host
and the compositor used by the `NativeWindow` therefore detach `NativeWindow`
contents from parent. This will clear `views_host_` and prevent failing
mentioned `DCHECK`.

Fixes #42975

* chore: Applied review suggestions

* refactor: directly cleanup shell

---------

Co-authored-by: Samuel Maddock <smaddock@slack-corp.com>
2025-01-17 10:21:10 -05:00
..
cocoa refactor: remove InspectableWebContentsViewMac in favor of the Views version (#44628) 2025-01-17 10:21:10 -05:00
gtk chore: more iwyu (#43063) 2024-07-29 12:42:57 -05:00
views refactor: remove InspectableWebContentsViewMac in favor of the Views version (#44628) 2025-01-17 10:21:10 -05:00
webui chore: bump chromium to 133.0.6920.0 (main) (#45055) 2025-01-10 10:52:34 -06:00
win chore: bump chromium to 132.0.6807.0 (main) (#44360) 2024-11-04 09:10:00 -05:00
x refactor: remove unused SetWMSpecState (#43347) 2024-08-19 17:15:19 -04:00
accelerator_util.cc chore: remove unused #includes (#42971) 2024-07-22 11:31:32 +02:00
accelerator_util.h chore: enable check raw ptr fields (#38167) 2023-05-11 16:07:39 -04:00
accelerator_util_unittests.cc chore: remove unused #includes (#42971) 2024-07-22 11:31:32 +02:00
autofill_popup.cc refactor: fix modernize-return-braced-init-list warnings (#44838) 2024-11-27 09:41:46 +09:00
autofill_popup.h fix: cyclical #include dependency between autofill_popup.h and autofill_popup_view.h (#44705) 2024-11-19 13:45:18 -06:00
certificate_trust.h chore: more iwyu (#43063) 2024-07-29 12:42:57 -05:00
certificate_trust_mac.mm chore: more iwyu (#43063) 2024-07-29 12:42:57 -05:00
certificate_trust_win.cc chore: more iwyu (#43063) 2024-07-29 12:42:57 -05:00
devtools_manager_delegate.cc refactor: return-braced-init-list pt 2 of 2 (#44870) 2024-11-29 11:44:33 -06:00
devtools_manager_delegate.h chore: remove unused #includes (#42971) 2024-07-22 11:31:32 +02:00
devtools_ui.cc fix: add theme data source for devtools. (#44114) 2024-11-13 13:23:37 +01:00
devtools_ui.h fix: add theme data source for devtools. (#44114) 2024-11-13 13:23:37 +01:00
devtools_ui_bundle_data_source.cc fix: add theme data source for devtools. (#44114) 2024-11-13 13:23:37 +01:00
devtools_ui_bundle_data_source.h fix: add theme data source for devtools. (#44114) 2024-11-13 13:23:37 +01:00
devtools_ui_theme_data_source.cc fix: modernize-avoid-c-arrays (#44813) 2024-11-25 10:49:58 -05:00
devtools_ui_theme_data_source.h fix: add theme data source for devtools. (#44114) 2024-11-13 13:23:37 +01:00
drag_util.cc chore: remove more unused #include calls (#43000) 2024-07-25 11:25:45 +02:00
drag_util.h chore: iwyu mojom-forward header files (#43741) 2024-09-17 12:58:56 -07:00
drag_util_mac.mm chore: remove more unused #include calls (#43000) 2024-07-25 11:25:45 +02:00
drag_util_views.cc chore: cleanup `drag_util` (#36806) 2023-01-09 10:00:47 +01:00
electron_desktop_window_tree_host_linux.cc refactor: fix modernize-return-braced-init-list warnings (#44838) 2024-11-27 09:41:46 +09:00
electron_desktop_window_tree_host_linux.h chore: remove unused method ElectronDesktopWindowTreeHostLinux::UpdateClientDecorationHints() (#43283) 2024-08-10 18:55:10 -05:00
electron_gdk.sigs refactor: use gdk_display_beep() on Linux (#44734) 2024-11-20 16:24:59 -05:00
electron_gdk_pixbuf.sigs fix: keep gdk_pixbuf a dynamic dependency (#44423) 2024-10-29 09:44:20 +09:00
electron_gtk.fragment refactor: use stubs for gdk-pixbuf dependency (#34077) 2022-06-19 17:42:30 -07:00
electron_menu_model.cc chore: remove unused #includes (#42971) 2024-07-22 11:31:32 +02:00
electron_menu_model.h fix: modernize-use-equals-default warnings (#44935) 2024-12-03 16:25:48 -06:00
file_dialog.h chore: more iwyu (#43063) 2024-07-29 12:42:57 -05:00
file_dialog_linux.cc fix: revert required portal version for file chooser dialogs (#44426) 2024-11-15 09:31:33 -05:00
file_dialog_mac.mm build: make is_mas_build a generated header instead of config (#43737) 2024-09-17 01:38:56 -07:00
file_dialog_win.cc fix: windows save dialog extension bug (#44296) 2024-11-20 17:27:49 -05:00
gtk_util.cc perf: build g_dgettext domain name at compile time (#43960) 2024-09-26 13:10:30 -04:00
gtk_util.h chore: add ELECTRON_ prefix to C++ include guards (#31925) 2021-11-22 16:34:31 +09:00
inspectable_web_contents.cc refactor: remove InspectableWebContentsViewMac in favor of the Views version (#44628) 2025-01-17 10:21:10 -05:00
inspectable_web_contents.h fix: EyeDropper working in devtools (#43685) 2024-09-12 15:40:56 +02:00
inspectable_web_contents_delegate.h fix: modernize-use-equals-default warnings (#44935) 2024-12-03 16:25:48 -06:00
inspectable_web_contents_view.cc refactor: remove InspectableWebContentsViewMac in favor of the Views version (#44628) 2025-01-17 10:21:10 -05:00
inspectable_web_contents_view.h refactor: remove InspectableWebContentsViewMac in favor of the Views version (#44628) 2025-01-17 10:21:10 -05:00
inspectable_web_contents_view_delegate.cc chore: bump chromium to 93.0.4536.0 (main) (#29586) 2021-06-08 15:22:43 -05:00
inspectable_web_contents_view_delegate.h fix: modernize-use-equals-default warnings (#44935) 2024-12-03 16:25:48 -06:00
message_box.h chore: replace absl::optional<T> with std::optional<T> (#40928) 2024-01-10 16:23:35 -06:00
message_box_gtk.cc fix: remove unused id argument from TranslateToStock() (#44900) 2024-12-01 16:34:48 -06:00
message_box_mac.mm chore: bump chromium to 131.0.6734.0 (main) (#43769) 2024-09-25 06:19:39 -05:00
message_box_win.cc chore: replace absl::optional<T> with std::optional<T> (#40928) 2024-01-10 16:23:35 -06:00
run_all_unittests.cc chore: remove more unused #include calls (#43000) 2024-07-25 11:25:45 +02:00
status_icon_gtk.cc chore: bump chromium to 119.0.6045.0 (main) (#40076) 2023-10-05 19:59:39 -04:00
status_icon_gtk.h chore: bump chromium to 119.0.6045.0 (main) (#40076) 2023-10-05 19:59:39 -04:00
tray_icon.cc refactor: fix modernize-return-braced-init-list warnings (#44838) 2024-11-27 09:41:46 +09:00
tray_icon.h refactor: put empty virtual function definitions in header (#43285) 2024-08-12 09:56:51 +02:00
tray_icon_cocoa.h chore: add/fix interface comments for sections of methods (#42566) 2024-06-20 10:49:07 +02:00
tray_icon_cocoa.mm chore: remove unused #includes (#42971) 2024-07-22 11:31:32 +02:00
tray_icon_linux.cc chore: replace absl::optional<T> with std::optional<T> (#40928) 2024-01-10 16:23:35 -06:00
tray_icon_linux.h chore: bump chromium to 116.0.5817.0 (main) (#38465) 2023-06-09 16:08:36 -07:00
tray_icon_observer.h fix: modernize-use-equals-default warnings (#44935) 2024-12-03 16:25:48 -06:00
tray_icon_win.cc chore: replace absl::optional<T> with std::optional<T> (#40928) 2024-01-10 16:23:35 -06:00