mirror of
https://github.com/electron/electron.git
synced 2026-04-10 03:01:51 -04:00
feat: replace BrowserView with WebContentsView (#35658)
This commit is contained in:
@@ -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) {
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user