feat: replace BrowserView with WebContentsView (#35658)
This commit is contained in:
parent
a94fb2cb5d
commit
15c6014324
76 changed files with 2987 additions and 1531 deletions
|
@ -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();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue