feat: replace BrowserView with WebContentsView (#35658)

This commit is contained in:
Jeremy Rose
2023-12-13 13:01:03 -08:00
committed by GitHub
parent a94fb2cb5d
commit 15c6014324
76 changed files with 2987 additions and 1531 deletions

View File

@@ -15,9 +15,13 @@ DelayedNativeViewHost::~DelayedNativeViewHost() = default;
void DelayedNativeViewHost::ViewHierarchyChanged(
const views::ViewHierarchyChangedDetails& details) {
NativeViewHost::ViewHierarchyChanged(details);
if (details.is_add && GetWidget())
Attach(native_view_);
// NativeViewHost doesn't expect to have children, so filter the
// ViewHierarchyChanged events before passing them on.
if (details.child == this) {
NativeViewHost::ViewHierarchyChanged(details);
if (details.is_add && GetWidget() && !native_view())
Attach(native_view_);
}
}
bool DelayedNativeViewHost::OnMousePressed(const ui::MouseEvent& ui_event) {

View File

@@ -22,7 +22,6 @@ class RootViewMac : public views::View {
RootViewMac& operator=(const RootViewMac&) = delete;
// views::View:
void Layout() override;
gfx::Size GetMinimumSize() const override;
gfx::Size GetMaximumSize() const override;

View File

@@ -4,23 +4,20 @@
#include "shell/browser/ui/cocoa/root_view_mac.h"
#include <memory>
#include "shell/browser/native_window.h"
#include "ui/views/layout/fill_layout.h"
namespace electron {
RootViewMac::RootViewMac(NativeWindow* window) : window_(window) {
set_owned_by_client();
SetLayoutManager(std::make_unique<views::FillLayout>());
}
RootViewMac::~RootViewMac() = default;
void RootViewMac::Layout() {
if (!window_->content_view()) // Not ready yet.
return;
window_->content_view()->SetBoundsRect(gfx::Rect(gfx::Point(), size()));
}
gfx::Size RootViewMac::GetMinimumSize() const {
return window_->GetMinimumSize();
}

View File

@@ -4,7 +4,6 @@
#include "shell/browser/ui/views/frameless_view.h"
#include "shell/browser/native_browser_view_views.h"
#include "shell/browser/native_window_views.h"
#include "shell/browser/ui/views/inspectable_web_contents_view_views.h"
#include "ui/aura/window.h"