diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/core/api/core_api.pro | 1 | ||||
-rw-r--r-- | src/core/clipboard_qt.cpp | 7 | ||||
-rw-r--r-- | src/core/gyp_run.pro | 1 | ||||
-rw-r--r-- | src/core/web_contents_adapter_client.h | 1 | ||||
-rw-r--r-- | src/core/web_contents_view_qt.cpp | 2 | ||||
-rw-r--r-- | src/webengine/api/qquickwebengineview.cpp | 16 | ||||
-rw-r--r-- | src/webengine/api/qquickwebengineview_p_p.h | 3 | ||||
-rw-r--r-- | src/webengine/doc/qtwebengine.qdocconf | 2 | ||||
-rw-r--r-- | src/webengine/render_widget_host_view_qt_delegate_quick.cpp | 29 | ||||
-rw-r--r-- | src/webenginewidgets/api/qwebenginepage.cpp | 9 | ||||
-rw-r--r-- | src/webenginewidgets/api/qwebenginepage_p.h | 1 | ||||
-rw-r--r-- | src/webenginewidgets/doc/src/qtwebkitportingguide.qdoc | 4 | ||||
-rw-r--r-- | src/webenginewidgets/render_widget_host_view_qt_delegate_widget.cpp | 28 |
13 files changed, 100 insertions, 4 deletions
diff --git a/src/core/api/core_api.pro b/src/core/api/core_api.pro index 19b67876c..a9f5adaba 100644 --- a/src/core/api/core_api.pro +++ b/src/core/api/core_api.pro @@ -15,6 +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, debug_and_release):CONFIG += debug_and_release contains(QT_CONFIG, build_all):CONFIG += build_all } diff --git a/src/core/clipboard_qt.cpp b/src/core/clipboard_qt.cpp index bd62f4872..712ff5703 100644 --- a/src/core/clipboard_qt.cpp +++ b/src/core/clipboard_qt.cpp @@ -56,6 +56,13 @@ namespace QtWebEngineCore { +static void registerMetaTypes() +{ + qRegisterMetaType<QClipboard::Mode>("QClipboard::Mode"); +} + +Q_CONSTRUCTOR_FUNCTION(registerMetaTypes) + Q_GLOBAL_STATIC(ClipboardChangeObserver, clipboardChangeObserver) ClipboardChangeObserver::ClipboardChangeObserver() diff --git a/src/core/gyp_run.pro b/src/core/gyp_run.pro index 2e2422dce..41cdf4598 100644 --- a/src/core/gyp_run.pro +++ b/src/core/gyp_run.pro @@ -34,6 +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, debug_and_release):CONFIG += debug_and_release contains(QT_CONFIG, build_all):CONFIG += build_all } diff --git a/src/core/web_contents_adapter_client.h b/src/core/web_contents_adapter_client.h index 80aabaa4d..c50f38b38 100644 --- a/src/core/web_contents_adapter_client.h +++ b/src/core/web_contents_adapter_client.h @@ -257,6 +257,7 @@ public: virtual void updateContentsSize(const QSizeF &size) = 0; virtual void startDragging(const content::DropData &dropData, Qt::DropActions allowedActions, const QPixmap &pixmap, const QPoint &offset) = 0; + virtual bool isEnabled() const = 0; virtual QSharedPointer<BrowserContextAdapter> browserContextAdapter() = 0; virtual WebContentsAdapter* webContentsAdapter() = 0; diff --git a/src/core/web_contents_view_qt.cpp b/src/core/web_contents_view_qt.cpp index 1d39d8af8..e487fca46 100644 --- a/src/core/web_contents_view_qt.cpp +++ b/src/core/web_contents_view_qt.cpp @@ -120,6 +120,8 @@ void WebContentsViewQt::GetContainerBounds(gfx::Rect* out) const void WebContentsViewQt::Focus() { + if (!m_client->isEnabled()) + return; if (content::RenderWidgetHostView *rwhv = m_webContents->GetRenderWidgetHostView()) rwhv->Focus(); m_client->focusContainer(); diff --git a/src/webengine/api/qquickwebengineview.cpp b/src/webengine/api/qquickwebengineview.cpp index 1b1dcec25..36a7b69b9 100644 --- a/src/webengine/api/qquickwebengineview.cpp +++ b/src/webengine/api/qquickwebengineview.cpp @@ -124,6 +124,8 @@ QQuickWebEngineViewPrivate::QQuickWebEngineViewPrivate() , m_dpiScale(1.0) , m_backgroundColor(Qt::white) , m_defaultZoomFactor(1.0) + // QTBUG-53467 + , m_menuEnabled(true) { // The gold standard for mobile web content is 160 dpi, and the devicePixelRatio expected // is the (possibly quantized) ratio of device dpi to 160 dpi. @@ -141,6 +143,8 @@ QQuickWebEngineViewPrivate::QQuickWebEngineViewPrivate() // 1x, 2x, 3x etc assets that fit an integral number of pixels. setDevicePixelRatio(qMax(1, qRound(webPixelRatio))); } + if (platform == QLatin1Literal("eglfs")) + m_menuEnabled = false; #ifndef QT_NO_ACCESSIBILITY QAccessible::installFactory(&webAccessibleFactory); #endif // QT_NO_ACCESSIBILITY @@ -191,6 +195,12 @@ bool QQuickWebEngineViewPrivate::contextMenuRequested(const WebEngineContextMenu { Q_Q(QQuickWebEngineView); + if (!m_menuEnabled) { + qWarning("You are trying to open context menu on eglfs backend, which is not currently supported\n" + "See QTBUG-53467."); + return false; + } + // Assign the WebEngineView as the parent of the menu, so mouse events are properly propagated // on OSX. QObject *menu = ui()->addMenu(q, QString(), data.pos); @@ -1075,6 +1085,12 @@ void QQuickWebEngineViewPrivate::startDragging(const content::DropData &dropData adapter->startDragging(q_ptr->window(), dropData, allowedActions, pixmap, offset); } +bool QQuickWebEngineViewPrivate::isEnabled() const +{ + const Q_Q(QQuickWebEngineView); + return q->isEnabled(); +} + bool QQuickWebEngineView::isLoading() const { Q_D(const QQuickWebEngineView); diff --git a/src/webengine/api/qquickwebengineview_p_p.h b/src/webengine/api/qquickwebengineview_p_p.h index 82a9e9612..909763614 100644 --- a/src/webengine/api/qquickwebengineview_p_p.h +++ b/src/webengine/api/qquickwebengineview_p_p.h @@ -187,6 +187,7 @@ public: virtual void updateContentsSize(const QSizeF &size) Q_DECL_OVERRIDE; void startDragging(const content::DropData &dropData, Qt::DropActions allowedActions, const QPixmap &pixmap, const QPoint &offset) Q_DECL_OVERRIDE; + virtual bool isEnabled() const Q_DECL_OVERRIDE; virtual QSharedPointer<QtWebEngineCore::BrowserContextAdapter> browserContextAdapter() Q_DECL_OVERRIDE; QtWebEngineCore::WebContentsAdapter *webContentsAdapter() Q_DECL_OVERRIDE; @@ -233,6 +234,8 @@ private: qreal m_dpiScale; QColor m_backgroundColor; qreal m_defaultZoomFactor; + // QTBUG-53467 + bool m_menuEnabled; }; #ifndef QT_NO_ACCESSIBILITY diff --git a/src/webengine/doc/qtwebengine.qdocconf b/src/webengine/doc/qtwebengine.qdocconf index 6d946c9c9..009902080 100644 --- a/src/webengine/doc/qtwebengine.qdocconf +++ b/src/webengine/doc/qtwebengine.qdocconf @@ -40,8 +40,10 @@ tagfile = ../../../doc/qtwebengine/qtwebengine.tags depends += qtcore \ qtgui \ + qtlocation \ qtnetwork \ qtprintsupport \ + qtpositioning \ qtqml \ qtquick \ qtquickcontrols \ 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 9ad86800c..5e39cc2b3 100644 --- a/src/webengine/render_widget_host_view_qt_delegate_quick.cpp +++ b/src/webengine/render_widget_host_view_qt_delegate_quick.cpp @@ -222,18 +222,33 @@ void RenderWidgetHostViewQtDelegateQuick::focusOutEvent(QFocusEvent *event) void RenderWidgetHostViewQtDelegateQuick::mousePressEvent(QMouseEvent *event) { - if (!m_isPopup && (parentItem() && parentItem()->property("activeFocusOnPress").toBool())) + QQuickItem *parent = parentItem(); + if (!m_isPopup && (parent && parent->property("activeFocusOnPress").toBool())) forceActiveFocus(); + if (parent && !parent->property("activeFocusOnPress").toBool() && !parent->hasActiveFocus()) { + event->ignore(); + return; + } m_client->forwardEvent(event); } void RenderWidgetHostViewQtDelegateQuick::mouseMoveEvent(QMouseEvent *event) { + QQuickItem *parent = parentItem(); + if (parent && !parent->property("activeFocusOnPress").toBool() && !parent->hasActiveFocus()) { + event->ignore(); + return; + } m_client->forwardEvent(event); } void RenderWidgetHostViewQtDelegateQuick::mouseReleaseEvent(QMouseEvent *event) { + QQuickItem *parent = parentItem(); + if (parent && !parent->property("activeFocusOnPress").toBool() && !parent->hasActiveFocus()) { + event->ignore(); + return; + } m_client->forwardEvent(event); } @@ -254,14 +269,24 @@ void RenderWidgetHostViewQtDelegateQuick::wheelEvent(QWheelEvent *event) void RenderWidgetHostViewQtDelegateQuick::touchEvent(QTouchEvent *event) { + QQuickItem *parent = parentItem(); if (event->type() == QEvent::TouchBegin && !m_isPopup - && (parentItem() && parentItem()->property("activeFocusOnPress").toBool())) + && (parent && parent->property("activeFocusOnPress").toBool())) forceActiveFocus(); + if (parent && !parent->property("activeFocusOnPress").toBool() && !parent->hasActiveFocus()) { + event->ignore(); + return; + } m_client->forwardEvent(event); } void RenderWidgetHostViewQtDelegateQuick::hoverMoveEvent(QHoverEvent *event) { + QQuickItem *parent = parentItem(); + if (parent && !parent->property("activeFocusOnPress").toBool() && !parent->hasActiveFocus()) { + event->ignore(); + return; + } m_client->forwardEvent(event); } diff --git a/src/webenginewidgets/api/qwebenginepage.cpp b/src/webenginewidgets/api/qwebenginepage.cpp index 0e7f02f16..04b8a2b6f 100644 --- a/src/webenginewidgets/api/qwebenginepage.cpp +++ b/src/webenginewidgets/api/qwebenginepage.cpp @@ -1269,6 +1269,15 @@ void QWebEnginePagePrivate::startDragging(const content::DropData &dropData, adapter->startDragging(view, dropData, allowedActions, pixmap, offset); } +bool QWebEnginePagePrivate::isEnabled() const +{ + const Q_Q(QWebEnginePage); + const QWidget *view = q->view(); + if (view) + return view->isEnabled(); + return true; +} + QMenu *QWebEnginePage::createStandardContextMenu() { Q_D(QWebEnginePage); diff --git a/src/webenginewidgets/api/qwebenginepage_p.h b/src/webenginewidgets/api/qwebenginepage_p.h index 22bfaff95..26ef80e9a 100644 --- a/src/webenginewidgets/api/qwebenginepage_p.h +++ b/src/webenginewidgets/api/qwebenginepage_p.h @@ -135,6 +135,7 @@ public: virtual void updateContentsSize(const QSizeF &size) Q_DECL_OVERRIDE; void startDragging(const content::DropData &dropData, Qt::DropActions allowedActions, const QPixmap &pixmap, const QPoint &offset) Q_DECL_OVERRIDE; + virtual bool isEnabled() const Q_DECL_OVERRIDE; virtual QSharedPointer<QtWebEngineCore::BrowserContextAdapter> browserContextAdapter() Q_DECL_OVERRIDE; QtWebEngineCore::WebContentsAdapter *webContentsAdapter() Q_DECL_OVERRIDE; diff --git a/src/webenginewidgets/doc/src/qtwebkitportingguide.qdoc b/src/webenginewidgets/doc/src/qtwebkitportingguide.qdoc index e6236ec98..89d7cfb0c 100644 --- a/src/webenginewidgets/doc/src/qtwebkitportingguide.qdoc +++ b/src/webenginewidgets/doc/src/qtwebkitportingguide.qdoc @@ -248,7 +248,7 @@ \b {Qt WebEngine} \code QWebEnginePage page; - page.runJavascript("document.documentElement.contentEditable = true"); + page.runJavaScript("document.documentElement.contentEditable = true"); \endcode @@ -287,7 +287,7 @@ \li QWebPage::setContentEditable \li In the latest HTML standard, any document element can be made editable through the \c contentEditable attribute. So \c runJavaScript is all that is needed: - \c{page->runJavascript("document.documentElement.contentEditable = true")} + \c{page->runJavaScript("document.documentElement.contentEditable = true")} \row \li QWebPage::setLinkDelegationPolicy \li There is no way to connect a signal to run C++ code when a link is clicked. However, diff --git a/src/webenginewidgets/render_widget_host_view_qt_delegate_widget.cpp b/src/webenginewidgets/render_widget_host_view_qt_delegate_widget.cpp index 3f70187e7..99621b602 100644 --- a/src/webenginewidgets/render_widget_host_view_qt_delegate_widget.cpp +++ b/src/webenginewidgets/render_widget_host_view_qt_delegate_widget.cpp @@ -298,6 +298,34 @@ void RenderWidgetHostViewQtDelegateWidget::hideEvent(QHideEvent *event) bool RenderWidgetHostViewQtDelegateWidget::event(QEvent *event) { bool handled = false; + + // Mimic QWidget::event() by ignoring mouse, keyboard, touch and tablet events if the widget is + // disabled. + if (!isEnabled()) { + switch (event->type()) { + case QEvent::TabletPress: + case QEvent::TabletRelease: + case QEvent::TabletMove: + case QEvent::MouseButtonPress: + case QEvent::MouseButtonRelease: + case QEvent::MouseButtonDblClick: + case QEvent::MouseMove: + case QEvent::TouchBegin: + case QEvent::TouchUpdate: + case QEvent::TouchEnd: + case QEvent::TouchCancel: + case QEvent::ContextMenu: + case QEvent::KeyPress: + case QEvent::KeyRelease: +#ifndef QT_NO_WHEELEVENT + case QEvent::Wheel: +#endif + return false; + default: + break; + } + } + if (event->type() == QEvent::MouseButtonDblClick) { // QWidget keeps the Qt4 behavior where the DblClick event would replace the Press event. // QtQuick is different by sending both the Press and DblClick events for the second press |