Skip to content

Commit

Permalink
fix: pass NativeWindow to OSR WHV to ensure it initializes correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
adill committed Nov 6, 2018
1 parent 3846a1b commit 6fe7dc6
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions atom/browser/osr/osr_web_contents_view.cc
Expand Up @@ -102,9 +102,17 @@ OffScreenWebContentsView::CreateViewForWidget(
render_widget_host->GetView());
}

content::WebContentsImpl* web_contents_impl =
static_cast<content::WebContentsImpl*>(web_contents_);

auto* web_contents_delegate =
static_cast<api::WebContents*>(web_contents_impl->GetDelegate());
NativeWindow* native_window =
web_contents_delegate ? web_contents_delegate->owner_window() : nullptr;

return new OffScreenRenderWidgetHostView(
transparent_, painting_, GetFrameRate(), callback_, render_widget_host,
nullptr, nullptr);
nullptr, native_window);
}

content::RenderWidgetHostViewBase*
Expand All @@ -113,16 +121,21 @@ OffScreenWebContentsView::CreateViewForPopupWidget(
content::WebContentsImpl* web_contents_impl =
static_cast<content::WebContentsImpl*>(web_contents_);

auto* web_contents_delegate =
static_cast<api::WebContents*>(web_contents_impl->GetDelegate());
NativeWindow* native_window =
web_contents_delegate ? web_contents_delegate->owner_window() : nullptr;

OffScreenRenderWidgetHostView* view =
static_cast<OffScreenRenderWidgetHostView*>(
web_contents_impl->GetOuterWebContents()
? web_contents_impl->GetOuterWebContents()
->GetRenderWidgetHostView()
: web_contents_impl->GetRenderWidgetHostView());

return new OffScreenRenderWidgetHostView(transparent_, true,
view->GetFrameRate(), callback_,
render_widget_host, view, nullptr);
return new OffScreenRenderWidgetHostView(
transparent_, true, view->GetFrameRate(), callback_, render_widget_host,
view, native_window);
}

void OffScreenWebContentsView::SetPageTitle(const base::string16& title) {}
Expand Down

0 comments on commit 6fe7dc6

Please sign in to comment.