Fix initial transparency delay for OSR + gpu-disabled (see issue #2938)

This commit is contained in:
Masako Toda 2020-07-27 20:38:48 -07:00 committed by Marshall Greenblatt
parent 11f37bc6eb
commit 87c8a72831
4 changed files with 21 additions and 10 deletions

View File

@ -53,6 +53,12 @@ void CefBrowserPlatformDelegateOsr::WebContentsCreated(
view_osr_->WebContentsCreated(web_contents);
}
void CefBrowserPlatformDelegateOsr::RenderViewCreated(
content::RenderViewHost* render_view_host) {
if (view_osr_)
view_osr_->RenderViewCreated();
}
void CefBrowserPlatformDelegateOsr::BrowserCreated(
CefBrowserHostImpl* browser) {
CefBrowserPlatformDelegateAlloy::BrowserCreated(browser);

View File

@ -26,6 +26,7 @@ class CefBrowserPlatformDelegateOsr
content::RenderViewHostDelegateView** delegate_view) override;
void WebContentsCreated(content::WebContents* web_contents,
bool owned) override;
void RenderViewCreated(content::RenderViewHost* render_view_host) override;
void BrowserCreated(CefBrowserHostImpl* browser) override;
void NotifyBrowserDestroyed() override;
void BrowserDestroyed(CefBrowserHostImpl* browser) override;

View File

@ -29,7 +29,17 @@ void CefWebContentsViewOSR::WebContentsCreated(
DCHECK(!web_contents_);
web_contents_ = web_contents;
RenderViewReady();
RenderViewCreated();
}
void CefWebContentsViewOSR::RenderViewCreated() {
if (web_contents_) {
auto host = web_contents_->GetRenderViewHost();
CefRenderWidgetHostViewOSR* view =
static_cast<CefRenderWidgetHostViewOSR*>(host->GetWidget()->GetView());
if (view)
view->InstallTransparency();
}
}
gfx::NativeView CefWebContentsViewOSR::GetNativeView() const {
@ -120,15 +130,7 @@ CefWebContentsViewOSR::CreateViewForChildWidget(
void CefWebContentsViewOSR::SetPageTitle(const base::string16& title) {}
void CefWebContentsViewOSR::RenderViewReady() {
if (web_contents_) {
auto host = web_contents_->GetRenderViewHost();
CefRenderWidgetHostViewOSR* view =
static_cast<CefRenderWidgetHostViewOSR*>(host->GetWidget()->GetView());
if (view)
view->InstallTransparency();
}
}
void CefWebContentsViewOSR::RenderViewReady() {}
void CefWebContentsViewOSR::RenderViewHostChanged(
content::RenderViewHost* old_host,

View File

@ -31,6 +31,8 @@ class CefWebContentsViewOSR : public content::WebContentsView,
void WebContentsCreated(content::WebContents* web_contents);
content::WebContents* web_contents() const { return web_contents_; }
void RenderViewCreated();
// WebContentsView methods.
gfx::NativeView GetNativeView() const override;
gfx::NativeView GetContentNativeView() const override;