diff options
-rw-r--r-- | src/core/render_widget_host_view_qt.cpp | 2 | ||||
-rw-r--r-- | tests/auto/widgets/qwebenginepage/CMakeLists.txt | 1 | ||||
-rw-r--r-- | tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp | 24 |
3 files changed, 26 insertions, 1 deletions
diff --git a/src/core/render_widget_host_view_qt.cpp b/src/core/render_widget_host_view_qt.cpp index 0defad04a..145494151 100644 --- a/src/core/render_widget_host_view_qt.cpp +++ b/src/core/render_widget_host_view_qt.cpp @@ -386,7 +386,7 @@ void RenderWidgetHostViewQt::UpdateBackgroundColor() m_rootLayer->SetColor(color); m_uiCompositor->SetBackgroundColor(color); - if (color == SK_ColorTRANSPARENT) + if (color == SK_ColorTRANSPARENT && host()->owner_delegate()) host()->owner_delegate()->SetBackgroundOpaque(false); } diff --git a/tests/auto/widgets/qwebenginepage/CMakeLists.txt b/tests/auto/widgets/qwebenginepage/CMakeLists.txt index a15bb6e06..e26a0165b 100644 --- a/tests/auto/widgets/qwebenginepage/CMakeLists.txt +++ b/tests/auto/widgets/qwebenginepage/CMakeLists.txt @@ -9,6 +9,7 @@ qt_internal_add_test(tst_qwebenginepage tst_qwebenginepage.cpp LIBRARIES Qt::CorePrivate + Qt::GuiPrivate Qt::NetworkPrivate Qt::WebEngineCorePrivate Qt::WebEngineWidgets diff --git a/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp b/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp index 748d9f494..e831f2a56 100644 --- a/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp +++ b/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp @@ -41,6 +41,8 @@ # include <QStateMachine> #endif #include <QtGui/QClipboard> +#include <QtGui/qpa/qplatformintegration.h> +#include <QtGui/private/qguiapplication_p.h> #include <QtTest/QtTest> #include <QTextCharFormat> #if QT_CONFIG(webengine_webchannel) @@ -259,6 +261,7 @@ private Q_SLOTS: void renderProcessCrashed(); void renderProcessPid(); void backgroundColor(); + void popupOnTransparentBackground(); void audioMuted(); void closeContents(); void isSafeRedirect_data(); @@ -5024,6 +5027,27 @@ void tst_QWebEnginePage::backgroundColor() QTRY_COMPARE(view.grab().toImage().pixelColor(center), Qt::green); } +void tst_QWebEnginePage::popupOnTransparentBackground() +{ + if (!QGuiApplicationPrivate::platformIntegration()->hasCapability( + QPlatformIntegration::WindowActivation)) + QSKIP("Cannot test on platforms without window activation capability"); + + QWebEngineView view; + view.resize(640, 480); + view.page()->setBackgroundColor(Qt::transparent); + view.show(); + QVERIFY(QTest::qWaitForWindowExposed(&view)); + QSignalSpy spyLoadFinished(&view, SIGNAL(loadFinished(bool))); + view.setHtml(QLatin1String("<html><head></head><body><select id='foo' name='meow'>" + "<option>fran</option><option>troz</option>" + "</select></body></html>")); + QTRY_COMPARE(spyLoadFinished.size(), 1); + makeClick(view.windowHandle(), false, elementCenter(view.page(), "foo")); + QPointer<QWidget> popup; + QTRY_VERIFY((popup = QApplication::activePopupWidget())); +} + void tst_QWebEnginePage::audioMuted() { QWebEngineProfile profile; |