Gentoo Archives: gentoo-commits

From: Alexey Shvetsov <alexxy@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] dev/alexxy:master commit in: dev-qt/qtwebengine/files/, dev-qt/qtwebengine/
Date: Sun, 22 Nov 2015 21:07:04
Message-Id: 1448226404.846307931dbcac734a4512ebde47de5127b8978b.alexxy@gentoo
1 commit: 846307931dbcac734a4512ebde47de5127b8978b
2 Author: Alexey Shvetsov <alexxy <AT> gentoo <DOT> org>
3 AuthorDate: Sun Nov 22 21:06:44 2015 +0000
4 Commit: Alexey Shvetsov <alexxy <AT> gentoo <DOT> org>
5 CommitDate: Sun Nov 22 21:06:44 2015 +0000
6 URL: https://gitweb.gentoo.org/dev/alexxy.git/commit/?id=84630793
7
8 dev-qt/qtwebengine: Import from fkmclane overlay
9
10 Package-Manager: portage-2.2.24
11
12 dev-qt/qtwebengine/Manifest | 1 +
13 ...twebengine-Add-a-backgroundColor-property.patch | 532 +++++++++++++++++++++
14 ...-qtwebengine-transparency-window-creation.patch | 44 ++
15 dev-qt/qtwebengine/metadata.xml | 13 +
16 dev-qt/qtwebengine/qtwebengine-5.5.1.ebuild | 40 ++
17 5 files changed, 630 insertions(+)
18
19 diff --git a/dev-qt/qtwebengine/Manifest b/dev-qt/qtwebengine/Manifest
20 new file mode 100644
21 index 0000000..790f57e
22 --- /dev/null
23 +++ b/dev-qt/qtwebengine/Manifest
24 @@ -0,0 +1 @@
25 +DIST qtwebengine-opensource-src-5.5.1.tar.xz 122819856 SHA256 7c4d328dd305991aaf0c3450615f4a8e5d80152194bee6f5925bd8d3477e2b90 SHA512 70509071a74f68eb5b14ee4532adf51e6a9c26b9ee4cae9e7d835324f3a9955ac41864a74c7d5d4bdf894f6abf78c338f1f9f82081f369ee0a7313ac1f187525 WHIRLPOOL f3e2d31ad449bcd99aa502ee44374afb6118f8499baac3967c291a3b5f012054cfa75b19a297eecb2c12bf8b566d49b82292f46339d0205996884d54fa979787
26
27 diff --git a/dev-qt/qtwebengine/files/0001-qtwebengine-Add-a-backgroundColor-property.patch b/dev-qt/qtwebengine/files/0001-qtwebengine-Add-a-backgroundColor-property.patch
28 new file mode 100644
29 index 0000000..dba877e
30 --- /dev/null
31 +++ b/dev-qt/qtwebengine/files/0001-qtwebengine-Add-a-backgroundColor-property.patch
32 @@ -0,0 +1,532 @@
33 +From 3adadda878f63fcca6892c49c4ddc82143d59b66 Mon Sep 17 00:00:00 2001
34 +From: Jocelyn Turcotte <jturcotte@×××××.com>
35 +Date: Thu, 9 Jul 2015 21:52:43 +0200
36 +Subject: [PATCH] Add a backgroundColor property
37 +
38 +This also allows setting a transparent color to see through
39 +the web view's body if its background color isn't specified.
40 +
41 +The color is initially held by the top API view and is pulled
42 +by the WebContentsAdapter in order to set it on the RenderView.
43 +Since both blink and our local compositors (in the QOpenGLWidget
44 +case) need to know about this color, RWHVQt takes care of pushing
45 +it to both. The former through an IPC message and the latter
46 +directly on the RWHVQtDelegate.
47 +
48 +Task-number: QTBUG-41960
49 +Change-Id: Ie13317b2d087f5612ad9c5fb0e05ca3e91aec9af
50 +Reviewed-by: Allan Sandfeld Jensen <allan.jensen@××××××××××××.com>
51 +Reviewed-by: Andras Becsi <andras.becsi@××××××××××××.com>
52 +---
53 + qtwebengine/src/core/common/qt_messages.h | 3 ++
54 + qtwebengine/src/core/render_widget_host_view_qt.cpp | 9 ++++++
55 + qtwebengine/src/core/render_widget_host_view_qt.h | 1 +
56 + qtwebengine/src/core/render_widget_host_view_qt_delegate.h | 1 +
57 + qtwebengine/src/core/renderer/qt_render_view_observer.cpp | 6 ++++
58 + qtwebengine/src/core/renderer/qt_render_view_observer.h | 1 +
59 + qtwebengine/src/core/type_conversion.h | 5 ++++
60 + qtwebengine/src/core/web_contents_adapter.cpp | 7 +++++
61 + qtwebengine/src/core/web_contents_adapter.h | 1 +
62 + qtwebengine/src/core/web_contents_adapter_client.h | 1 +
63 + qtwebengine/src/core/web_contents_view_qt.cpp | 7 +++++
64 + qtwebengine/src/core/web_contents_view_qt.h | 2 +-
65 + qtwebengine/src/webengine/api/qquickwebengineview.cpp | 34 ++++++++++++++++++++++
66 + qtwebengine/src/webengine/api/qquickwebengineview_p.h | 5 +++-
67 + qtwebengine/src/webengine/api/qquickwebengineview_p_p.h | 2 ++
68 + .../render_widget_host_view_qt_delegate_quick.h | 2 ++
69 + ...nder_widget_host_view_qt_delegate_quickwindow.h | 1 +
70 + qtwebengine/src/webenginewidgets/api/qwebenginepage.cpp | 33 +++++++++++++++++++++
71 + qtwebengine/src/webenginewidgets/api/qwebenginepage.h | 3 ++
72 + qtwebengine/src/webenginewidgets/api/qwebenginepage_p.h | 2 ++
73 + .../render_widget_host_view_qt_delegate_widget.cpp | 16 +++++++++-
74 + .../render_widget_host_view_qt_delegate_widget.h | 2 ++
75 + 22 files changed, 141 insertions(+), 3 deletions(-)
76 +
77 +diff --git a/qtwebengine/src/core/common/qt_messages.h b/src/core/common/qt_messages.h
78 +index c692ee5..25a995b 100644
79 +--- a/qtwebengine/src/core/common/qt_messages.h
80 ++++ b/qtwebengine/src/core/common/qt_messages.h
81 +@@ -31,6 +31,9 @@ IPC_MESSAGE_ROUTED1(QtRenderViewObserver_FetchDocumentMarkup,
82 + IPC_MESSAGE_ROUTED1(QtRenderViewObserver_FetchDocumentInnerText,
83 + uint64 /* requestId */)
84 +
85 ++IPC_MESSAGE_ROUTED1(QtRenderViewObserver_SetBackgroundColor,
86 ++ uint32 /* color */)
87 ++
88 + IPC_MESSAGE_ROUTED1(WebChannelIPCTransport_Message, std::vector<char> /*binaryJSON*/)
89 +
90 + // User scripts messages
91 +diff --git a/qtwebengine/src/core/render_widget_host_view_qt.cpp b/src/core/render_widget_host_view_qt.cpp
92 +index 572bc34..20b41bc 100644
93 +--- a/qtwebengine/src/core/render_widget_host_view_qt.cpp
94 ++++ b/qtwebengine/src/core/render_widget_host_view_qt.cpp
95 +@@ -36,6 +36,7 @@
96 +
97 + #include "render_widget_host_view_qt.h"
98 +
99 ++#include "common/qt_messages.h"
100 + #include "browser_accessibility_manager_qt.h"
101 + #include "browser_accessibility_qt.h"
102 + #include "chromium_overrides.h"
103 +@@ -408,6 +409,14 @@ gfx::Rect RenderWidgetHostViewQt::GetViewBounds() const
104 + return gfx::BoundingRect(p1, p2);
105 + }
106 +
107 ++void RenderWidgetHostViewQt::SetBackgroundColor(SkColor color) {
108 ++ RenderWidgetHostViewBase::SetBackgroundColor(color);
109 ++ // Set the background of the compositor if necessary
110 ++ m_delegate->setClearColor(toQt(color));
111 ++ // Set the background of the blink::FrameView
112 ++ m_host->Send(new QtRenderViewObserver_SetBackgroundColor(m_host->GetRoutingID(), color));
113 ++}
114 ++
115 + // Return value indicates whether the mouse is locked successfully or not.
116 + bool RenderWidgetHostViewQt::LockMouse()
117 + {
118 +diff --git a/qtwebengine/src/core/render_widget_host_view_qt.h b/src/core/render_widget_host_view_qt.h
119 +index 248c52f..2724292 100644
120 +--- a/qtwebengine/src/core/render_widget_host_view_qt.h
121 ++++ b/qtwebengine/src/core/render_widget_host_view_qt.h
122 +@@ -125,6 +125,7 @@ public:
123 + virtual void Hide() Q_DECL_OVERRIDE;
124 + virtual bool IsShowing() Q_DECL_OVERRIDE;
125 + virtual gfx::Rect GetViewBounds() const Q_DECL_OVERRIDE;
126 ++ virtual void SetBackgroundColor(SkColor color) Q_DECL_OVERRIDE;
127 + virtual bool LockMouse() Q_DECL_OVERRIDE;
128 + virtual void UnlockMouse() Q_DECL_OVERRIDE;
129 + virtual void WasShown() Q_DECL_OVERRIDE;
130 +diff --git a/qtwebengine/src/core/render_widget_host_view_qt_delegate.h b/src/core/render_widget_host_view_qt_delegate.h
131 +index da595b9..f4aa9b2 100644
132 +--- a/qtwebengine/src/core/render_widget_host_view_qt_delegate.h
133 ++++ b/qtwebengine/src/core/render_widget_host_view_qt_delegate.h
134 +@@ -96,6 +96,7 @@ public:
135 + virtual void move(const QPoint &) = 0;
136 + virtual void inputMethodStateChanged(bool editorVisible) = 0;
137 + virtual void setTooltip(const QString &) = 0;
138 ++ virtual void setClearColor(const QColor &color) = 0;
139 + };
140 +
141 + } // namespace QtWebEngineCore
142 +diff --git a/qtwebengine/src/core/renderer/qt_render_view_observer.cpp b/src/core/renderer/qt_render_view_observer.cpp
143 +index 83534da..ba91e54 100644
144 +--- a/qtwebengine/src/core/renderer/qt_render_view_observer.cpp
145 ++++ b/qtwebengine/src/core/renderer/qt_render_view_observer.cpp
146 +@@ -65,6 +65,11 @@ void QtRenderViewObserver::onFetchDocumentInnerText(quint64 requestId)
147 + render_view()->GetWebView()->mainFrame()->contentAsText(std::numeric_limits<std::size_t>::max())));
148 + }
149 +
150 ++void QtRenderViewObserver::onSetBackgroundColor(quint32 color)
151 ++{
152 ++ render_view()->GetWebView()->setBaseBackgroundColor(color);
153 ++}
154 ++
155 + void QtRenderViewObserver::OnFirstVisuallyNonEmptyLayout()
156 + {
157 + Send(new QtRenderViewObserverHost_DidFirstVisuallyNonEmptyLayout(routing_id()));
158 +@@ -76,6 +81,7 @@ bool QtRenderViewObserver::OnMessageReceived(const IPC::Message& message)
159 + IPC_BEGIN_MESSAGE_MAP(QtRenderViewObserver, message)
160 + IPC_MESSAGE_HANDLER(QtRenderViewObserver_FetchDocumentMarkup, onFetchDocumentMarkup)
161 + IPC_MESSAGE_HANDLER(QtRenderViewObserver_FetchDocumentInnerText, onFetchDocumentInnerText)
162 ++ IPC_MESSAGE_HANDLER(QtRenderViewObserver_SetBackgroundColor, onSetBackgroundColor)
163 + IPC_MESSAGE_UNHANDLED(handled = false)
164 + IPC_END_MESSAGE_MAP()
165 + return handled;
166 +diff --git a/qtwebengine/src/core/renderer/qt_render_view_observer.h b/src/core/renderer/qt_render_view_observer.h
167 +index cb77cd0..3f7829a 100644
168 +--- a/qtwebengine/src/core/renderer/qt_render_view_observer.h
169 ++++ b/qtwebengine/src/core/renderer/qt_render_view_observer.h
170 +@@ -47,6 +47,7 @@ public:
171 + private:
172 + void onFetchDocumentMarkup(quint64 requestId);
173 + void onFetchDocumentInnerText(quint64 requestId);
174 ++ void onSetBackgroundColor(quint32 color);
175 +
176 + void OnFirstVisuallyNonEmptyLayout() Q_DECL_OVERRIDE;
177 +
178 +diff --git a/qtwebengine/src/core/type_conversion.h b/src/core/type_conversion.h
179 +index 66fcd4d..f1bf54b 100644
180 +--- a/qtwebengine/src/core/type_conversion.h
181 ++++ b/qtwebengine/src/core/type_conversion.h
182 +@@ -122,6 +122,11 @@ inline QColor toQt(const SkColor &c)
183 + return QColor(SkColorGetR(c), SkColorGetG(c), SkColorGetB(c), SkColorGetA(c));
184 + }
185 +
186 ++inline SkColor toSk(const QColor &c)
187 ++{
188 ++ return c.rgba();
189 ++}
190 ++
191 + inline QMatrix4x4 toQt(const SkMatrix44 &m)
192 + {
193 + QMatrix4x4 qtMatrix(
194 +diff --git a/qtwebengine/src/core/web_contents_adapter.cpp b/src/core/web_contents_adapter.cpp
195 +index 8c13035..0c5b6ca 100644
196 +--- a/qtwebengine/src/core/web_contents_adapter.cpp
197 ++++ b/qtwebengine/src/core/web_contents_adapter.cpp
198 +@@ -837,6 +837,13 @@ void WebContentsAdapter::filesSelectedInChooser(const QStringList &fileList, Web
199 + rvh->FilesSelectedInChooser(toVector<content::FileChooserFileInfo>(files), static_cast<content::FileChooserParams::Mode>(mode));
200 + }
201 +
202 ++void WebContentsAdapter::backgroundColorChanged()
203 ++{
204 ++ Q_D(WebContentsAdapter);
205 ++ if (content::RenderWidgetHostView *rwhv = d->webContents->GetRenderWidgetHostView())
206 ++ rwhv->SetBackgroundColor(toSk(d->adapterClient->backgroundColor()));
207 ++}
208 ++
209 + content::WebContents *WebContentsAdapter::webContents() const
210 + {
211 + Q_D(const WebContentsAdapter);
212 +diff --git a/qtwebengine/src/core/web_contents_adapter.h b/src/core/web_contents_adapter.h
213 +index 5ea55c1..929967a 100644
214 +--- a/qtwebengine/src/core/web_contents_adapter.h
215 ++++ b/qtwebengine/src/core/web_contents_adapter.h
216 +@@ -120,6 +120,7 @@ public:
217 + void grantMouseLockPermission(bool granted);
218 +
219 + void dpiScaleChanged();
220 ++ void backgroundColorChanged();
221 + QAccessibleInterface *browserAccessible();
222 + BrowserContextQt* browserContext();
223 + BrowserContextAdapter* browserContextAdapter();
224 +diff --git a/qtwebengine/src/core/web_contents_adapter_client.h b/src/core/web_contents_adapter_client.h
225 +index 3ed3ab9..acf3095 100644
226 +--- a/qtwebengine/src/core/web_contents_adapter_client.h
227 ++++ b/qtwebengine/src/core/web_contents_adapter_client.h
228 +@@ -152,6 +152,7 @@ public:
229 + virtual void selectionChanged() = 0;
230 + virtual QRectF viewportRect() const = 0;
231 + virtual qreal dpiScale() const = 0;
232 ++ virtual QColor backgroundColor() const = 0;
233 + virtual void loadStarted(const QUrl &provisionalUrl, bool isErrorPage = false) = 0;
234 + virtual void loadCommitted() = 0;
235 + virtual void loadVisuallyCommitted() = 0;
236 +diff --git a/qtwebengine/src/core/web_contents_view_qt.cpp b/src/core/web_contents_view_qt.cpp
237 +index 9321706..f40bf8f 100644
238 +--- a/qtwebengine/src/core/web_contents_view_qt.cpp
239 ++++ b/qtwebengine/src/core/web_contents_view_qt.cpp
240 +@@ -81,6 +81,13 @@ content::RenderWidgetHostViewBase* WebContentsViewQt::CreateViewForPopupWidget(c
241 + return view;
242 + }
243 +
244 ++void WebContentsViewQt::RenderViewCreated(content::RenderViewHost* host)
245 ++{
246 ++ // The render process is done creating the RenderView and it's ready to be routed
247 ++ // messages at this point.
248 ++ host->GetView()->SetBackgroundColor(toSk(m_client->backgroundColor()));
249 ++}
250 ++
251 + void WebContentsViewQt::CreateView(const gfx::Size& initial_size, gfx::NativeView context)
252 + {
253 + // This is passed through content::WebContents::CreateParams::context either as the native view's client
254 +diff --git a/qtwebengine/src/core/web_contents_view_qt.h b/src/core/web_contents_view_qt.h
255 +index 896955f..3ede530 100644
256 +--- a/qtwebengine/src/core/web_contents_view_qt.h
257 ++++ b/qtwebengine/src/core/web_contents_view_qt.h
258 +@@ -75,7 +75,7 @@ public:
259 +
260 + virtual void SetPageTitle(const base::string16& title) Q_DECL_OVERRIDE { }
261 +
262 +- virtual void RenderViewCreated(content::RenderViewHost* host) Q_DECL_OVERRIDE { QT_NOT_YET_IMPLEMENTED }
263 ++ virtual void RenderViewCreated(content::RenderViewHost* host) Q_DECL_OVERRIDE;
264 +
265 + virtual void RenderViewSwappedIn(content::RenderViewHost* host) Q_DECL_OVERRIDE { QT_NOT_YET_IMPLEMENTED }
266 +
267 +diff --git a/qtwebengine/src/webengine/api/qquickwebengineview.cpp b/src/webengine/api/qquickwebengineview.cpp
268 +index 7405cae..c57d8d1 100644
269 +--- a/qtwebengine/src/webengine/api/qquickwebengineview.cpp
270 ++++ b/qtwebengine/src/webengine/api/qquickwebengineview.cpp
271 +@@ -104,6 +104,7 @@ QQuickWebEngineViewPrivate::QQuickWebEngineViewPrivate()
272 + , isLoading(false)
273 + , devicePixelRatio(QGuiApplication::primaryScreen()->devicePixelRatio())
274 + , m_dpiScale(1.0)
275 ++ , m_backgroundColor(Qt::white)
276 + {
277 + // The gold standard for mobile web content is 160 dpi, and the devicePixelRatio expected
278 + // is the (possibly quantized) ratio of device dpi to 160 dpi.
279 +@@ -310,6 +311,11 @@ qreal QQuickWebEngineViewPrivate::dpiScale() const
280 + return m_dpiScale;
281 + }
282 +
283 ++QColor QQuickWebEngineViewPrivate::backgroundColor() const
284 ++{
285 ++ return m_backgroundColor;
286 ++}
287 ++
288 + void QQuickWebEngineViewPrivate::loadStarted(const QUrl &provisionalUrl, bool isErrorPage)
289 + {
290 + Q_Q(QQuickWebEngineView);
291 +@@ -858,6 +864,34 @@ qreal QQuickWebEngineView::zoomFactor() const
292 + return d->adapter->currentZoomFactor();
293 + }
294 +
295 ++/*!
296 ++ \qmlproperty bool WebEngineView::backgroundColor
297 ++ \since QtWebEngine 1.3
298 ++
299 ++ Sets this property to change the color of the WebEngineView's background,
300 ++ behing the document's body. You can set it to "transparent" or to a translucent
301 ++ color to see through the document, or you can set this color to match your
302 ++ web content in an hybrid app to prevent the white flashes that may appear
303 ++ during loading.
304 ++
305 ++ The default value is white.
306 ++*/
307 ++QColor QQuickWebEngineView::backgroundColor() const
308 ++{
309 ++ Q_D(const QQuickWebEngineView);
310 ++ return d->m_backgroundColor;
311 ++}
312 ++
313 ++void QQuickWebEngineView::setBackgroundColor(const QColor &color)
314 ++{
315 ++ Q_D(QQuickWebEngineView);
316 ++ if (color == d->m_backgroundColor)
317 ++ return;
318 ++ d->m_backgroundColor = color;
319 ++ d->ensureContentsAdapter();
320 ++ d->adapter->backgroundColorChanged();
321 ++ emit backgroundColorChanged();
322 ++}
323 +
324 + bool QQuickWebEngineView::isFullScreen() const
325 + {
326 +diff --git a/qtwebengine/src/webengine/api/qquickwebengineview_p.h b/src/webengine/api/qquickwebengineview_p.h
327 +index 40299c1..362c3a2 100644
328 +--- a/qtwebengine/src/webengine/api/qquickwebengineview_p.h
329 ++++ b/qtwebengine/src/webengine/api/qquickwebengineview_p.h
330 +@@ -89,6 +89,7 @@ class Q_WEBENGINE_PRIVATE_EXPORT QQuickWebEngineView : public QQuickItem {
331 + Q_PROPERTY(QQuickWebEngineHistory *navigationHistory READ navigationHistory CONSTANT FINAL REVISION 1)
332 + Q_PROPERTY(QQmlWebChannel *webChannel READ webChannel WRITE setWebChannel NOTIFY webChannelChanged REVISION 1)
333 + Q_PROPERTY(QQmlListProperty<QQuickWebEngineScript> userScripts READ userScripts FINAL REVISION 1)
334 ++ Q_PROPERTY(QColor backgroundColor READ backgroundColor WRITE setBackgroundColor NOTIFY backgroundColorChanged REVISION 1)
335 +
336 + #ifdef ENABLE_QML_TESTSUPPORT_API
337 + Q_PROPERTY(QQuickWebEngineTestSupport *testSupport READ testSupport WRITE setTestSupport FINAL)
338 +@@ -118,6 +119,8 @@ public:
339 + bool isFullScreen() const;
340 + qreal zoomFactor() const;
341 + void setZoomFactor(qreal arg);
342 ++ QColor backgroundColor() const;
343 ++ void setBackgroundColor(const QColor &color);
344 +
345 + QQuickWebEngineViewExperimental *experimental() const;
346 +
347 +@@ -230,7 +233,7 @@ Q_SIGNALS:
348 + Q_REVISION(1) void zoomFactorChanged(qreal arg);
349 + Q_REVISION(1) void profileChanged();
350 + Q_REVISION(1) void webChannelChanged();
351 +-
352 ++ Q_REVISION(1) void backgroundColorChanged();
353 +
354 + protected:
355 + void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry);
356 +diff --git a/qtwebengine/src/webengine/api/qquickwebengineview_p_p.h b/src/webengine/api/qquickwebengineview_p_p.h
357 +index edc8c1a..3bfed2f 100644
358 +--- a/qtwebengine/src/webengine/api/qquickwebengineview_p_p.h
359 ++++ b/qtwebengine/src/webengine/api/qquickwebengineview_p_p.h
360 +@@ -123,6 +123,7 @@ public:
361 + virtual void selectionChanged() Q_DECL_OVERRIDE { }
362 + virtual QRectF viewportRect() const Q_DECL_OVERRIDE;
363 + virtual qreal dpiScale() const Q_DECL_OVERRIDE;
364 ++ virtual QColor backgroundColor() const Q_DECL_OVERRIDE;
365 + virtual void loadStarted(const QUrl &provisionalUrl, bool isErrorPage = false) Q_DECL_OVERRIDE;
366 + virtual void loadCommitted() Q_DECL_OVERRIDE;
367 + virtual void loadVisuallyCommitted() Q_DECL_OVERRIDE;
368 +@@ -192,6 +193,7 @@ private:
369 + QScopedPointer<QtWebEngineCore::UIDelegatesManager> m_uIDelegatesManager;
370 + QList<QQuickWebEngineScript *> m_userScripts;
371 + qreal m_dpiScale;
372 ++ QColor m_backgroundColor;
373 + };
374 +
375 + #ifndef QT_NO_ACCESSIBILITY
376 +diff --git a/qtwebengine/src/webengine/render_widget_host_view_qt_delegate_quick.h b/src/webengine/render_widget_host_view_qt_delegate_quick.h
377 +index ddd0e4d..eb2860b 100644
378 +--- a/qtwebengine/src/webengine/render_widget_host_view_qt_delegate_quick.h
379 ++++ b/qtwebengine/src/webengine/render_widget_host_view_qt_delegate_quick.h
380 +@@ -70,6 +70,8 @@ public:
381 + virtual void move(const QPoint&) Q_DECL_OVERRIDE { }
382 + virtual void inputMethodStateChanged(bool editorVisible) Q_DECL_OVERRIDE;
383 + virtual void setTooltip(const QString&) Q_DECL_OVERRIDE { }
384 ++ // The QtQuick view doesn't have a backbuffer of its own and doesn't need this
385 ++ virtual void setClearColor(const QColor &) Q_DECL_OVERRIDE { }
386 +
387 + protected:
388 + virtual void focusInEvent(QFocusEvent *event) Q_DECL_OVERRIDE;
389 +diff --git a/qtwebengine/src/webengine/render_widget_host_view_qt_delegate_quickwindow.h b/src/webengine/render_widget_host_view_qt_delegate_quickwindow.h
390 +index cda51a1..a4b0848 100644
391 +--- a/qtwebengine/src/webengine/render_widget_host_view_qt_delegate_quickwindow.h
392 ++++ b/qtwebengine/src/webengine/render_widget_host_view_qt_delegate_quickwindow.h
393 +@@ -73,6 +73,7 @@ public:
394 + virtual void move(const QPoint &screenPos) Q_DECL_OVERRIDE;
395 + virtual void inputMethodStateChanged(bool) Q_DECL_OVERRIDE {}
396 + virtual void setTooltip(const QString &tooltip) Q_DECL_OVERRIDE;
397 ++ virtual void setClearColor(const QColor &) Q_DECL_OVERRIDE { }
398 +
399 + private:
400 + QScopedPointer<RenderWidgetHostViewQtDelegate> m_realDelegate;
401 +diff --git a/qtwebengine/src/webenginewidgets/api/qwebenginepage.cpp b/src/webenginewidgets/api/qwebenginepage.cpp
402 +index 1b5a243..1cd7d6a 100644
403 +--- a/qtwebengine/src/webenginewidgets/api/qwebenginepage.cpp
404 ++++ b/qtwebengine/src/webenginewidgets/api/qwebenginepage.cpp
405 +@@ -185,6 +185,7 @@ QWebEnginePagePrivate::QWebEnginePagePrivate(QWebEngineProfile *_profile)
406 + , view(0)
407 + , isLoading(false)
408 + , scriptCollection(new QWebEngineScriptCollectionPrivate(browserContextAdapter()->userScriptController(), adapter.data()))
409 ++ , m_backgroundColor(Qt::white)
410 + {
411 + memset(actions, 0, sizeof(actions));
412 + }
413 +@@ -247,6 +248,11 @@ qreal QWebEnginePagePrivate::dpiScale() const
414 + return 1.0;
415 + }
416 +
417 ++QColor QWebEnginePagePrivate::backgroundColor() const
418 ++{
419 ++ return m_backgroundColor;
420 ++}
421 ++
422 + void QWebEnginePagePrivate::loadStarted(const QUrl &provisionalUrl, bool isErrorPage)
423 + {
424 + Q_UNUSED(provisionalUrl);
425 +@@ -531,6 +537,33 @@ void QWebEnginePage::setWebChannel(QWebChannel *channel)
426 + d->adapter->setWebChannel(channel);
427 + }
428 +
429 ++/*!
430 ++ \property QWebEnginePage::backgroundColor
431 ++ \brief the page's background color, behing the document's body.
432 ++ \since 5.6
433 ++
434 ++ You can set it to Qt::transparent or to a translucent
435 ++ color to see through the document, or you can set this color to match your
436 ++ web content in an hybrid app to prevent the white flashes that may appear
437 ++ during loading.
438 ++
439 ++ The default value is white.
440 ++*/
441 ++QColor QWebEnginePage::backgroundColor() const
442 ++{
443 ++ Q_D(const QWebEnginePage);
444 ++ return d->m_backgroundColor;
445 ++}
446 ++
447 ++void QWebEnginePage::setBackgroundColor(const QColor &color)
448 ++{
449 ++ Q_D(QWebEnginePage);
450 ++ if (d->m_backgroundColor == color)
451 ++ return;
452 ++ d->m_backgroundColor = color;
453 ++ d->adapter->backgroundColorChanged();
454 ++}
455 ++
456 + void QWebEnginePage::setView(QWidget *view)
457 + {
458 + QWebEngineViewPrivate::bind(qobject_cast<QWebEngineView*>(view), this);
459 +diff --git a/qtwebengine/src/webenginewidgets/api/qwebenginepage.h b/src/webenginewidgets/api/qwebenginepage.h
460 +index b4cf522..57ed071 100644
461 +--- a/qtwebengine/src/webenginewidgets/api/qwebenginepage.h
462 ++++ b/qtwebengine/src/webenginewidgets/api/qwebenginepage.h
463 +@@ -98,6 +98,7 @@ class QWEBENGINEWIDGETS_EXPORT QWebEnginePage : public QObject {
464 + Q_PROPERTY(QString title READ title)
465 + Q_PROPERTY(QUrl url READ url WRITE setUrl)
466 + Q_PROPERTY(QUrl iconUrl READ iconUrl)
467 ++ Q_PROPERTY(QColor backgroundColor READ backgroundColor WRITE setBackgroundColor)
468 +
469 + public:
470 + enum WebAction {
471 +@@ -236,6 +237,8 @@ public:
472 +
473 + QWebChannel *webChannel() const;
474 + void setWebChannel(QWebChannel *);
475 ++ QColor backgroundColor() const;
476 ++ void setBackgroundColor(const QColor &color);
477 +
478 + Q_SIGNALS:
479 + void loadStarted();
480 +diff --git a/qtwebengine/src/webenginewidgets/api/qwebenginepage_p.h b/src/webenginewidgets/api/qwebenginepage_p.h
481 +index 8f45ecd..7d74d3f 100644
482 +--- a/qtwebengine/src/webenginewidgets/api/qwebenginepage_p.h
483 ++++ b/qtwebengine/src/webenginewidgets/api/qwebenginepage_p.h
484 +@@ -118,6 +118,7 @@ public:
485 + virtual void selectionChanged() Q_DECL_OVERRIDE;
486 + virtual QRectF viewportRect() const Q_DECL_OVERRIDE;
487 + virtual qreal dpiScale() const Q_DECL_OVERRIDE;
488 ++ virtual QColor backgroundColor() const Q_DECL_OVERRIDE;
489 + virtual void loadStarted(const QUrl &provisionalUrl, bool isErrorPage = false) Q_DECL_OVERRIDE;
490 + virtual void loadCommitted() Q_DECL_OVERRIDE;
491 + virtual void loadVisuallyCommitted() Q_DECL_OVERRIDE { }
492 +@@ -170,6 +171,7 @@ public:
493 + QtWebEngineCore::WebEngineContextMenuData m_menuData;
494 + bool isLoading;
495 + QWebEngineScriptCollection scriptCollection;
496 ++ QColor m_backgroundColor;
497 +
498 + mutable CallbackDirectory m_callbacks;
499 + mutable QAction *actions[QWebEnginePage::WebActionCount];
500 +diff --git a/qtwebengine/src/webenginewidgets/render_widget_host_view_qt_delegate_widget.cpp b/src/webenginewidgets/render_widget_host_view_qt_delegate_widget.cpp
501 +index dba37ce..76ca8d3 100644
502 +--- a/qtwebengine/src/webenginewidgets/render_widget_host_view_qt_delegate_widget.cpp
503 ++++ b/qtwebengine/src/webenginewidgets/render_widget_host_view_qt_delegate_widget.cpp
504 +@@ -59,6 +59,7 @@ RenderWidgetHostViewQtDelegateWidget::RenderWidgetHostViewQtDelegateWidget(Rende
505 + , m_rootNode(new QSGRootNode)
506 + , m_sgEngine(new QSGEngine)
507 + , m_isPopup(false)
508 ++ , m_clearColor(Qt::white)
509 + {
510 + setFocusPolicy(Qt::StrongFocus);
511 +
512 +@@ -218,6 +219,19 @@ void RenderWidgetHostViewQtDelegateWidget::setTooltip(const QString &tooltip)
513 + setToolTip(wrappedTip);
514 + }
515 +
516 ++void RenderWidgetHostViewQtDelegateWidget::setClearColor(const QColor &color)
517 ++{
518 ++ m_clearColor = color;
519 ++ // QOpenGLWidget is usually blended by punching holes into widgets
520 ++ // above it to simulate the visual stacking order. If we want it to be
521 ++ // transparent we have to throw away the proper stacking order and always
522 ++ // blend the complete normal widgets backing store under it.
523 ++ bool isTranslucent = color.alpha() < 255;
524 ++ setAttribute(Qt::WA_AlwaysStackOnTop, isTranslucent);
525 ++ setAttribute(Qt::WA_OpaquePaintEvent, !isTranslucent);
526 ++ update();
527 ++}
528 ++
529 + QVariant RenderWidgetHostViewQtDelegateWidget::inputMethodQuery(Qt::InputMethodQuery query) const
530 + {
531 + return m_client->inputMethodQuery(query);
532 +@@ -270,7 +284,7 @@ void RenderWidgetHostViewQtDelegateWidget::initializeGL()
533 + m_sgEngine->initialize(QOpenGLContext::currentContext());
534 + m_sgRenderer.reset(m_sgEngine->createRenderer());
535 + m_sgRenderer->setRootNode(m_rootNode.data());
536 +- m_sgRenderer->setClearColor(Qt::white);
537 ++ m_sgRenderer->setClearColor(m_clearColor);
538 + }
539 +
540 + void RenderWidgetHostViewQtDelegateWidget::paintGL()
541 +diff --git a/qtwebengine/src/webenginewidgets/render_widget_host_view_qt_delegate_widget.h b/src/webenginewidgets/render_widget_host_view_qt_delegate_widget.h
542 +index d0dfdc6..d228bd4 100644
543 +--- a/qtwebengine/src/webenginewidgets/render_widget_host_view_qt_delegate_widget.h
544 ++++ b/qtwebengine/src/webenginewidgets/render_widget_host_view_qt_delegate_widget.h
545 +@@ -78,6 +78,7 @@ public:
546 + virtual void move(const QPoint &screenPos) Q_DECL_OVERRIDE;
547 + virtual void inputMethodStateChanged(bool editorVisible) Q_DECL_OVERRIDE;
548 + virtual void setTooltip(const QString &tooltip) Q_DECL_OVERRIDE;
549 ++ virtual void setClearColor(const QColor &color) Q_DECL_OVERRIDE;
550 +
551 + protected:
552 + bool event(QEvent *event) Q_DECL_OVERRIDE;
553 +@@ -98,6 +99,7 @@ private:
554 + QScopedPointer<QSGEngine> m_sgEngine;
555 + QScopedPointer<QSGAbstractRenderer> m_sgRenderer;
556 + bool m_isPopup;
557 ++ QColor m_clearColor;
558 + QList<QMetaObject::Connection> m_windowConnections;
559 + };
560 +
561 +--
562 +2.3.3
563 +
564 +
565
566 diff --git a/dev-qt/qtwebengine/files/0004-qtwebengine-transparency-window-creation.patch b/dev-qt/qtwebengine/files/0004-qtwebengine-transparency-window-creation.patch
567 new file mode 100644
568 index 0000000..3c13209
569 --- /dev/null
570 +++ b/dev-qt/qtwebengine/files/0004-qtwebengine-transparency-window-creation.patch
571 @@ -0,0 +1,44 @@
572 +rom e62ab19d897155bb10f4c7a2a99b901b458361b5 Mon Sep 17 00:00:00 2001
573 +From: Jocelyn Turcotte <jturcotte@×××××.com>
574 +Date: Mon, 20 Jul 2015 12:06:59 +0200
575 +Subject: [PATCH] Fix a crash on new windows
576 +
577 +Fixes a regression of 99e98f7bf6aec78fe0d647fb898e65d13ff522e4
578 +by delaying applying the background color if the client hasn't
579 +been set on the WebContentsViewQt yet.
580 +
581 +Task-number: QTBUG-41960
582 +Change-Id: I1c138777f616541179976570d8c29f8f4d49ecbf
583 +---
584 + qtwebengine/src/core/web_contents_view_qt.cpp | 9 ++++++---
585 + 1 file changed, 6 insertions(+), 3 deletions(-)
586 +
587 +diff --git a/qtwebengine/src/core/web_contents_view_qt.cpp b/src/core/web_contents_view_qt.cpp
588 +index aad44c1..c327534 100644
589 +--- a/qtwebengine/src/core/web_contents_view_qt.cpp
590 ++++ b/qtwebengine/src/core/web_contents_view_qt.cpp
591 +@@ -53,8 +53,10 @@ void WebContentsViewQt::initialize(WebContentsAdapterClient* client)
592 + m_factoryClient = client;
593 +
594 + // Check if a RWHV was created before the initialization.
595 +- if (m_webContents->GetRenderWidgetHostView())
596 +- static_cast<RenderWidgetHostViewQt *>(m_webContents->GetRenderWidgetHostView())->setAdapterClient(client);
597 ++ if (auto rwhv = static_cast<RenderWidgetHostViewQt *>(m_webContents->GetRenderWidgetHostView())) {
598 ++ rwhv->setAdapterClient(client);
599 ++ rwhv->SetBackgroundColor(toSk(client->backgroundColor()));
600 ++ }
601 + }
602 +
603 + content::RenderWidgetHostViewBase* WebContentsViewQt::CreateViewForWidget(content::RenderWidgetHost* render_widget_host, bool is_guest_view_hack)
604 +@@ -86,7 +88,8 @@ void WebContentsViewQt::RenderViewCreated(content::RenderViewHost* host)
605 + {
606 + // The render process is done creating the RenderView and it's ready to be routed
607 + // messages at this point.
608 +- host->GetView()->SetBackgroundColor(toSk(m_client->backgroundColor()));
609 ++ if (m_client)
610 ++ host->GetView()->SetBackgroundColor(toSk(m_client->backgroundColor()));
611 + }
612 +
613 + void WebContentsViewQt::CreateView(const gfx::Size& initial_size, gfx::NativeView context)
614 +--
615 +2.3.3
616
617 diff --git a/dev-qt/qtwebengine/metadata.xml b/dev-qt/qtwebengine/metadata.xml
618 new file mode 100644
619 index 0000000..10b4149
620 --- /dev/null
621 +++ b/dev-qt/qtwebengine/metadata.xml
622 @@ -0,0 +1,13 @@
623 +<?xml version="1.0" encoding="UTF-8"?>
624 +<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
625 +<pkgmetadata>
626 + <herd>qt</herd>
627 + <use>
628 + <flag name="qml">Build QML/QtQuick bindings and imports</flag>
629 + <flag name="pmp">Apply necessary patches to support <pkg>media-tv/plex-media-player</pkg></flag>
630 + </use>
631 + <upstream>
632 + <bugs-to>https://bugreports.qt.io/</bugs-to>
633 + <doc>http://doc.qt.io/</doc>
634 + </upstream>
635 +</pkgmetadata>
636
637 diff --git a/dev-qt/qtwebengine/qtwebengine-5.5.1.ebuild b/dev-qt/qtwebengine/qtwebengine-5.5.1.ebuild
638 new file mode 100644
639 index 0000000..67b5d7e
640 --- /dev/null
641 +++ b/dev-qt/qtwebengine/qtwebengine-5.5.1.ebuild
642 @@ -0,0 +1,40 @@
643 +# Copyright 1999-2015 Gentoo Foundation
644 +# Distributed under the terms of the GNU General Public License v2
645 +# $Id$
646 +
647 +EAPI=5
648 +
649 +PYTHON_COMPAT=( python2_7 )
650 +
651 +inherit python-any-r1 qt5-build
652 +
653 +DESCRIPTION="Support library for rendering dynamic web content in Qt5 C++ and QML applications"
654 +
655 +if [[ ${QT5_BUILD_TYPE} == release ]]; then
656 + KEYWORDS="~amd64 ~x86"
657 +fi
658 +
659 +IUSE="qml pmp"
660 +
661 +DEPEND="
662 + ${PYTHON_DEPS}
663 + >=dev-qt/qtcore-${PV}:5
664 + qml? ( >=dev-qt/qtdeclarative-${PV}:5 )
665 + >=dev-qt/qtwebchannel-${PV}:5
666 + >=dev-qt/qtxmlpatterns-${PV}:5
667 + dev-libs/nss
668 + x11-libs/libXcomposite
669 + x11-libs/libXcursor
670 + x11-libs/libXtst
671 +"
672 +RDEPEND="${DEPEND}"
673 +
674 +src_prepare() {
675 + use pmp && epatch "${FILESDIR}"/0001-qtwebengine-Add-a-backgroundColor-property.patch
676 + use pmp && epatch "${FILESDIR}"/0004-qtwebengine-transparency-window-creation.patch
677 +
678 + qt_use_disable_mod qml quick src/src.pro
679 + qt_use_disable_mod qml qml src/webengine/webengine.pro
680 +
681 + qt5-build_src_prepare
682 +}