Skip to content

Commit

Permalink
fix: BrowserViews not painting their WebContents
Browse files Browse the repository at this point in the history
  • Loading branch information
codebytere committed Jul 29, 2021
1 parent c5ad7ed commit f5ff36b
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
9 changes: 8 additions & 1 deletion shell/browser/native_browser_view_views.cc
Expand Up @@ -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/inspectable_web_contents_view_views.h"
#include "ui/gfx/geometry/rect.h"
#include "ui/views/background.h"
#include "ui/views/view.h"
Expand Down Expand Up @@ -137,6 +137,13 @@ gfx::Rect NativeBrowserViewViews::GetBounds() {
return iwc_view->GetView()->bounds();
}

void NativeBrowserViewViews::RenderViewReady() {
auto* iwc_view = GetInspectableWebContentsView();
if (!iwc_view)
return;
static_cast<InspectableWebContentsViewViews*>(iwc_view)->Layout();
}

void NativeBrowserViewViews::SetBackgroundColor(SkColor color) {
auto* iwc_view = GetInspectableWebContentsView();
if (!iwc_view)
Expand Down
3 changes: 3 additions & 0 deletions shell/browser/native_browser_view_views.h
Expand Up @@ -33,6 +33,9 @@ class NativeBrowserViewViews : public NativeBrowserView {
void UpdateDraggableRegions(
const std::vector<mojom::DraggableRegionPtr>& regions) override;

// WebContentsObserver:
void DidFirstVisuallyNonEmptyPaint() override;

SkRegion* draggable_region() const { return draggable_region_.get(); }

private:
Expand Down
6 changes: 3 additions & 3 deletions shell/browser/ui/views/inspectable_web_contents_view_views.h
Expand Up @@ -41,16 +41,16 @@ 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_;
}

const std::u16string& GetTitle() const { return title_; }

private:
// views::View:
void Layout() override;

// Owns us.
InspectableWebContents* inspectable_web_contents_;

Expand Down

0 comments on commit f5ff36b

Please sign in to comment.