summaryrefslogtreecommitdiffstats
path: root/src/core/web_contents_adapter.cpp
diff options
context:
space:
mode:
authorMichael BrĂ¼ning <michael.bruning@qt.io>2018-08-20 16:26:03 +0200
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2018-08-21 15:18:19 +0200
commitbe18c1dcfa68328acdf11e0a534749d9a5d75f8b (patch)
tree53a7b347d2771f4502338ac973a80a37edacdee7 /src/core/web_contents_adapter.cpp
parentb74e93a9b07243da4f3d2784cde49916de455364 (diff)
parente56dd7e37ea96c4ba1354e319bdaa9d01c401747 (diff)
Merge remote-tracking branch 'origin/5.11' into 5.12
Conflicts: .qmake.conf configure.json examples/webenginewidgets/markdowneditor/resources/3rdparty/marked.js examples/webenginewidgets/markdowneditor/resources/3rdparty/qt_attribution.json examples/webenginewidgets/markdowneditor/resources/markdowneditor.qrc mkspecs/features/platform.prf src/3rdparty src/core/media_capture_devices_dispatcher.cpp src/core/net/url_request_context_getter_qt.cpp src/core/net/url_request_context_getter_qt.h src/core/web_contents_adapter.cpp Change-Id: I467133ba455b1f85f6bb61793794c31cb1094541
Diffstat (limited to 'src/core/web_contents_adapter.cpp')
-rw-r--r--src/core/web_contents_adapter.cpp42
1 files changed, 22 insertions, 20 deletions
diff --git a/src/core/web_contents_adapter.cpp b/src/core/web_contents_adapter.cpp
index 84b97412b..c7c20c23e 100644
--- a/src/core/web_contents_adapter.cpp
+++ b/src/core/web_contents_adapter.cpp
@@ -1450,23 +1450,6 @@ static void fillDropDataFromMimeData(content::DropData *dropData, const QMimeDat
}
}
-void WebContentsAdapter::enterDrag(QDragEnterEvent *e, const QPointF &screenPos)
-{
- CHECK_INITIALIZED();
-
- if (!m_currentDropData) {
- // The drag originated outside the WebEngineView.
- m_currentDropData.reset(new content::DropData);
- fillDropDataFromMimeData(m_currentDropData.get(), e->mimeData());
- }
-
- content::RenderViewHost *rvh = m_webContents->GetRenderViewHost();
- rvh->GetWidget()->FilterDropData(m_currentDropData.get());
- rvh->GetWidget()->DragTargetDragEnter(*m_currentDropData, toGfx(e->posF()), toGfx(screenPos),
- toWeb(e->possibleActions()),
- flagsFromModifiers(e->keyboardModifiers()));
-}
-
Qt::DropAction toQt(blink::WebDragOperation op)
{
if (op & blink::kWebDragOperationCopy)
@@ -1504,6 +1487,23 @@ static int toWeb(Qt::KeyboardModifiers modifiers)
return result;
}
+void WebContentsAdapter::enterDrag(QDragEnterEvent *e, const QPointF &screenPos)
+{
+ CHECK_INITIALIZED();
+
+ if (!m_currentDropData) {
+ // The drag originated outside the WebEngineView.
+ m_currentDropData.reset(new content::DropData);
+ fillDropDataFromMimeData(m_currentDropData.get(), e->mimeData());
+ }
+
+ content::RenderViewHost *rvh = m_webContents->GetRenderViewHost();
+ rvh->GetWidget()->FilterDropData(m_currentDropData.get());
+ rvh->GetWidget()->DragTargetDragEnter(*m_currentDropData, toGfx(e->posF()), toGfx(screenPos),
+ toWeb(e->possibleActions()),
+ toWeb(e->mouseButtons()) | toWeb(e->keyboardModifiers()));
+}
+
Qt::DropAction WebContentsAdapter::updateDragPosition(QDragMoveEvent *e, const QPointF &screenPos)
{
CHECK_INITIALIZED(Qt::DropAction());
@@ -1545,14 +1545,16 @@ void WebContentsAdapter::updateDragAction(int action)
m_currentDropAction = static_cast<blink::WebDragOperation>(action);
}
-void WebContentsAdapter::endDragging(const QPointF &clientPos, const QPointF &screenPos)
+void WebContentsAdapter::endDragging(QDropEvent *e, const QPointF &screenPos)
{
CHECK_INITIALIZED();
content::RenderViewHost *rvh = m_webContents->GetRenderViewHost();
rvh->GetWidget()->FilterDropData(m_currentDropData.get());
- m_lastDragClientPos = clientPos;
+ m_lastDragClientPos = e->posF();
m_lastDragScreenPos = screenPos;
- rvh->GetWidget()->DragTargetDrop(*m_currentDropData, toGfx(m_lastDragClientPos), toGfx(m_lastDragScreenPos), 0);
+ rvh->GetWidget()->DragTargetDrop(*m_currentDropData, toGfx(m_lastDragClientPos), toGfx(m_lastDragScreenPos),
+ toWeb(e->mouseButtons()) | toWeb(e->keyboardModifiers()));
+
m_currentDropData.reset();
}