fix: BrowserViews not painting their WebContents (#29919)
This commit is contained in:
parent
9cc1b55663
commit
639f03977f
3 changed files with 19 additions and 10 deletions
|
@ -7,7 +7,7 @@
|
|||
#include <vector>
|
||||
|
||||
#include "shell/browser/ui/drag_util.h"
|
||||
#include "shell/browser/ui/inspectable_web_contents_view.h"
|
||||
#include "shell/browser/ui/views/inspectable_web_contents_view_views.h"
|
||||
#include "ui/gfx/geometry/rect.h"
|
||||
#include "ui/views/background.h"
|
||||
#include "ui/views/view.h"
|
||||
|
@ -47,7 +47,7 @@ void NativeBrowserViewViews::SetAutoResizeProportions(
|
|||
const gfx::Size& window_size) {
|
||||
if ((auto_resize_flags_ & AutoResizeFlags::kAutoResizeHorizontal) &&
|
||||
!auto_horizontal_proportion_set_) {
|
||||
auto* iwc_view = GetInspectableWebContentsView();
|
||||
InspectableWebContentsView* iwc_view = GetInspectableWebContentsView();
|
||||
if (!iwc_view)
|
||||
return;
|
||||
auto* view = iwc_view->GetView();
|
||||
|
@ -61,7 +61,7 @@ void NativeBrowserViewViews::SetAutoResizeProportions(
|
|||
}
|
||||
if ((auto_resize_flags_ & AutoResizeFlags::kAutoResizeVertical) &&
|
||||
!auto_vertical_proportion_set_) {
|
||||
auto* iwc_view = GetInspectableWebContentsView();
|
||||
InspectableWebContentsView* iwc_view = GetInspectableWebContentsView();
|
||||
if (!iwc_view)
|
||||
return;
|
||||
auto* view = iwc_view->GetView();
|
||||
|
@ -78,7 +78,7 @@ void NativeBrowserViewViews::SetAutoResizeProportions(
|
|||
void NativeBrowserViewViews::AutoResize(const gfx::Rect& new_window,
|
||||
int width_delta,
|
||||
int height_delta) {
|
||||
auto* iwc_view = GetInspectableWebContentsView();
|
||||
InspectableWebContentsView* iwc_view = GetInspectableWebContentsView();
|
||||
if (!iwc_view)
|
||||
return;
|
||||
auto* view = iwc_view->GetView();
|
||||
|
@ -122,7 +122,7 @@ void NativeBrowserViewViews::ResetAutoResizeProportions() {
|
|||
}
|
||||
|
||||
void NativeBrowserViewViews::SetBounds(const gfx::Rect& bounds) {
|
||||
auto* iwc_view = GetInspectableWebContentsView();
|
||||
InspectableWebContentsView* iwc_view = GetInspectableWebContentsView();
|
||||
if (!iwc_view)
|
||||
return;
|
||||
auto* view = iwc_view->GetView();
|
||||
|
@ -131,14 +131,20 @@ void NativeBrowserViewViews::SetBounds(const gfx::Rect& bounds) {
|
|||
}
|
||||
|
||||
gfx::Rect NativeBrowserViewViews::GetBounds() {
|
||||
auto* iwc_view = GetInspectableWebContentsView();
|
||||
InspectableWebContentsView* iwc_view = GetInspectableWebContentsView();
|
||||
if (!iwc_view)
|
||||
return gfx::Rect();
|
||||
return iwc_view->GetView()->bounds();
|
||||
}
|
||||
|
||||
void NativeBrowserViewViews::RenderViewReady() {
|
||||
InspectableWebContentsView* iwc_view = GetInspectableWebContentsView();
|
||||
if (iwc_view)
|
||||
iwc_view->GetView()->Layout();
|
||||
}
|
||||
|
||||
void NativeBrowserViewViews::SetBackgroundColor(SkColor color) {
|
||||
auto* iwc_view = GetInspectableWebContentsView();
|
||||
InspectableWebContentsView* iwc_view = GetInspectableWebContentsView();
|
||||
if (!iwc_view)
|
||||
return;
|
||||
auto* view = iwc_view->GetView();
|
||||
|
|
|
@ -33,6 +33,9 @@ class NativeBrowserViewViews : public NativeBrowserView {
|
|||
void UpdateDraggableRegions(
|
||||
const std::vector<mojom::DraggableRegionPtr>& regions) override;
|
||||
|
||||
// WebContentsObserver:
|
||||
void RenderViewReady() override;
|
||||
|
||||
SkRegion* draggable_region() const { return draggable_region_.get(); }
|
||||
|
||||
private:
|
||||
|
|
|
@ -41,6 +41,9 @@ class InspectableWebContentsViewViews : public InspectableWebContentsView,
|
|||
const DevToolsContentsResizingStrategy& strategy) override;
|
||||
void SetTitle(const std::u16string& title) override;
|
||||
|
||||
// views::View:
|
||||
void Layout() override;
|
||||
|
||||
InspectableWebContents* inspectable_web_contents() {
|
||||
return inspectable_web_contents_;
|
||||
}
|
||||
|
@ -48,9 +51,6 @@ class InspectableWebContentsViewViews : public InspectableWebContentsView,
|
|||
const std::u16string& GetTitle() const { return title_; }
|
||||
|
||||
private:
|
||||
// views::View:
|
||||
void Layout() override;
|
||||
|
||||
// Owns us.
|
||||
InspectableWebContents* inspectable_web_contents_;
|
||||
|
||||
|
|
Loading…
Reference in a new issue