0004-qtwebengine-transparency-window-creation.patch 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. rom e62ab19d897155bb10f4c7a2a99b901b458361b5 Mon Sep 17 00:00:00 2001
  2. From: Jocelyn Turcotte <jturcotte@woboq.com>
  3. Date: Mon, 20 Jul 2015 12:06:59 +0200
  4. Subject: [PATCH] Fix a crash on new windows
  5. Fixes a regression of 99e98f7bf6aec78fe0d647fb898e65d13ff522e4
  6. by delaying applying the background color if the client hasn't
  7. been set on the WebContentsViewQt yet.
  8. Task-number: QTBUG-41960
  9. Change-Id: I1c138777f616541179976570d8c29f8f4d49ecbf
  10. ---
  11. qtwebengine/src/core/web_contents_view_qt.cpp | 9 ++++++---
  12. 1 file changed, 6 insertions(+), 3 deletions(-)
  13. diff --git a/qtwebengine/src/core/web_contents_view_qt.cpp b/src/core/web_contents_view_qt.cpp
  14. index aad44c1..c327534 100644
  15. --- a/qtwebengine/src/core/web_contents_view_qt.cpp
  16. +++ b/qtwebengine/src/core/web_contents_view_qt.cpp
  17. @@ -53,8 +53,10 @@ void WebContentsViewQt::initialize(WebContentsAdapterClient* client)
  18. m_factoryClient = client;
  19. // Check if a RWHV was created before the initialization.
  20. - if (m_webContents->GetRenderWidgetHostView())
  21. - static_cast<RenderWidgetHostViewQt *>(m_webContents->GetRenderWidgetHostView())->setAdapterClient(client);
  22. + if (auto rwhv = static_cast<RenderWidgetHostViewQt *>(m_webContents->GetRenderWidgetHostView())) {
  23. + rwhv->setAdapterClient(client);
  24. + rwhv->SetBackgroundColor(toSk(client->backgroundColor()));
  25. + }
  26. }
  27. content::RenderWidgetHostViewBase* WebContentsViewQt::CreateViewForWidget(content::RenderWidgetHost* render_widget_host, bool is_guest_view_hack)
  28. @@ -86,7 +88,8 @@ void WebContentsViewQt::RenderViewCreated(content::RenderViewHost* host)
  29. {
  30. // The render process is done creating the RenderView and it's ready to be routed
  31. // messages at this point.
  32. - host->GetView()->SetBackgroundColor(toSk(m_client->backgroundColor()));
  33. + if (m_client)
  34. + host->GetView()->SetBackgroundColor(toSk(m_client->backgroundColor()));
  35. }
  36. void WebContentsViewQt::CreateView(const gfx::Size& initial_size, gfx::NativeView context)
  37. --
  38. 2.3.3