From 87c8a72831c221d4330ca45ca98d48590ca74d21 Mon Sep 17 00:00:00 2001 From: Masako Toda Date: Mon, 27 Jul 2020 20:38:48 -0700 Subject: [PATCH] Fix initial transparency delay for OSR + gpu-disabled (see issue #2938) --- .../osr/browser_platform_delegate_osr.cc | 6 +++++ .../osr/browser_platform_delegate_osr.h | 1 + libcef/browser/osr/web_contents_view_osr.cc | 22 ++++++++++--------- libcef/browser/osr/web_contents_view_osr.h | 2 ++ 4 files changed, 21 insertions(+), 10 deletions(-) diff --git a/libcef/browser/osr/browser_platform_delegate_osr.cc b/libcef/browser/osr/browser_platform_delegate_osr.cc index 87e4d015f..0b9ee07d3 100644 --- a/libcef/browser/osr/browser_platform_delegate_osr.cc +++ b/libcef/browser/osr/browser_platform_delegate_osr.cc @@ -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); diff --git a/libcef/browser/osr/browser_platform_delegate_osr.h b/libcef/browser/osr/browser_platform_delegate_osr.h index 98eaa1c39..b87ac00b9 100644 --- a/libcef/browser/osr/browser_platform_delegate_osr.h +++ b/libcef/browser/osr/browser_platform_delegate_osr.h @@ -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; diff --git a/libcef/browser/osr/web_contents_view_osr.cc b/libcef/browser/osr/web_contents_view_osr.cc index 2cafecf92..c148b76a0 100644 --- a/libcef/browser/osr/web_contents_view_osr.cc +++ b/libcef/browser/osr/web_contents_view_osr.cc @@ -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(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(host->GetWidget()->GetView()); - if (view) - view->InstallTransparency(); - } -} +void CefWebContentsViewOSR::RenderViewReady() {} void CefWebContentsViewOSR::RenderViewHostChanged( content::RenderViewHost* old_host, diff --git a/libcef/browser/osr/web_contents_view_osr.h b/libcef/browser/osr/web_contents_view_osr.h index fd5ca2b40..8268e6abd 100644 --- a/libcef/browser/osr/web_contents_view_osr.h +++ b/libcef/browser/osr/web_contents_view_osr.h @@ -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;