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 31812ec
Showing 1 changed file with 18 additions and 4 deletions.
22 changes: 18 additions & 4 deletions atom/browser/osr/osr_web_contents_view.cc
Expand Up @@ -4,6 +4,7 @@

#include "atom/browser/osr/osr_web_contents_view.h"

#include "atom/browser/api/atom_api_web_contents.h"
#include "atom/common/api/api_messages.h"
#include "content/browser/web_contents/web_contents_impl.h"
#include "content/public/browser/render_view_host.h"
Expand Down Expand Up @@ -102,9 +103,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 +122,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 31812ec

Please sign in to comment.