mirror of
https://github.com/electron/electron.git
synced 2026-04-10 03:01:51 -04:00
refactor: RootView::main_view() returns a reference instead of a pointer
It can never be nullptr, so return a reference
This commit is contained in:
@@ -470,12 +470,12 @@ void NativeWindowViews::SetGTKDarkThemeEnabled(bool use_dark_theme) {
|
||||
|
||||
void NativeWindowViews::SetContentView(views::View* view) {
|
||||
if (content_view()) {
|
||||
root_view_.GetMainView()->RemoveChildView(content_view());
|
||||
root_view_.main_view().RemoveChildView(content_view());
|
||||
}
|
||||
set_content_view(view);
|
||||
focused_view_ = view;
|
||||
root_view_.GetMainView()->AddChildView(content_view());
|
||||
root_view_.GetMainView()->DeprecatedLayoutImmediately();
|
||||
root_view_.main_view().AddChildView(content_view());
|
||||
root_view_.main_view().DeprecatedLayoutImmediately();
|
||||
}
|
||||
|
||||
void NativeWindowViews::Close() {
|
||||
@@ -1680,7 +1680,7 @@ std::u16string NativeWindowViews::GetWindowTitle() const {
|
||||
}
|
||||
|
||||
views::View* NativeWindowViews::GetContentsView() {
|
||||
return root_view_.GetMainView();
|
||||
return &root_view_.main_view();
|
||||
}
|
||||
|
||||
bool NativeWindowViews::ShouldDescendIntoChildForEventHandling(
|
||||
|
||||
@@ -46,7 +46,7 @@ class RootView : public views::View {
|
||||
void RegisterAcceleratorsWithFocusManager(ElectronMenuModel* menu_model);
|
||||
void UnregisterAcceleratorsWithFocusManager();
|
||||
|
||||
views::View* GetMainView() { return &main_view_; }
|
||||
[[nodiscard]] views::View& main_view() { return main_view_; }
|
||||
|
||||
// views::View:
|
||||
gfx::Size GetMinimumSize() const override;
|
||||
|
||||
Reference in New Issue
Block a user