electron/shell/browser/ui/views
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
..
autofill_popup_view.cc fix: cyclical #include dependency between autofill_popup.h and autofill_popup_view.h (#44705) 2024-11-19 13:45:18 -06:00
autofill_popup_view.h fix: modernize-use-equals-default warnings (#44935) 2024-12-03 16:25:48 -06:00
caption_button_placeholder_container.cc chore: remove more unused #include calls (#43000) 2024-07-25 11:25:45 +02:00
caption_button_placeholder_container.h feat: enable Windows Control Overlay on Linux (#41769) 2024-06-27 14:56:36 +02:00
client_frame_view_linux.cc refactor: fix modernize-return-braced-init-list warnings (#44838) 2024-11-27 09:41:46 +09:00
client_frame_view_linux.h chore: remove more unused #include calls (#43000) 2024-07-25 11:25:45 +02:00
electron_views_delegate.cc chore: bump chromium to 131.0.6744.0 (main) (#43948) 2024-09-30 14:54:44 +02:00
electron_views_delegate.h chore: bump chromium to 131.0.6744.0 (main) (#43948) 2024-09-30 14:54:44 +02:00
electron_views_delegate_win.cc perf: use flat_set, flat_map for small, trivially-moved containers (#40817) 2024-01-05 12:18:31 +01:00
frameless_view.cc refactor: remove InspectableWebContentsViewMac in favor of the Views version (#44628) 2025-01-17 10:21:10 -05:00
frameless_view.h refactor: put empty virtual function definitions in header (#43285) 2024-08-12 09:56:51 +02:00
global_menu_bar_registrar_x11.cc fix: remove unused local variables (#44815) 2024-11-23 17:34:51 -06:00
global_menu_bar_registrar_x11.h chore: remove unused #includes (#42971) 2024-07-22 11:31:32 +02:00
global_menu_bar_x11.cc fix: modernize-use-using clang-tidy warnings (#44806) 2024-11-25 10:50:33 -05:00
global_menu_bar_x11.h chore: remove unused #includes (#42971) 2024-07-22 11:31:32 +02:00
menu_bar.cc chore: bump chromium to 132.0.6807.0 (main) (#44360) 2024-11-04 09:10:00 -05:00
menu_bar.h refactor: inherit Observer classes privately, pt. 2 (#42237) 2024-05-29 13:07:02 -05:00
menu_delegate.cc chore: bump chromium to 132.0.6807.0 (main) (#44360) 2024-11-04 09:10:00 -05:00
menu_delegate.h chore: bump chromium to 132.0.6807.0 (main) (#44360) 2024-11-04 09:10:00 -05:00
menu_model_adapter.cc chore: bump chromium to 106.0.5216.0 (main) (#34993) 2022-08-17 11:35:53 -07:00
menu_model_adapter.h chore: add/fix interface comments for sections of methods (#42566) 2024-06-20 10:49:07 +02:00
native_frame_view.cc chore: bump chromium to 123.0.6312.5 (main) (#41337) 2024-02-21 15:27:05 -05:00
native_frame_view.h chore: bump chromium to 123.0.6312.5 (main) (#41337) 2024-02-21 15:27:05 -05:00
opaque_frame_view.cc refactor: fix modernize-return-braced-init-list warnings (#44838) 2024-11-27 09:41:46 +09:00
opaque_frame_view.h chore: remove more unused #include calls (#43000) 2024-07-25 11:25:45 +02:00
root_view.cc chore: bump chromium to 127.0.6521.0 (main) (#42118) 2024-06-07 17:18:35 -04:00
root_view.h chore: remove more unused #include calls (#43000) 2024-07-25 11:25:45 +02:00
submenu_button.cc chore: remove more unused #include calls (#43000) 2024-07-25 11:25:45 +02:00
submenu_button.h chore: remove more unused #include calls (#43000) 2024-07-25 11:25:45 +02:00
win_caption_button.cc chore: remove more unused #include calls (#43000) 2024-07-25 11:25:45 +02:00
win_caption_button.h chore: remove unused #includes (#42971) 2024-07-22 11:31:32 +02:00
win_caption_button_container.cc fix: tooltips in WCO caption buttons (#44721) 2024-11-20 12:45:08 +01:00
win_caption_button_container.h fix: tooltips in WCO caption buttons (#44721) 2024-11-20 12:45:08 +01:00
win_frame_view.cc chore: remove more unused #include calls (#43000) 2024-07-25 11:25:45 +02:00
win_frame_view.h chore: remove unused WinFrameView::kInactiveTitlebarFeatureAlpha (#43448) 2024-08-23 20:59:41 -05:00
win_icon_painter.cc chore: remove more unused #include calls (#43000) 2024-07-25 11:25:45 +02:00
win_icon_painter.h chore: remove unused #includes (#42971) 2024-07-22 11:31:32 +02:00