diff options
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/api/qwebenginepage.cpp | 20 | ||||
-rw-r--r-- | src/core/api/qwebenginepage_p.h | 8 | ||||
-rw-r--r-- | src/core/render_widget_host_view_qt.cpp | 3 |
3 files changed, 29 insertions, 2 deletions
diff --git a/src/core/api/qwebenginepage.cpp b/src/core/api/qwebenginepage.cpp index 1b640c940..ac44fad10 100644 --- a/src/core/api/qwebenginepage.cpp +++ b/src/core/api/qwebenginepage.cpp @@ -33,6 +33,7 @@ #include "render_widget_host_view_qt_delegate.h" #include "render_widget_host_view_qt_delegate_client.h" #include "render_widget_host_view_qt_delegate_item.h" +#include "touch_selection_menu_controller.h" #include "web_contents_adapter.h" #include <QAction> @@ -1658,6 +1659,25 @@ QWebEnginePagePrivate::createTouchHandleDelegate(const QMap<int, QImage> &images return view->createTouchHandleDelegate(images); } +void QWebEnginePagePrivate::showTouchSelectionMenu( + QtWebEngineCore::TouchSelectionMenuController *controller, const QRect &selectionBounds, + const QSize &handleSize) +{ + Q_UNUSED(handleSize); + + if (controller->buttonCount() == 1) { + controller->runContextMenu(); + return; + } + + view->showTouchSelectionMenu(controller, selectionBounds); +} + +void QWebEnginePagePrivate::hideTouchSelectionMenu() +{ + view->hideTouchSelectionMenu(); +} + void QWebEnginePagePrivate::lifecycleStateChanged(LifecycleState state) { Q_Q(QWebEnginePage); diff --git a/src/core/api/qwebenginepage_p.h b/src/core/api/qwebenginepage_p.h index a56494a32..800a8ab04 100644 --- a/src/core/api/qwebenginepage_p.h +++ b/src/core/api/qwebenginepage_p.h @@ -79,6 +79,9 @@ public: virtual void hideAutofillPopup() = 0; virtual QtWebEngineCore::TouchHandleDrawableDelegate * createTouchHandleDelegate(const QMap<int, QImage> &) = 0; + virtual void showTouchSelectionMenu(QtWebEngineCore::TouchSelectionMenuController *, + const QRect &) = 0; + virtual void hideTouchSelectionMenu() = 0; }; class Q_WEBENGINECORE_PRIVATE_EXPORT QWebEnginePagePrivate : public QtWebEngineCore::WebContentsAdapterClient @@ -159,8 +162,9 @@ public: void printRequested() override; QtWebEngineCore::TouchHandleDrawableDelegate * createTouchHandleDelegate(const QMap<int, QImage> &) override; - void showTouchSelectionMenu(QtWebEngineCore::TouchSelectionMenuController *, const QRect &, const QSize &) override { } - void hideTouchSelectionMenu() override { } + void showTouchSelectionMenu(QtWebEngineCore::TouchSelectionMenuController *, const QRect &, + const QSize &) override; + void hideTouchSelectionMenu() override; const QObject *holdingQObject() const override; ClientType clientType() override { return QtWebEngineCore::WebContentsAdapterClient::WidgetsClient; } void findTextFinished(const QWebEngineFindTextResult &result) override; diff --git a/src/core/render_widget_host_view_qt.cpp b/src/core/render_widget_host_view_qt.cpp index 0dd067cc5..5d8f15321 100644 --- a/src/core/render_widget_host_view_qt.cpp +++ b/src/core/render_widget_host_view_qt.cpp @@ -217,6 +217,9 @@ RenderWidgetHostViewQt::~RenderWidgetHostViewQt() if (text_input_manager_) text_input_manager_->RemoveObserver(this); + if (host()->delegate()) + m_touchSelectionControllerClient->resetControls(); + m_touchSelectionController.reset(); m_touchSelectionControllerClient.reset(); |