diff options
Diffstat (limited to 'src')
29 files changed, 150 insertions, 80 deletions
diff --git a/src/3rdparty b/src/3rdparty -Subproject c34649b6774ea6cd162049e1242abece13f3a1a +Subproject 2366767e6c6f333ef090667aa6838d6781725a7 diff --git a/src/buildtools/gn.pro b/src/buildtools/gn.pro index 9d9af9eb8..f66f4bd68 100644 --- a/src/buildtools/gn.pro +++ b/src/buildtools/gn.pro @@ -7,11 +7,11 @@ include($$QTWEBENGINE_OUT_ROOT/qtwebengine-config.pri) QT_FOR_CONFIG += webengine webengine-private build_pass|!debug_and_release { - !qtConfig(system-gn): CONFIG(release, debug|release) { + !qtConfig(webengine-system-gn): CONFIG(release, debug|release) { buildgn.target = build_gn gn_args = $$gnArgs() out = $$gnPath() - !qtConfig(system-ninja): ninja_path = "--path $$ninjaPath()" + !qtConfig(webengine-system-ninja): ninja_path = "--path $$ninjaPath()" # check if it is not already build !exists($$out) { mkpath($$dirname(out)) diff --git a/src/buildtools/ninja.pro b/src/buildtools/ninja.pro index c99513f85..1b15bcb6b 100644 --- a/src/buildtools/ninja.pro +++ b/src/buildtools/ninja.pro @@ -7,7 +7,7 @@ QT_FOR_CONFIG += webengine-private build_pass|!debug_and_release { - !qtConfig(system-ninja): CONFIG(release, debug|release) { + !qtConfig(webengine-system-ninja): CONFIG(release, debug|release) { out = $$ninjaPath() # check if it is not already build !exists($$out) { diff --git a/src/core/config/common.pri b/src/core/config/common.pri index e7010a13a..c1d5331ab 100644 --- a/src/core/config/common.pri +++ b/src/core/config/common.pri @@ -14,7 +14,7 @@ gn_args += \ enable_swiftshader=false \ use_custom_libcxx=false -qtConfig(printing-and-pdf) { +qtConfig(webengine-printing-and-pdf) { gn_args += enable_basic_printing=true enable_print_preview=true gn_args += enable_pdf=true } else { @@ -22,25 +22,25 @@ qtConfig(printing-and-pdf) { gn_args += enable_pdf=false } -qtConfig(pepper-plugins) { +qtConfig(webengine-pepper-plugins) { gn_args += enable_plugins=true enable_widevine=true } else { gn_args += enable_plugins=false enable_widevine=false } -qtConfig(spellchecker) { +qtConfig(webengine-spellchecker) { gn_args += enable_spellcheck=true } else { gn_args += enable_spellcheck=false } -qtConfig(webrtc) { +qtConfig(webengine-webrtc) { gn_args += enable_webrtc=true } else { gn_args += enable_webrtc=false } -qtConfig(proprietary-codecs): gn_args += proprietary_codecs=true ffmpeg_branding=\"Chrome\" +qtConfig(webengine-proprietary-codecs): gn_args += proprietary_codecs=true ffmpeg_branding=\"Chrome\" CONFIG(release, debug|release) { force_debug_info { diff --git a/src/core/config/linux.pri b/src/core/config/linux.pri index 78f3e5093..c5329dfcc 100644 --- a/src/core/config/linux.pri +++ b/src/core/config/linux.pri @@ -115,20 +115,21 @@ host_build { gn_args += host_pkg_config=\"pkg-config\" } - qtConfig(webengine-system-zlib): qtConfig(system-minizip) { + qtConfig(webengine-system-zlib): qtConfig(webengine-system-minizip) { gn_args += use_system_zlib=true use_system_minizip=true + qtConfig(printing-and-pdf): gn_args += pdfium_use_system_zlib=true } qtConfig(webengine-system-png): gn_args += use_system_libpng=true qtConfig(system-jpeg): gn_args += use_system_libjpeg=true qtConfig(system-freetype): gn_args += use_system_freetype=true qtConfig(webengine-system-harfbuzz): gn_args += use_system_harfbuzz=true - qtConfig(system-glib): gn_args += use_glib=false - qtConfig(pulseaudio) { + qtConfig(webengine-system-glib): gn_args += use_glib=false + qtConfig(webengine-pulseaudio) { gn_args += use_pulseaudio=true } else { gn_args += use_pulseaudio=false } - qtConfig(alsa) { + qtConfig(webengine-alsa) { gn_args += use_alsa=true } else { gn_args += use_alsa=false @@ -138,18 +139,19 @@ host_build { !packagesExist(libpci): gn_args += use_libpci=false !packagesExist(xscrnsaver): gn_args += use_xscrnsaver=false - qtConfig(system-libevent): gn_args += use_system_libevent=true - qtConfig(system-libwebp): gn_args += use_system_libwebp=true - qtConfig(system-libxml2): gn_args += use_system_libxml=true use_system_libxslt=true - qtConfig(system-opus): gn_args += use_system_opus=true - qtConfig(system-snappy): gn_args += use_system_snappy=true - qtConfig(system-libvpx): gn_args += use_system_libvpx=true - qtConfig(system-icu): gn_args += use_system_icu=true icu_use_data_file=false - qtConfig(system-ffmpeg): gn_args += use_system_ffmpeg=true - qtConfig(system-re2): gn_args += use_system_re2=true + qtConfig(webengine-system-libevent): gn_args += use_system_libevent=true + qtConfig(webengine-system-libwebp): gn_args += use_system_libwebp=true + qtConfig(webengine-system-libxml2): gn_args += use_system_libxml=true use_system_libxslt=true + qtConfig(webengine-system-opus): gn_args += use_system_opus=true + qtConfig(webengine-system-snappy): gn_args += use_system_snappy=true + qtConfig(webengine-system-libvpx): gn_args += use_system_libvpx=true + qtConfig(webengine-system-icu): gn_args += use_system_icu=true icu_use_data_file=false + qtConfig(webengine-system-ffmpeg): gn_args += use_system_ffmpeg=true + qtConfig(webengine-system-re2): gn_args += use_system_re2=true + qtConfig(webengine-system-lcms2): gn_args += use_system_lcms2=true # FIXME: - #qtConfig(system-protobuf): gn_args += use_system_protobuf=true - #qtConfig(system-jsoncpp): gn_args += use_system_jsoncpp=true - #qtConfig(system-libsrtp: gn_args += use_system_libsrtp=true + #qtConfig(webengine-system-protobuf): gn_args += use_system_protobuf=true + #qtConfig(webengine-system-jsoncpp): gn_args += use_system_jsoncpp=true + #qtConfig(webengine-system-libsrtp: gn_args += use_system_libsrtp=true } diff --git a/src/core/config/mac_osx.pri b/src/core/config/mac_osx.pri index 57f301f18..2d820c889 100644 --- a/src/core/config/mac_osx.pri +++ b/src/core/config/mac_osx.pri @@ -32,8 +32,8 @@ gn_args += \ toolkit_views=false \ use_external_popup_menu=false -qtConfig(spellchecker) { - qtConfig(native-spellchecker): gn_args += use_browser_spellchecker=true +qtConfig(webengine-spellchecker) { + qtConfig(webengine-native-spellchecker): gn_args += use_browser_spellchecker=true else: gn_args += use_browser_spellchecker=false } else { gn_args += use_browser_spellchecker=false diff --git a/src/core/content_client_qt.cpp b/src/core/content_client_qt.cpp index 1016db0d5..a3a460cb4 100644 --- a/src/core/content_client_qt.cpp +++ b/src/core/content_client_qt.cpp @@ -236,6 +236,7 @@ void AddPepperWidevine(std::vector<content::PepperPluginInfo>* plugins) #elif defined(Q_OS_LINUX) pluginPaths << QStringLiteral("/opt/google/chrome/libwidevinecdmadapter.so") // Google Chrome << QStringLiteral("/usr/lib/chromium/libwidevinecdmadapter.so") // Arch + << QStringLiteral("/usr/lib/chromium-browser/libwidevinecdmadapter.so") // Ubuntu/neon << QStringLiteral("/usr/lib64/chromium/libwidevinecdmadapter.so"); // OpenSUSE style #endif } @@ -257,7 +258,7 @@ void AddPepperWidevine(std::vector<content::PepperPluginInfo>* plugins) std::vector<std::string> codecs; codecs.push_back(kCdmSupportedCodecVp8); codecs.push_back(kCdmSupportedCodecVp9); -#if defined(USE_PROPRIETARY_CODECS) +#if BUILDFLAG(USE_PROPRIETARY_CODECS) codecs.push_back(kCdmSupportedCodecAvc1); #endif // defined(USE_PROPRIETARY_CODECS) std::string codec_string = diff --git a/src/core/core_chromium.pri b/src/core/core_chromium.pri index 8e24645f0..0ec6979c8 100644 --- a/src/core/core_chromium.pri +++ b/src/core/core_chromium.pri @@ -28,7 +28,7 @@ RCC_DIR = $$OUT_PWD/$$getConfigDir()/.rcc # Assume that we want mobile touch and low-end hardware behaviors # whenever we are cross compiling. -qtConfig(embedded): DEFINES += QTWEBENGINE_EMBEDDED_SWITCHES +qtConfig(webengine-embedded-build): DEFINES += QTWEBENGINE_EMBEDDED_SWITCHES qtConfig(egl): CONFIG += egl @@ -186,7 +186,7 @@ HEADERS = \ web_engine_settings.h \ web_event_factory.h -qtConfig(pepper-plugins) { +qtConfig(webengine-pepper-plugins) { SOURCES += \ renderer_host/pepper/pepper_flash_browser_host_qt.cpp \ @@ -203,7 +203,7 @@ qtConfig(pepper-plugins) { renderer/pepper/pepper_renderer_host_factory_qt.h } -qtConfig(printing-and-pdf) { +qtConfig(webengine-printing-and-pdf) { SOURCES += \ printing_message_filter_qt.cpp \ diff --git a/src/core/core_module.pro b/src/core/core_module.pro index 78bb8baee..2409ccb12 100644 --- a/src/core/core_module.pro +++ b/src/core/core_module.pro @@ -115,7 +115,7 @@ icu.files = $$OUT_PWD/$$getConfigDir()/icudtl.dat resources.path = $$[QT_INSTALL_DATA]/resources INSTALLS += locales resources - !qtConfig(system-icu) { + !qtConfig(webengine-system-icu) { icu.CONFIG += no_check_exist icu.path = $$[QT_INSTALL_DATA]/resources INSTALLS += icu @@ -127,7 +127,7 @@ icu.files = $$OUT_PWD/$$getConfigDir()/icudtl.dat # Copy essential files to the qtbase build directory for non-prefix builds # - !qtConfig(system-icu) { + !qtConfig(webengine-system-icu) { COPIES += icu } diff --git a/src/core/gn_run.pro b/src/core/gn_run.pro index a9089c569..dbf859100 100644 --- a/src/core/gn_run.pro +++ b/src/core/gn_run.pro @@ -5,7 +5,7 @@ TEMPLATE = aux qtConfig(debug_and_release): CONFIG += debug_and_release build_all -qtConfig(system-ninja) { +qtConfig(webengine-system-ninja) { QT_TOOL.ninja.binary = ninja } else { QT_TOOL.ninja.binary = $$shell_quote($$shell_path($$ninjaPath())) @@ -35,7 +35,7 @@ build_pass|!debug_and_release { gn_args += "qtwebengine_target=\"$$system_path($$OUT_PWD/$$getConfigDir()):QtWebEngineCore\"" - !qtConfig(system-gn) { + !qtConfig(webengine-system-gn) { gn_binary = $$system_quote($$system_path($$gnPath())) } diff --git a/src/core/render_widget_host_view_qt.cpp b/src/core/render_widget_host_view_qt.cpp index 0f071f89e..80c9121f5 100644 --- a/src/core/render_widget_host_view_qt.cpp +++ b/src/core/render_widget_host_view_qt.cpp @@ -291,7 +291,7 @@ public: float GetHistoricalTouchMajor(size_t pointer_index, size_t historical_index) const override { return 0; } float GetHistoricalX(size_t pointer_index, size_t historical_index) const override { return 0; } float GetHistoricalY(size_t pointer_index, size_t historical_index) const override { return 0; } - ToolType GetToolType(size_t pointer_index) const override { return ui::MotionEvent::TOOL_TYPE_UNKNOWN; } + ToolType GetToolType(size_t pointer_index) const override { return ui::MotionEvent::TOOL_TYPE_FINGER; } int GetButtonState() const override { return 0; } private: @@ -1067,6 +1067,10 @@ bool RenderWidgetHostViewQt::forwardEvent(QEvent *event) case QEvent::InputMethodQuery: handleInputMethodQueryEvent(static_cast<QInputMethodQueryEvent*>(event)); break; + case QEvent::HoverLeave: + case QEvent::Leave: + m_host->ForwardMouseEvent(WebEventFactory::toWebMouseEvent(event)); + break; default: return false; } diff --git a/src/core/renderer/content_renderer_client_qt.cpp b/src/core/renderer/content_renderer_client_qt.cpp index 83c4d719e..5980d7b84 100644 --- a/src/core/renderer/content_renderer_client_qt.cpp +++ b/src/core/renderer/content_renderer_client_qt.cpp @@ -262,11 +262,11 @@ public: return true; case media::EmeInitDataType::CENC: -#if defined(USE_PROPRIETARY_CODECS) +#if BUILDFLAG(USE_PROPRIETARY_CODECS) return true; #else return false; -#endif // defined(USE_PROPRIETARY_CODECS) +#endif // BUILDFLAG(USE_PROPRIETARY_CODECS) case media::EmeInitDataType::UNKNOWN: return false; @@ -277,7 +277,7 @@ public: media::SupportedCodecs GetSupportedCodecs() const override { -#if defined(USE_PROPRIETARY_CODECS) +#if BUILDFLAG(USE_PROPRIETARY_CODECS) return media::EME_CODEC_MP4_ALL | media::EME_CODEC_WEBM_ALL; #else return media::EME_CODEC_WEBM_ALL; @@ -390,10 +390,10 @@ static void AddPepperBasedWidevine(std::vector<std::unique_ptr<media::KeySystemP supported_codecs |= media::EME_CODEC_WEBM_VORBIS; supported_codecs |= media::EME_CODEC_WEBM_VP8; supported_codecs |= media::EME_CODEC_WEBM_VP9; -#if defined(USE_PROPRIETARY_CODECS) +#if BUILDFLAG(USE_PROPRIETARY_CODECS) supported_codecs |= media::EME_CODEC_MP4_AVC1; supported_codecs |= media::EME_CODEC_MP4_AAC; -#endif // defined(USE_PROPRIETARY_CODECS) +#endif // BUILDFLAG(USE_PROPRIETARY_CODECS) using Robustness = cdm::WidevineKeySystemProperties::Robustness; concrete_key_systems->emplace_back(new cdm::WidevineKeySystemProperties( diff --git a/src/core/renderer/web_channel_ipc_transport.cpp b/src/core/renderer/web_channel_ipc_transport.cpp index 554bda2a8..94a7baa1d 100644 --- a/src/core/renderer/web_channel_ipc_transport.cpp +++ b/src/core/renderer/web_channel_ipc_transport.cpp @@ -186,7 +186,7 @@ void WebChannelIPCTransport::installWebChannel(uint worldId) void WebChannelIPCTransport::uninstallWebChannel(uint worldId) { - Q_ASSERT(worldId = m_installedWorldId); + Q_ASSERT(worldId == m_installedWorldId); blink::WebView *webView = render_view()->GetWebView(); if (!webView) return; diff --git a/src/core/url_request_qrc_job_qt.cpp b/src/core/url_request_qrc_job_qt.cpp index b4e960921..a2712653d 100644 --- a/src/core/url_request_qrc_job_qt.cpp +++ b/src/core/url_request_qrc_job_qt.cpp @@ -112,7 +112,7 @@ int URLRequestQrcJobQt::ReadRawData(IOBuffer *buf, int bufSize) void URLRequestQrcJobQt::startGetHead() { // Get qrc file path. - QString qrcFilePath = ':' + toQt(request_->url()).path(QUrl::RemovePath | QUrl::RemoveQuery); + QString qrcFilePath = ':' + toQt(request_->url()).path(); m_file.setFileName(qrcFilePath); QFileInfo qrcFileInfo(m_file); // Get qrc file mime type. diff --git a/src/core/web_contents_adapter.cpp b/src/core/web_contents_adapter.cpp index effd6e340..812a6f1c0 100644 --- a/src/core/web_contents_adapter.cpp +++ b/src/core/web_contents_adapter.cpp @@ -594,6 +594,8 @@ void WebContentsAdapter::load(const QWebEngineHttpRequest &request) } d->webContents->GetController().LoadURLWithParams(params); + // Follow chrome::Navigate and invalidate the URL immediately. + d->webContentsDelegate->NavigationStateChanged(d->webContents.get(), content::INVALIDATE_TYPE_URL); focusIfNecessary(); } @@ -635,7 +637,7 @@ void WebContentsAdapter::save(const QString &filePath, int savePageFormat) QUrl WebContentsAdapter::activeUrl() const { Q_D(const WebContentsAdapter); - return toQt(d->webContents->GetLastCommittedURL()); + return d->webContentsDelegate->url(); } QUrl WebContentsAdapter::requestedUrl() const @@ -670,7 +672,7 @@ QUrl WebContentsAdapter::iconUrl() const QString WebContentsAdapter::pageTitle() const { Q_D(const WebContentsAdapter); - return toQt(d->webContents->GetTitle()); + return d->webContentsDelegate->title(); } QString WebContentsAdapter::selectedText() const @@ -1463,6 +1465,12 @@ void WebContentsAdapter::focusIfNecessary() d->webContents->Focus(); } +bool WebContentsAdapter::isFindTextInProgress() const +{ + Q_D(const WebContentsAdapter); + return d->lastFindRequestId != d->webContentsDelegate->lastReceivedFindReply(); +} + WebContentsAdapterClient::RenderProcessTerminationStatus WebContentsAdapterClient::renderProcessExitStatus(int terminationStatus) { auto status = WebContentsAdapterClient::RenderProcessTerminationStatus(-1); diff --git a/src/core/web_contents_adapter.h b/src/core/web_contents_adapter.h index 67fcbe7af..51fd2891d 100644 --- a/src/core/web_contents_adapter.h +++ b/src/core/web_contents_adapter.h @@ -184,6 +184,7 @@ public: void viewSource(); bool canViewSource(); void focusIfNecessary(); + bool isFindTextInProgress() const; private: diff --git a/src/core/web_contents_delegate_qt.cpp b/src/core/web_contents_delegate_qt.cpp index f35620c86..96c7c4c41 100644 --- a/src/core/web_contents_delegate_qt.cpp +++ b/src/core/web_contents_delegate_qt.cpp @@ -131,10 +131,21 @@ content::WebContents *WebContentsDelegateQt::OpenURLFromTab(content::WebContents void WebContentsDelegateQt::NavigationStateChanged(content::WebContents* source, content::InvalidateTypes changed_flags) { - if (changed_flags & content::INVALIDATE_TYPE_URL) - m_viewClient->urlChanged(toQt(source->GetVisibleURL())); - if (changed_flags & content::INVALIDATE_TYPE_TITLE) - m_viewClient->titleChanged(toQt(source->GetTitle())); + if (changed_flags & content::INVALIDATE_TYPE_URL) { + QUrl newUrl = toQt(source->GetVisibleURL()); + if (m_url != newUrl) { + m_url = newUrl; + m_viewClient->urlChanged(m_url); + } + } + + if (changed_flags & content::INVALIDATE_TYPE_TITLE) { + QString newTitle = toQt(source->GetTitle()); + if (m_title != newTitle) { + m_title = newTitle; + m_viewClient->titleChanged(m_title); + } + } // NavigationStateChanged gets called with INVALIDATE_TYPE_TAB by AudioStateProvider::Notify, // whenever an audio sound gets played or stopped, this is the only way to actually figure out @@ -146,20 +157,6 @@ void WebContentsDelegateQt::NavigationStateChanged(content::WebContents* source, } } -bool WebContentsDelegateQt::ShouldPreserveAbortedURLs(content::WebContents *source) -{ - Q_UNUSED(source) - - // Allow failed URLs to stick around in the URL bar, but only when the error-page is enabled. - WebEngineSettings *settings = m_viewClient->webEngineSettings(); - bool isErrorPageEnabled = settings->testAttribute(settings->Attribute::ErrorPageEnabled); - - if (isErrorPageEnabled) - return true; - - return false; -} - void WebContentsDelegateQt::AddNewContents(content::WebContents* source, content::WebContents* new_contents, WindowOpenDisposition disposition, const gfx::Rect& initial_pos, bool user_gesture, bool* was_blocked) { Q_UNUSED(source) diff --git a/src/core/web_contents_delegate_qt.h b/src/core/web_contents_delegate_qt.h index 44fb93093..8440ec053 100644 --- a/src/core/web_contents_delegate_qt.h +++ b/src/core/web_contents_delegate_qt.h @@ -97,6 +97,9 @@ public: void setLastSearchedString(const QString &s) { m_lastSearchedString = s; } int lastReceivedFindReply() const { return m_lastReceivedFindReply; } + QUrl url() const { return m_url; } + QString title() const { return m_title; } + // WebContentsDelegate overrides content::WebContents *OpenURLFromTab(content::WebContents *source, const content::OpenURLParams ¶ms) override; void NavigationStateChanged(content::WebContents* source, content::InvalidateTypes changed_flags) override; @@ -119,7 +122,6 @@ public: bool IsPopupOrPanel(const content::WebContents *source) const override; void UpdateTargetURL(content::WebContents* source, const GURL& url) override; void RequestToLockMouse(content::WebContents *web_contents, bool user_gesture, bool last_unlocked_by_target) override; - bool ShouldPreserveAbortedURLs(content::WebContents *source) override; void ShowValidationMessage(content::WebContents *web_contents, const gfx::Rect &anchor_in_root_view, const base::string16 &main_text, const base::string16 &sub_text) override; void HideValidationMessage(content::WebContents *web_contents) override; void MoveValidationMessage(content::WebContents *web_contents, const gfx::Rect &anchor_in_root_view) override; @@ -165,6 +167,9 @@ private: QSharedPointer<FilePickerController> m_filePickerController; QUrl m_initialTargetUrl; int m_lastLoadProgress; + + QUrl m_url; + QString m_title; }; } // namespace QtWebEngineCore diff --git a/src/core/web_event_factory.cpp b/src/core/web_event_factory.cpp index 8c997335c..3193f885a 100644 --- a/src/core/web_event_factory.cpp +++ b/src/core/web_event_factory.cpp @@ -1019,12 +1019,14 @@ static ui::DomKey getDomKeyFromQKeyEvent(QKeyEvent *ev) } } -static inline double currentTimeForEvent(const QInputEvent* event) +static inline double currentTimeForEvent(const QEvent *event) { Q_ASSERT(event); - if (event->timestamp()) - return static_cast<double>(event->timestamp()) / 1000; + if (const QInputEvent *inputEvent = static_cast<const QInputEvent *>(event)) { + if (inputEvent->timestamp()) + return static_cast<double>(inputEvent->timestamp()) / 1000; + } static QElapsedTimer timer; if (!timer.isValid()) @@ -1190,6 +1192,7 @@ WebMouseEvent WebEventFactory::toWebMouseEvent(QMouseEvent *ev, double dpiScale) webKitEvent.button = mouseButtonForEvent(ev); webKitEvent.click_count = 0; + webKitEvent.pointer_type = WebPointerProperties::PointerType::kMouse; return webKitEvent; } @@ -1204,7 +1207,18 @@ WebMouseEvent WebEventFactory::toWebMouseEvent(QHoverEvent *ev, double dpiScale) webKitEvent.SetPositionInWidget(ev->pos().x() / dpiScale, ev->pos().y() / dpiScale); webKitEvent.movement_x = ev->pos().x() - ev->oldPos().x(); webKitEvent.movement_y = ev->pos().y() - ev->oldPos().y(); + webKitEvent.pointer_type = WebPointerProperties::PointerType::kMouse; + + return webKitEvent; +} +WebMouseEvent WebEventFactory::toWebMouseEvent(QEvent *ev) +{ + Q_ASSERT(ev->type() == QEvent::Leave || ev->type() == QEvent::HoverLeave); + + WebMouseEvent webKitEvent; + webKitEvent.SetTimeStampSeconds(currentTimeForEvent(ev)); + webKitEvent.SetType(WebInputEvent::kMouseLeave); return webKitEvent; } diff --git a/src/core/web_event_factory.h b/src/core/web_event_factory.h index f4ce417cd..5b8f08968 100644 --- a/src/core/web_event_factory.h +++ b/src/core/web_event_factory.h @@ -50,6 +50,7 @@ #include <QtGlobal> QT_BEGIN_NAMESPACE +class QEvent; class QHoverEvent; class QKeyEvent; class QMouseEvent; @@ -64,6 +65,7 @@ class WebEventFactory { public: static blink::WebMouseEvent toWebMouseEvent(QMouseEvent*, double dpiScale); static blink::WebMouseEvent toWebMouseEvent(QHoverEvent*, double dpiScale); + static blink::WebMouseEvent toWebMouseEvent(QEvent *); #ifndef QT_NO_GESTURES static blink::WebGestureEvent toWebGestureEvent(QNativeGestureEvent *, double dpiScale); #endif diff --git a/src/src.pro b/src/src.pro index 76d342c8d..d675f1f13 100644 --- a/src/src.pro +++ b/src/src.pro @@ -20,20 +20,20 @@ SUBDIRS += buildtools \ plugins -qtConfig(spellchecker):!qtConfig(native-spellchecker):!cross_compile { +qtConfig(webengine-spellchecker):!qtConfig(webengine-native-spellchecker):!cross_compile { SUBDIRS += qwebengine_convert_dict qwebengine_convert_dict.subdir = tools/qwebengine_convert_dict qwebengine_convert_dict.depends = core } -qtConfig(testsupport) { +qtConfig(webengine-testsupport) { webengine_testsupport_plugin.subdir = webengine/plugin/testsupport webengine_testsupport_plugin.target = sub-webengine-testsupport-plugin webengine_testsupport_plugin.depends = webengine SUBDIRS += webengine_testsupport_plugin } -qtConfig(ui-delegates) { +qtConfig(webengine-ui-delegates) { SUBDIRS += webengine/ui \ webengine/ui2 } diff --git a/src/webengine/api/qquickwebengineview.cpp b/src/webengine/api/qquickwebengineview.cpp index f5d3646d8..addb7d6df 100644 --- a/src/webengine/api/qquickwebengineview.cpp +++ b/src/webengine/api/qquickwebengineview.cpp @@ -338,7 +338,7 @@ void QQuickWebEngineViewPrivate::navigationRequested(int navigationType, const Q Q_EMIT q->navigationRequested(&navigationRequest); navigationRequestAction = navigationRequest.action(); - if ((navigationRequestAction == WebContentsAdapterClient::AcceptRequest) && adapter) + if ((navigationRequestAction == WebContentsAdapterClient::AcceptRequest) && adapter && adapter->isFindTextInProgress()) adapter->stopFinding(); } diff --git a/src/webengine/render_widget_host_view_qt_delegate_quick.cpp b/src/webengine/render_widget_host_view_qt_delegate_quick.cpp index 0e06ddbce..0a31811d9 100644 --- a/src/webengine/render_widget_host_view_qt_delegate_quick.cpp +++ b/src/webengine/render_widget_host_view_qt_delegate_quick.cpp @@ -316,6 +316,11 @@ void RenderWidgetHostViewQtDelegateQuick::hoverMoveEvent(QHoverEvent *event) m_client->forwardEvent(event); } +void RenderWidgetHostViewQtDelegateQuick::hoverLeaveEvent(QHoverEvent *event) +{ + m_client->forwardEvent(event); +} + QVariant RenderWidgetHostViewQtDelegateQuick::inputMethodQuery(Qt::InputMethodQuery query) const { return m_client->inputMethodQuery(query); diff --git a/src/webengine/render_widget_host_view_qt_delegate_quick.h b/src/webengine/render_widget_host_view_qt_delegate_quick.h index d93fd539a..7426dc16d 100644 --- a/src/webengine/render_widget_host_view_qt_delegate_quick.h +++ b/src/webengine/render_widget_host_view_qt_delegate_quick.h @@ -90,6 +90,7 @@ protected: virtual void wheelEvent(QWheelEvent *event) Q_DECL_OVERRIDE; virtual void touchEvent(QTouchEvent *event) Q_DECL_OVERRIDE; virtual void hoverMoveEvent(QHoverEvent *event) Q_DECL_OVERRIDE; + virtual void hoverLeaveEvent(QHoverEvent *event) Q_DECL_OVERRIDE; virtual QVariant inputMethodQuery(Qt::InputMethodQuery query) const Q_DECL_OVERRIDE; virtual void inputMethodEvent(QInputMethodEvent *event) Q_DECL_OVERRIDE; virtual void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) Q_DECL_OVERRIDE; diff --git a/src/webengine/ui_delegates_manager.cpp b/src/webengine/ui_delegates_manager.cpp index 43e6e8817..fb23f5db7 100644 --- a/src/webengine/ui_delegates_manager.cpp +++ b/src/webengine/ui_delegates_manager.cpp @@ -257,7 +257,7 @@ QObject *UIDelegatesManager::addMenu(QObject *parentMenu, const QString &title, if (!title.isEmpty()) QQmlProperty(menu, QStringLiteral("title")).write(title); if (!pos.isNull()) - QQmlProperty(menu, QStringLiteral("pos")).write(pos); + menu->setProperty("pos", pos); menu->setParent(parentMenu); @@ -496,9 +496,38 @@ void UIDelegatesManager::showFilePicker(QSharedPointer<FilePickerController> con QMetaObject::invokeMethod(filePicker, "open"); } +class TemporaryCursorMove +{ +public: + TemporaryCursorMove(const QQuickItem *item, const QPoint &pos) + { + if (pos.isNull() || !item->contains(pos)) + return; + const QPoint oldPos = QCursor::pos(); + const QPoint globalPos = item->mapToGlobal(QPointF(pos)).toPoint(); + if (oldPos == globalPos) + return; + m_oldCursorPos = oldPos; + QCursor::setPos(globalPos); + } + + ~TemporaryCursorMove() + { + if (!m_oldCursorPos.isNull()) + QCursor::setPos(m_oldCursorPos); + } + +private: + QPoint m_oldCursorPos; +}; + void UIDelegatesManager::showMenu(QObject *menu) { - QMetaObject::invokeMethod(menu, "popup"); + // QtQuick.Controls.Menu.popup() always shows the menu under the mouse cursor, i.e. the menu's + // position we set above is ignored. Work around the problem by moving the mouse cursor + // temporarily to the right position. + TemporaryCursorMove tcm(m_view, menu->property("pos").toPoint()); + QMetaObject::invokeMethod(menu, "popup"); } void UIDelegatesManager::showMessageBubble(const QRect &anchor, const QString &mainText, const QString &subText) diff --git a/src/webengine/webengine.pro b/src/webengine/webengine.pro index 24fa2d9d8..58e1263a7 100644 --- a/src/webengine/webengine.pro +++ b/src/webengine/webengine.pro @@ -58,7 +58,7 @@ HEADERS = \ render_widget_host_view_qt_delegate_quickwindow.h \ ui_delegates_manager.h -qtConfig(testsupport) { +qtConfig(webengine-testsupport) { QT += testlib SOURCES += api/qquickwebenginetestsupport.cpp @@ -67,11 +67,11 @@ qtConfig(testsupport) { DEFINES += ENABLE_QML_TESTSUPPORT_API } -qtConfig(spellchecker) { +qtConfig(webengine-spellchecker) { DEFINES += ENABLE_SPELLCHECK } -qtConfig(printing-and-pdf) { +qtConfig(webengine-printing-and-pdf) { DEFINES += ENABLE_PDF } diff --git a/src/webenginewidgets/api/qwebenginepage.cpp b/src/webenginewidgets/api/qwebenginepage.cpp index c048a49f4..420057651 100644 --- a/src/webenginewidgets/api/qwebenginepage.cpp +++ b/src/webenginewidgets/api/qwebenginepage.cpp @@ -1489,7 +1489,7 @@ void QWebEnginePagePrivate::navigationRequested(int navigationType, const QUrl & { Q_Q(QWebEnginePage); bool accepted = q->acceptNavigationRequest(url, static_cast<QWebEnginePage::NavigationType>(navigationType), isMainFrame); - if (accepted && adapter) + if (accepted && adapter && adapter->isFindTextInProgress()) adapter->stopFinding(); navigationRequestAction = accepted ? WebContentsAdapterClient::AcceptRequest : WebContentsAdapterClient::IgnoreRequest; } diff --git a/src/webenginewidgets/doc/src/qwebenginesettings_lgpl.qdoc b/src/webenginewidgets/doc/src/qwebenginesettings_lgpl.qdoc index d3b16a935..3fe87082a 100644 --- a/src/webenginewidgets/doc/src/qwebenginesettings_lgpl.qdoc +++ b/src/webenginewidgets/doc/src/qwebenginesettings_lgpl.qdoc @@ -163,7 +163,8 @@ origins to access Geolocation again. Disabled by default. (Added in Qt 5.9) \value AllowWindowActivationFromJavaScript - Allows the window.focus() method in JavaScript. Disallowed by default. + Allows activating windows by using the window.focus() JavaScript + method. Disabled by default. (Added in Qt 5.10) \value ShowScrollBars Shows scroll bars. diff --git a/src/webenginewidgets/webenginewidgets.pro b/src/webenginewidgets/webenginewidgets.pro index ffe9cc0de..540c4d538 100644 --- a/src/webenginewidgets/webenginewidgets.pro +++ b/src/webenginewidgets/webenginewidgets.pro @@ -44,17 +44,17 @@ HEADERS = \ api/qwebengineview_p.h \ render_widget_host_view_qt_delegate_widget.h -qtConfig(ui-delegates) { +qtConfig(webengine-ui-delegates) { SOURCES += ui/messagebubblewidget.cpp HEADERS += ui/messagebubblewidget_p.h DEFINES += QT_UI_DELEGATES } -qtConfig(spellchecker) { +qtConfig(webengine-spellchecker) { DEFINES += ENABLE_SPELLCHECK } -qtConfig(printing-and-pdf) { +qtConfig(webengine-printing-and-pdf) { DEFINES += ENABLE_PRINTING DEFINES += ENABLE_PDF QT += printsupport |