diff options
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/api/core_api.pro | 2 | ||||
-rw-r--r-- | src/core/config/linux.pri | 2 | ||||
-rw-r--r-- | src/core/core_module.pro | 23 | ||||
-rw-r--r-- | src/core/gyp_run.pro | 2 | ||||
-rw-r--r-- | src/core/permission_manager_qt.cpp | 9 | ||||
-rw-r--r-- | src/core/render_widget_host_view_qt.cpp | 76 | ||||
-rw-r--r-- | src/core/render_widget_host_view_qt.h | 1 | ||||
-rw-r--r-- | src/core/renderer/web_channel_ipc_transport.cpp | 12 | ||||
-rw-r--r-- | src/core/renderer/web_channel_ipc_transport.h | 2 | ||||
-rw-r--r-- | src/core/resource_bundle_qt.cpp | 2 | ||||
-rw-r--r-- | src/core/web_contents_adapter_client.h | 1 | ||||
-rw-r--r-- | src/core/web_event_factory.cpp | 6 |
12 files changed, 92 insertions, 46 deletions
diff --git a/src/core/api/core_api.pro b/src/core/api/core_api.pro index a9f5adaba..6e2d606b2 100644 --- a/src/core/api/core_api.pro +++ b/src/core/api/core_api.pro @@ -15,7 +15,7 @@ CONFIG -= create_prl # Copy this logic from qt_module.prf so that the intermediate library can be # created to the same rules as the final module linking in core_module.pro. !host_build:if(win32|mac):!macx-xcode { - contains(QT_CONFIG, simulator_and_device): CONFIG += iphonesimulator_and_iphoneos + contains(QT_CONFIG, simulator_and_device): CONFIG += simulator_and_device contains(QT_CONFIG, debug_and_release):CONFIG += debug_and_release contains(QT_CONFIG, build_all):CONFIG += build_all } diff --git a/src/core/config/linux.pri b/src/core/config/linux.pri index fcbdbe27a..a71d36c53 100644 --- a/src/core/config/linux.pri +++ b/src/core/config/linux.pri @@ -33,6 +33,8 @@ use?(nss) { use_openssl_certs=1 } +gcc:!clang: greaterThan(QT_GCC_MAJOR_VERSION, 5): GYP_CONFIG += v8_no_delete_null_pointer_checks=1 + contains(QT_CONFIG, system-zlib): use?(system_minizip): GYP_CONFIG += use_system_zlib=1 contains(QT_CONFIG, system-png): GYP_CONFIG += use_system_libpng=1 contains(QT_CONFIG, system-jpeg): GYP_CONFIG += use_system_libjpeg=1 diff --git a/src/core/core_module.pro b/src/core/core_module.pro index 702b92441..20b719547 100644 --- a/src/core/core_module.pro +++ b/src/core/core_module.pro @@ -89,29 +89,10 @@ icu.files = $$OUT_PWD/$$getConfigDir()/icudtl.dat # !use?(system_icu) { - icudt2build.input = icu.files - icudt2build.output = $$[QT_INSTALL_DATA/get]/resources/${QMAKE_FILE_BASE}${QMAKE_FILE_EXT} - icudt2build.commands = $$QMAKE_COPY ${QMAKE_FILE_IN} ${QMAKE_FILE_OUT} - icudt2build.name = COPY ${QMAKE_FILE_IN} - icudt2build.CONFIG = no_link no_clean target_predeps - QMAKE_EXTRA_COMPILERS += icudt2build + COPIES += icu } - resources2build.input = resources.files - resources2build.output = $$[QT_INSTALL_DATA/get]/resources/${QMAKE_FILE_BASE}${QMAKE_FILE_EXT} - resources2build.commands = $$QMAKE_COPY ${QMAKE_FILE_IN} ${QMAKE_FILE_OUT} - resources2build.name = COPY ${QMAKE_FILE_IN} - resources2build.CONFIG = no_link no_clean target_predeps - - QMAKE_EXTRA_COMPILERS += resources2build - - locales2build.input = locales.files - locales2build.output = $$[QT_INSTALL_DATA/get]/translations/qtwebengine_locales/${QMAKE_FILE_BASE}${QMAKE_FILE_EXT} - locales2build.commands = $$QMAKE_COPY ${QMAKE_FILE_IN} ${QMAKE_FILE_OUT} - locales2build.name = COPY ${QMAKE_FILE_IN} - locales2build.CONFIG = no_link no_clean target_predeps - - QMAKE_EXTRA_COMPILERS += locales2build + COPIES += resources locales } } diff --git a/src/core/gyp_run.pro b/src/core/gyp_run.pro index 35b85b4c7..a1b33e258 100644 --- a/src/core/gyp_run.pro +++ b/src/core/gyp_run.pro @@ -34,7 +34,7 @@ force_debug_info { # Copy this logic from qt_module.prf so that ninja can run according # to the same rules as the final module linking in core_module.pro. !host_build:if(win32|mac):!macx-xcode { - contains(QT_CONFIG, simulator_and_device): CONFIG += iphonesimulator_and_iphoneos + contains(QT_CONFIG, simulator_and_device): CONFIG += simulator_and_device contains(QT_CONFIG, debug_and_release):CONFIG += debug_and_release contains(QT_CONFIG, build_all):CONFIG += build_all } diff --git a/src/core/permission_manager_qt.cpp b/src/core/permission_manager_qt.cpp index 1be276306..f76f100e6 100644 --- a/src/core/permission_manager_qt.cpp +++ b/src/core/permission_manager_qt.cpp @@ -55,14 +55,16 @@ BrowserContextAdapter::PermissionType toQt(content::PermissionType type) switch (type) { case content::PermissionType::GEOLOCATION: return BrowserContextAdapter::GeolocationPermission; + case content::PermissionType::AUDIO_CAPTURE: + return BrowserContextAdapter::AudioCapturePermission; + case content::PermissionType::VIDEO_CAPTURE: + return BrowserContextAdapter::VideoCapturePermission; case content::PermissionType::NOTIFICATIONS: case content::PermissionType::MIDI_SYSEX: case content::PermissionType::PUSH_MESSAGING: case content::PermissionType::PROTECTED_MEDIA_IDENTIFIER: case content::PermissionType::MIDI: case content::PermissionType::DURABLE_STORAGE: - case content::PermissionType::AUDIO_CAPTURE: - case content::PermissionType::VIDEO_CAPTURE: case content::PermissionType::BACKGROUND_SYNC: case content::PermissionType::NUM: break; @@ -116,6 +118,9 @@ int PermissionManagerQt::RequestPermission(content::PermissionType permission, callback.Run(blink::mojom::PermissionStatus::DENIED); return kNoPendingOperation; } + // Audio and video-capture should not come this way currently + Q_ASSERT(permissionType != BrowserContextAdapter::AudioCapturePermission + && permissionType != BrowserContextAdapter::VideoCapturePermission); content::WebContents *webContents = frameHost->GetRenderViewHost()->GetDelegate()->GetAsWebContents(); WebContentsDelegateQt* contentsDelegate = static_cast<WebContentsDelegateQt*>(webContents->GetDelegate()); diff --git a/src/core/render_widget_host_view_qt.cpp b/src/core/render_widget_host_view_qt.cpp index d6f88f74f..91e503e6f 100644 --- a/src/core/render_widget_host_view_qt.cpp +++ b/src/core/render_widget_host_view_qt.cpp @@ -71,6 +71,10 @@ #include "ui/events/gesture_detection/motion_event.h" #include "ui/gfx/geometry/size_conversions.h" +#if defined(USE_AURA) +#include "ui/base/cursor/cursors_aura.h" +#endif + #include <QEvent> #include <QFocusEvent> #include <QGuiApplication> @@ -249,6 +253,7 @@ RenderWidgetHostViewQt::RenderWidgetHostViewQt(content::RenderWidgetHost* widget RenderWidgetHostViewQt::~RenderWidgetHostViewQt() { + QObject::disconnect(m_adapterClientDestroyedConnection); #ifndef QT_NO_ACCESSIBILITY QAccessible::removeActivationObserver(this); #endif // QT_NO_ACCESSIBILITY @@ -264,6 +269,10 @@ void RenderWidgetHostViewQt::setAdapterClient(WebContentsAdapterClient *adapterC Q_ASSERT(!m_adapterClient); m_adapterClient = adapterClient; + QObject::disconnect(m_adapterClientDestroyedConnection); + m_adapterClientDestroyedConnection = QObject::connect(adapterClient->holdingQObject(), + &QObject::destroyed, [this] { + m_adapterClient = nullptr; }); if (m_initPending) InitAsChild(0); } @@ -430,7 +439,10 @@ void RenderWidgetHostViewQt::UpdateCursor(const content::WebCursor &webCursor) { content::WebCursor::CursorInfo cursorInfo; webCursor.GetCursorInfo(&cursorInfo); - Qt::CursorShape shape; + Qt::CursorShape shape = Qt::ArrowCursor; +#if defined(USE_AURA) + int auraType = -1; +#endif switch (cursorInfo.type) { case blink::WebCursorInfo::TypePointer: shape = Qt::ArrowCursor; @@ -488,17 +500,42 @@ void RenderWidgetHostViewQt::UpdateCursor(const content::WebCursor &webCursor) case blink::WebCursorInfo::TypeMove: shape = Qt::SizeAllCursor; break; + case blink::WebCursorInfo::TypeProgress: + shape = Qt::BusyCursor; + break; +#if defined(USE_AURA) case blink::WebCursorInfo::TypeVerticalText: + auraType = ui::kCursorVerticalText; + break; case blink::WebCursorInfo::TypeCell: + auraType = ui::kCursorCell; + break; case blink::WebCursorInfo::TypeContextMenu: + auraType = ui::kCursorContextMenu; + break; case blink::WebCursorInfo::TypeAlias: - case blink::WebCursorInfo::TypeProgress: + auraType = ui::kCursorAlias; + break; case blink::WebCursorInfo::TypeCopy: + auraType = ui::kCursorCopy; + break; case blink::WebCursorInfo::TypeZoomIn: + auraType = ui::kCursorZoomIn; + break; case blink::WebCursorInfo::TypeZoomOut: - // FIXME: Load from the resource bundle. - shape = Qt::ArrowCursor; + auraType = ui::kCursorZoomOut; + break; +#else + case blink::WebCursorInfo::TypeVerticalText: + case blink::WebCursorInfo::TypeCell: + case blink::WebCursorInfo::TypeContextMenu: + case blink::WebCursorInfo::TypeAlias: + case blink::WebCursorInfo::TypeCopy: + case blink::WebCursorInfo::TypeZoomIn: + case blink::WebCursorInfo::TypeZoomOut: + // FIXME: Support on OS X break; +#endif case blink::WebCursorInfo::TypeNoDrop: case blink::WebCursorInfo::TypeNotAllowed: shape = Qt::ForbiddenCursor; @@ -515,16 +552,21 @@ void RenderWidgetHostViewQt::UpdateCursor(const content::WebCursor &webCursor) case blink::WebCursorInfo::TypeCustom: if (cursorInfo.custom_image.colorType() == SkColorType::kN32_SkColorType) { QImage cursor = toQImage(cursorInfo.custom_image, QImage::Format_ARGB32); - m_delegate->updateCursor(QCursor(QPixmap::fromImage(cursor))); + m_delegate->updateCursor(QCursor(QPixmap::fromImage(cursor), cursorInfo.hotspot.x(), cursorInfo.hotspot.y())); return; } - // Use arrow cursor as fallback in case the Chromium implementation changes. - shape = Qt::ArrowCursor; break; - default: - Q_UNREACHABLE(); - shape = Qt::ArrowCursor; } +#if defined(USE_AURA) + if (auraType > 0) { + SkBitmap bitmap; + gfx::Point hotspot; + if (ui::GetCursorBitmap(auraType, &bitmap, &hotspot)) { + m_delegate->updateCursor(QCursor(QPixmap::fromImage(toQImage(bitmap)), hotspot.x(), hotspot.y())); + return; + } + } +#endif m_delegate->updateCursor(QCursor(shape)); } @@ -870,7 +912,21 @@ bool RenderWidgetHostViewQt::IsPopup() const void RenderWidgetHostViewQt::handleMouseEvent(QMouseEvent* event) { + // Don't forward mouse events synthesized by the system, which are caused by genuine touch + // events. Chromium would then process for e.g. a mouse click handler twice, once due to the + // system synthesized mouse event, and another time due to a touch-to-gesture-to-mouse + // transformation done by Chromium. + if (event->source() == Qt::MouseEventSynthesizedBySystem) + return; + blink::WebMouseEvent webEvent = WebEventFactory::toWebMouseEvent(event, dpiScale()); + if ((webEvent.type == blink::WebInputEvent::MouseDown || webEvent.type == blink::WebInputEvent::MouseUp) + && webEvent.button == blink::WebMouseEvent::ButtonNone) { + // Blink can only handle the 3 main mouse-buttons and may assert when processing mouse-down for no button. + return; + } + + if (event->type() == QMouseEvent::MouseButtonPress) { if (event->button() != m_clickHelper.lastPressButton || (event->timestamp() - m_clickHelper.lastPressTimestamp > static_cast<ulong>(qGuiApp->styleHints()->mouseDoubleClickInterval())) diff --git a/src/core/render_widget_host_view_qt.h b/src/core/render_widget_host_view_qt.h index befc86530..a6d34fd6a 100644 --- a/src/core/render_widget_host_view_qt.h +++ b/src/core/render_widget_host_view_qt.h @@ -222,6 +222,7 @@ private: bool m_didFirstVisuallyNonEmptyLayout; uint32_t m_pendingOutputSurfaceId; + QMetaObject::Connection m_adapterClientDestroyedConnection; WebContentsAdapterClient *m_adapterClient; MultipleMouseClickHelper m_clickHelper; diff --git a/src/core/renderer/web_channel_ipc_transport.cpp b/src/core/renderer/web_channel_ipc_transport.cpp index f965c2cc7..3a44bb182 100644 --- a/src/core/renderer/web_channel_ipc_transport.cpp +++ b/src/core/renderer/web_channel_ipc_transport.cpp @@ -155,8 +155,8 @@ content::RenderView *WebChannelTransport::GetRenderView(v8::Isolate *isolate) WebChannelIPCTransport::WebChannelIPCTransport(content::RenderView *renderView) : content::RenderViewObserver(renderView) , content::RenderViewObserverTracker<WebChannelIPCTransport>(renderView) - , m_worldId(0) , m_installed(false) + , m_installedWorldId(0) { } @@ -166,28 +166,28 @@ void WebChannelIPCTransport::RunScriptsAtDocumentStart(content::RenderFrame *ren // ### FIXME: we should try no even installing before blink::WebLocalFrame *frame = render_frame->GetWebFrame(); if (m_installed && render_frame->IsMainFrame()) - WebChannelTransport::Install(frame, m_worldId); + WebChannelTransport::Install(frame, m_installedWorldId); } void WebChannelIPCTransport::installWebChannel(uint worldId) { - m_worldId = worldId; - m_installed = true; blink::WebView *webView = render_view()->GetWebView(); if (!webView) return; WebChannelTransport::Install(webView->mainFrame(), worldId); + m_installed = true; + m_installedWorldId = worldId; } void WebChannelIPCTransport::uninstallWebChannel(uint worldId) { - Q_ASSERT(worldId = m_worldId); - m_installed = false; + Q_ASSERT(worldId = m_installedWorldId); blink::WebView *webView = render_view()->GetWebView(); if (!webView) return; WebChannelTransport::Uninstall(webView->mainFrame(), worldId); + m_installed = false; } void WebChannelIPCTransport::dispatchWebChannelMessage(const std::vector<char> &binaryJSON, uint worldId) diff --git a/src/core/renderer/web_channel_ipc_transport.h b/src/core/renderer/web_channel_ipc_transport.h index 81e64bb0f..ae3f16cac 100644 --- a/src/core/renderer/web_channel_ipc_transport.h +++ b/src/core/renderer/web_channel_ipc_transport.h @@ -69,8 +69,8 @@ private: void uninstallWebChannel(uint worldId); virtual bool OnMessageReceived(const IPC::Message &message) Q_DECL_OVERRIDE; - uint m_worldId; bool m_installed; + uint m_installedWorldId; }; } // namespace diff --git a/src/core/resource_bundle_qt.cpp b/src/core/resource_bundle_qt.cpp index 5872e778a..ba25cc543 100644 --- a/src/core/resource_bundle_qt.cpp +++ b/src/core/resource_bundle_qt.cpp @@ -50,7 +50,7 @@ void ResourceBundle::LoadCommonResources() AddDataPackFromPath(WebEngineLibraryInfo::getPath(QT_RESOURCES_PAK), SCALE_FACTOR_NONE); AddDataPackFromPath(WebEngineLibraryInfo::getPath(QT_RESOURCES_100P_PAK), SCALE_FACTOR_100P); AddDataPackFromPath(WebEngineLibraryInfo::getPath(QT_RESOURCES_200P_PAK), SCALE_FACTOR_200P); - AddDataPackFromPath(WebEngineLibraryInfo::getPath(QT_RESOURCES_DEVTOOLS_PAK), SCALE_FACTOR_NONE); + AddOptionalDataPackFromPath(WebEngineLibraryInfo::getPath(QT_RESOURCES_DEVTOOLS_PAK), SCALE_FACTOR_NONE); } gfx::Image& ResourceBundle::GetNativeImageNamed(int resource_id) diff --git a/src/core/web_contents_adapter_client.h b/src/core/web_contents_adapter_client.h index c50f38b38..7be9ca7b9 100644 --- a/src/core/web_contents_adapter_client.h +++ b/src/core/web_contents_adapter_client.h @@ -258,6 +258,7 @@ public: virtual void startDragging(const content::DropData &dropData, Qt::DropActions allowedActions, const QPixmap &pixmap, const QPoint &offset) = 0; virtual bool isEnabled() const = 0; + virtual const QObject *holdingQObject() const = 0; virtual QSharedPointer<BrowserContextAdapter> browserContextAdapter() = 0; virtual WebContentsAdapter* webContentsAdapter() = 0; diff --git a/src/core/web_event_factory.cpp b/src/core/web_event_factory.cpp index fddafd1d3..505a684eb 100644 --- a/src/core/web_event_factory.cpp +++ b/src/core/web_event_factory.cpp @@ -486,11 +486,11 @@ static inline double currentTimeForEvent(const QInputEvent* event) static WebMouseEvent::Button mouseButtonForEvent(QMouseEvent *event) { - if (event->button() == Qt::LeftButton || (event->buttons() & Qt::LeftButton)) + if (event->button() == Qt::LeftButton) return WebMouseEvent::ButtonLeft; - else if (event->button() == Qt::RightButton || (event->buttons() & Qt::RightButton)) + else if (event->button() == Qt::RightButton) return WebMouseEvent::ButtonRight; - else if (event->button() == Qt::MidButton || (event->buttons() & Qt::MidButton)) + else if (event->button() == Qt::MidButton) return WebMouseEvent::ButtonMiddle; return WebMouseEvent::ButtonNone; } |