commit 156d1d59571e5ce5507086c9e8c67d776b030bed Author: Danny Rawlins <monster.romster@gmail.com> Date: Fri Sep 27 16:23:30 2019 +1000 qtwebengine: Fix QWebEnginePage visibility state, Fix build with pulseaudio 13 diff --git a/qtwebengine/.signature b/qtwebengine/.signature index 54ca91d2c..676e58254 100644 --- a/qtwebengine/.signature +++ b/qtwebengine/.signature @@ -1,6 +1,7 @@ untrusted comment: verify with /etc/ports/opt.pub -RWSE3ohX2g5d/VL9GzF8BDDWMV4nLFfTRpoNt18EHYcKpl0ljpUVQd9gTb8E9UJfao/UEnsBZNfVPlEZQkPAxr0Co3XSY1FUzgY= -SHA256 (Pkgfile) = dc90534fd87a42888f5d4b47c9bd6c02af3492c9bc9295efbd2c564cbeec3b80 +RWSE3ohX2g5d/XOgoK2xJRQhSy6dL6ie/EJ0F05Wh6ghz9lBZCTwRNaJ3csVH5uZrhKGIJlT/m9Ag0/g9fBEJ2PiSrBI3tOpSAU= +SHA256 (Pkgfile) = 36743ad3ba87ed5daca739bf8817770b3fbfe262576521d4ea8b200ded4d71b9 SHA256 (.footprint) = 011d75dda5a4a45ad3e4f9cf04e555e0076381d064321871da0e07cf74caa6f0 SHA256 (qtwebengine-everywhere-src-5.13.1.tar.xz) = 7f12e710b76ff2be4497bf368fc01ecd2419e2e962fb90599b0ece00ae2eb7d0 -SHA256 (qtbug-77037.patch) = 3e3bb8ecf292e7f249d001db4a4a072ca4ba38f713f496122bd7c73d93d5def9 +SHA256 (qtbug-77037.patch) = 7ed06cc2d0e3cc86df33bb80468a5f0422ed2cc5985db86444949ef3b9a12f02 +SHA256 (qtbug-77209.patch) = 9773e1fed9b8998dd800ea89315b4ea70ed81b568b0a740945ac76577c62e6f1 diff --git a/qtwebengine/Pkgfile b/qtwebengine/Pkgfile index 9152f64f1..339dd01eb 100644 --- a/qtwebengine/Pkgfile +++ b/qtwebengine/Pkgfile @@ -5,15 +5,20 @@ name=qtwebengine version=5.13.1 -release=1 +release=2 source=(https://download.qt.io/official_releases/qt/${version::4}/$version/submodules/$name-everywhere-src-$version.tar.xz - qtbug-77037.patch) + qtbug-77037.patch qtbug-77209.patch) build() { cd $name-everywhere-src-$version + # https://bugreports.qt.io/browse/QTBUG-77209 + # https://code.qt.io/cgit/qt/qtwebengine.git/patch/?id=1c33a4a6 + patch -p1 -i $SRC/qtbug-77209.patch # Fix QWebEnginePage visibility state + # https://bugreports.qt.io/browse/QTBUG-77037 - patch -p1 -i $SRC/qtbug-77037.patch + # https://code.qt.io/cgit/qt/qtwebengine-chromium.git/patch/?id=0b57f159 + patch -p1 -d src/3rdparty -i $SRC/qtbug-77037.patch # Fix build with pulseaudio 13 # Ninja, by default, sets the number of jobs to the number of availalble threads test -n "$JOBS" && export NINJAFLAGS+=" -j $JOBS" diff --git a/qtwebengine/qtbug-77037.patch b/qtwebengine/qtbug-77037.patch index 8f874c20b..4dac59a9a 100644 --- a/qtwebengine/qtbug-77037.patch +++ b/qtwebengine/qtbug-77037.patch @@ -1,11 +1,89 @@ ---- qtwebengine-everywhere-src-5.13.0/src/core/config/linux.pri.orig 2019-08-06 08:23:45.385072740 +0300 -+++ qtwebengine-everywhere-src-5.13.0/src/core/config/linux.pri 2019-08-06 08:23:51.085237082 +0300 -@@ -162,7 +162,7 @@ host_build { - qtConfig(webengine-system-harfbuzz): gn_args += use_system_harfbuzz=true - !qtConfig(webengine-system-glib): gn_args += use_glib=false - qtConfig(webengine-pulseaudio) { -- gn_args += use_pulseaudio=true -+ gn_args += use_pulseaudio=true link_pulseaudio=true - } else { - gn_args += use_pulseaudio=false - } +From 0b57f15958f07ef12c8944d6db7a33a6fe9d9c59 Mon Sep 17 00:00:00 2001 +From: Allan Sandfeld Jensen <allan.jensen@qt.io> +Date: Mon, 23 Sep 2019 13:49:53 +0200 +Subject: Fix building with pulseaudio 13 +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +The function signature changed though the ABI stayed the same. + +Change-Id: I86ca361b5e4f0c523e1031910df438c23beee876 +Fixes: QTBUG-77037 +Reviewed-by: Jüri Valdmann <juri.valdmann@qt.io> +--- + chromium/media/audio/pulse/pulse.sigs | 16 ++++++++-------- + chromium/media/audio/pulse/pulse_stub_header.fragment | 11 +++++++++++ + 2 files changed, 19 insertions(+), 8 deletions(-) + +diff --git a/chromium/media/audio/pulse/pulse.sigs b/chromium/media/audio/pulse/pulse.sigs +index 8b5888786a9..daaeb149c13 100644 +--- a/chromium/media/audio/pulse/pulse.sigs ++++ b/chromium/media/audio/pulse/pulse.sigs +@@ -24,11 +24,11 @@ pa_operation* pa_context_get_source_info_by_index(pa_context* c, uint32_t idx, p + pa_operation* pa_context_get_source_info_by_name(pa_context* c, const char* name, pa_source_info_cb_t cb, void *userdata); + pa_operation* pa_context_get_source_info_list(pa_context* c, pa_source_info_cb_t cb, void* userdata); + pa_operation* pa_context_get_sink_info_list(pa_context* c, pa_sink_info_cb_t cb, void* userdata); +-pa_context_state_t pa_context_get_state(pa_context* c); ++pa_context_state_t pa_context_get_state(const_pa_context_ptr c); + pa_context* pa_context_new(pa_mainloop_api* mainloop, const char* name); + pa_operation* pa_context_set_source_volume_by_index(pa_context* c, uint32_t idx, const pa_cvolume* volume, pa_context_success_cb_t cb, void* userdata); + void pa_context_set_state_callback(pa_context* c, pa_context_notify_cb_t cb, void* userdata); +-pa_operation_state_t pa_operation_get_state(pa_operation* o); ++pa_operation_state_t pa_operation_get_state(const_pa_operation_ptr o); + void pa_context_unref(pa_context* c); + void pa_operation_unref(pa_operation* o); + int pa_stream_begin_write(pa_stream* p, void** data, size_t* nbytes); +@@ -38,23 +38,23 @@ pa_operation* pa_stream_cork(pa_stream* s, int b, pa_stream_success_cb_t cb, voi + int pa_stream_disconnect(pa_stream* s); + int pa_stream_drop(pa_stream *p); + pa_operation* pa_stream_flush(pa_stream* s, pa_stream_success_cb_t cb, void* userdata); +-uint32_t pa_stream_get_device_index(pa_stream* s); ++uint32_t pa_stream_get_device_index(const_pa_stream_ptr s); + int pa_stream_get_latency(pa_stream* s, pa_usec_t* r_usec, int* negative); +-pa_stream_state_t pa_stream_get_state(pa_stream* p); ++pa_stream_state_t pa_stream_get_state(const_pa_stream_ptr p); + pa_stream* pa_stream_new(pa_context* c, const char* name, const pa_sample_spec* ss, const pa_channel_map * map); + pa_stream* pa_stream_new_with_proplist(pa_context* c, const char* name, const pa_sample_spec* ss, const pa_channel_map* map, pa_proplist* p); + pa_proplist* pa_proplist_new(void); +-int pa_proplist_contains(pa_proplist* p, const char* key); ++int pa_proplist_contains(const_pa_proplist_ptr p, const char* key); + void pa_proplist_free(pa_proplist* p); +-const char* pa_proplist_gets(pa_proplist* p, const char* key); ++const char* pa_proplist_gets(const_pa_proplist_ptr p, const char* key); + int pa_proplist_sets(pa_proplist* p, const char* key, const char* value); +-size_t pa_stream_readable_size(pa_stream *p); ++size_t pa_stream_readable_size(const_pa_stream_ptr p); + int pa_stream_peek(pa_stream* p, const void** data, size_t* nbytes); + void pa_stream_set_read_callback(pa_stream* p, pa_stream_request_cb_t cb, void* userdata); + void pa_stream_set_state_callback(pa_stream* s, pa_stream_notify_cb_t cb, void* userdata); + int pa_stream_write(pa_stream* p, const void* data, size_t nbytes, pa_free_cb_t free_cb, int64_t offset, pa_seek_mode_t seek); + void pa_stream_set_write_callback(pa_stream *p, pa_stream_request_cb_t cb, void *userdata); + void pa_stream_unref(pa_stream* s); +-int pa_context_errno(pa_context *c); ++int pa_context_errno(const_pa_context_ptr c); + const char* pa_strerror(int error); + pa_cvolume* pa_cvolume_set(pa_cvolume* a, unsigned channels, pa_volume_t v); +diff --git a/chromium/media/audio/pulse/pulse_stub_header.fragment b/chromium/media/audio/pulse/pulse_stub_header.fragment +index 2a2d3e7552b..cdaa841b29f 100644 +--- a/chromium/media/audio/pulse/pulse_stub_header.fragment ++++ b/chromium/media/audio/pulse/pulse_stub_header.fragment +@@ -5,4 +5,15 @@ extern "C" { + + #include <pulse/pulseaudio.h> + ++#if PA_MAJOR > 12 ++typedef const pa_context* const_pa_context_ptr; ++typedef const pa_operation* const_pa_operation_ptr; ++typedef const pa_proplist* const_pa_proplist_ptr; ++typedef const pa_stream* const_pa_stream_ptr; ++#else ++typedef pa_context* const_pa_context_ptr; ++typedef pa_operation* const_pa_operation_ptr; ++typedef pa_proplist* const_pa_proplist_ptr; ++typedef pa_stream* const_pa_stream_ptr; ++#endif + } +-- +cgit v1.2.1 + diff --git a/qtwebengine/qtbug-77209.patch b/qtwebengine/qtbug-77209.patch new file mode 100644 index 000000000..2585c1202 --- /dev/null +++ b/qtwebengine/qtbug-77209.patch @@ -0,0 +1,124 @@ +From 1c33a4a6ae07106513a8105ebbc2d0c65363b333 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?J=C3=BCri=20Valdmann?= <juri.valdmann@qt.io> +Date: Mon, 29 Jul 2019 13:10:14 +0200 +Subject: Fix QWebEnginePage visibility state + +Calling + + view.show(); + view.load(...); + view.hide(); + +results in a WebContents in visible state because the first call to show() is +delayed via a timer and never canceled so it takes effect after the hide(). + +Also, the page's visibility state is not updated when changing views, so that a +visible QWebEngineView can be set to display a hidden QWebEnginePage. + +Fixes: QTBUG-77209 +Change-Id: I0243c659f4039a35c36e04ea55c5972666170fd0 +Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io> +--- + src/webenginewidgets/api/qwebenginepage.cpp | 4 ++- + src/webenginewidgets/api/qwebengineview.cpp | 3 ++ + .../widgets/qwebengineview/tst_qwebengineview.cpp | 34 ++++++++++++++++++++++ + 3 files changed, 40 insertions(+), 1 deletion(-) + +diff --git a/src/webenginewidgets/api/qwebenginepage.cpp b/src/webenginewidgets/api/qwebenginepage.cpp +index f252137a..8451bab1 100644 +--- a/src/webenginewidgets/api/qwebenginepage.cpp ++++ b/src/webenginewidgets/api/qwebenginepage.cpp +@@ -175,7 +175,6 @@ QWebEnginePagePrivate::QWebEnginePagePrivate(QWebEngineProfile *_profile) + wasShownTimer.setSingleShot(true); + QObject::connect(&wasShownTimer, &QTimer::timeout, [this](){ + ensureInitialized(); +- wasShown(); + }); + + profile->d_ptr->addWebContentsAdapterClient(this); +@@ -215,6 +214,9 @@ void QWebEnginePagePrivate::initializationFinished() + if (!qFuzzyCompare(adapter->currentZoomFactor(), defaultZoomFactor)) + adapter->setZoomFactor(defaultZoomFactor); + ++ if (view && view->isVisible()) ++ adapter->wasShown(); ++ + scriptCollection.d->initializationFinished(adapter); + + m_isBeingAdopted = false; +diff --git a/src/webenginewidgets/api/qwebengineview.cpp b/src/webenginewidgets/api/qwebengineview.cpp +index 6c08df34..6e113852 100644 +--- a/src/webenginewidgets/api/qwebengineview.cpp ++++ b/src/webenginewidgets/api/qwebengineview.cpp +@@ -61,6 +61,7 @@ void QWebEngineViewPrivate::pageChanged(QWebEnginePage *oldPage, QWebEnginePage + Q_Q(QWebEngineView); + + if (oldPage) { ++ oldPage->d_ptr->wasHidden(); + oldPage->disconnect(q); + } + +@@ -74,6 +75,8 @@ void QWebEngineViewPrivate::pageChanged(QWebEnginePage *oldPage, QWebEnginePage + QObject::connect(newPage, &QWebEnginePage::loadFinished, q, &QWebEngineView::loadFinished); + QObject::connect(newPage, &QWebEnginePage::selectionChanged, q, &QWebEngineView::selectionChanged); + QObject::connect(newPage, &QWebEnginePage::renderProcessTerminated, q, &QWebEngineView::renderProcessTerminated); ++ if (q->isVisible()) ++ newPage->d_ptr->wasShown(); + } + + auto oldUrl = oldPage ? oldPage->url() : QUrl(); +diff --git a/tests/auto/widgets/qwebengineview/tst_qwebengineview.cpp b/tests/auto/widgets/qwebengineview/tst_qwebengineview.cpp +index a7ff05f5..1bb65d7d 100644 +--- a/tests/auto/widgets/qwebengineview/tst_qwebengineview.cpp ++++ b/tests/auto/widgets/qwebengineview/tst_qwebengineview.cpp +@@ -192,6 +192,8 @@ private Q_SLOTS: + void webUIURLs_data(); + void webUIURLs(); + void visibilityState(); ++ void visibilityState2(); ++ void visibilityState3(); + void jsKeyboardEvent(); + void deletePage(); + void closeOpenerTab(); +@@ -3106,6 +3108,38 @@ void tst_QWebEngineView::visibilityState() + QCOMPARE(evaluateJavaScriptSync(view.page(), "document.visibilityState").toString(), QStringLiteral("visible")); + } + ++void tst_QWebEngineView::visibilityState2() ++{ ++ QWebEngineView view; ++ QSignalSpy spy(&view, &QWebEngineView::loadFinished); ++ view.show(); ++ view.load(QStringLiteral("about:blank")); ++ view.hide(); ++ QVERIFY(spy.count() || spy.wait()); ++ QVERIFY(spy.takeFirst().takeFirst().toBool()); ++ QCOMPARE(evaluateJavaScriptSync(view.page(), "document.visibilityState").toString(), QStringLiteral("hidden")); ++} ++ ++void tst_QWebEngineView::visibilityState3() ++{ ++ QWebEnginePage page1; ++ QWebEnginePage page2; ++ QSignalSpy spy1(&page1, &QWebEnginePage::loadFinished); ++ QSignalSpy spy2(&page2, &QWebEnginePage::loadFinished); ++ page1.load(QStringLiteral("about:blank")); ++ page2.load(QStringLiteral("about:blank")); ++ QVERIFY(spy1.count() || spy1.wait()); ++ QVERIFY(spy2.count() || spy2.wait()); ++ QWebEngineView view; ++ view.setPage(&page1); ++ view.show(); ++ QCOMPARE(evaluateJavaScriptSync(&page1, "document.visibilityState").toString(), QStringLiteral("visible")); ++ QCOMPARE(evaluateJavaScriptSync(&page2, "document.visibilityState").toString(), QStringLiteral("hidden")); ++ view.setPage(&page2); ++ QCOMPARE(evaluateJavaScriptSync(&page1, "document.visibilityState").toString(), QStringLiteral("hidden")); ++ QCOMPARE(evaluateJavaScriptSync(&page2, "document.visibilityState").toString(), QStringLiteral("visible")); ++} ++ + void tst_QWebEngineView::jsKeyboardEvent() + { + QWebEngineView view; +-- +cgit v1.2.1 +