diff options
-rw-r--r-- | src/core/web_contents_adapter.cpp | 29 | ||||
-rw-r--r-- | src/core/web_contents_adapter_p.h | 2 | ||||
-rw-r--r-- | tools/qmake/mkspecs/features/functions.prf | 21 |
3 files changed, 20 insertions, 32 deletions
diff --git a/src/core/web_contents_adapter.cpp b/src/core/web_contents_adapter.cpp index 03b62d190..fadbd6d2e 100644 --- a/src/core/web_contents_adapter.cpp +++ b/src/core/web_contents_adapter.cpp @@ -351,7 +351,6 @@ WebContentsAdapterPrivate::WebContentsAdapterPrivate() , adapterClient(0) , nextRequestId(CallbackDirectory::ReservedCallbackIdsEnd) , lastFindRequestId(0) - , currentDropData(nullptr) , currentDropAction(Qt::IgnoreAction) , inDragUpdateLoop(false) , updateDragCursorMessagePollingTimer(new QTimer) @@ -1134,15 +1133,14 @@ void WebContentsAdapter::startDragging(QObject *dragSource, const content::DropD // Clear certain fields of the drop data to not run into DCHECKs // of DropDataToWebDragData in render_view_impl.cc. - content::DropData fixedDropData = dropData; - fixedDropData.download_metadata.clear(); - fixedDropData.file_contents.clear(); - fixedDropData.file_description_filename.clear(); + d->currentDropData.reset(new content::DropData(dropData)); + d->currentDropData->download_metadata.clear(); + d->currentDropData->file_contents.clear(); + d->currentDropData->file_description_filename.clear(); d->currentDropAction = Qt::IgnoreAction; - d->currentDropData = &fixedDropData; QDrag *drag = new QDrag(dragSource); // will be deleted by Qt's DnD implementation - drag->setMimeData(mimeDataFromDropData(fixedDropData)); + drag->setMimeData(mimeDataFromDropData(*d->currentDropData)); if (!pixmap.isNull()) { drag->setPixmap(pixmap); drag->setHotSpot(offset); @@ -1155,7 +1153,7 @@ void WebContentsAdapter::startDragging(QObject *dragSource, const content::DropD content::RenderViewHost *rvh = d->webContents->GetRenderViewHost(); rvh->DragSourceSystemDragEnded(); - d->currentDropData = nullptr; + d->currentDropData.reset(); } static blink::WebDragOperationsMask toWeb(const Qt::DropActions action) @@ -1192,17 +1190,15 @@ void WebContentsAdapter::enterDrag(QDragEnterEvent *e, const QPoint &screenPos) { Q_D(WebContentsAdapter); - std::unique_ptr<content::DropData> ownedDropData; - const content::DropData *rvhDropData = d->currentDropData; - if (!rvhDropData) { + if (!d->currentDropData) { // The drag originated outside the WebEngineView. - ownedDropData.reset(new content::DropData); - fillDropDataFromMimeData(ownedDropData.get(), e->mimeData()); - rvhDropData = ownedDropData.get(); + d->currentDropData.reset(new content::DropData); + fillDropDataFromMimeData(d->currentDropData.get(), e->mimeData()); } content::RenderViewHost *rvh = d->webContents->GetRenderViewHost(); - rvh->DragTargetDragEnter(*rvhDropData, toGfx(e->pos()), toGfx(screenPos), + rvh->FilterDropData(d->currentDropData.get()); + rvh->DragTargetDragEnter(*d->currentDropData, toGfx(e->pos()), toGfx(screenPos), toWeb(e->possibleActions()), flagsFromModifiers(e->keyboardModifiers())); } @@ -1258,7 +1254,9 @@ void WebContentsAdapter::endDragging(const QPoint &clientPos, const QPoint &scre Q_D(WebContentsAdapter); finishDragUpdate(); content::RenderViewHost *rvh = d->webContents->GetRenderViewHost(); + rvh->FilterDropData(d->currentDropData.get()); rvh->DragTargetDrop(*d->currentDropData, toGfx(clientPos), toGfx(screenPos), 0); + d->currentDropData.reset(); } void WebContentsAdapter::leaveDrag() @@ -1267,6 +1265,7 @@ void WebContentsAdapter::leaveDrag() finishDragUpdate(); content::RenderViewHost *rvh = d->webContents->GetRenderViewHost(); rvh->DragTargetDragLeave(); + d->currentDropData.reset(); } void WebContentsAdapter::initUpdateDragCursorMessagePollingTimer() diff --git a/src/core/web_contents_adapter_p.h b/src/core/web_contents_adapter_p.h index 77522d299..23a1aaef4 100644 --- a/src/core/web_contents_adapter_p.h +++ b/src/core/web_contents_adapter_p.h @@ -92,7 +92,7 @@ public: WebContentsAdapterClient *adapterClient; quint64 nextRequestId; int lastFindRequestId; - const content::DropData *currentDropData; + std::unique_ptr<content::DropData> currentDropData; Qt::DropAction currentDropAction; bool inDragUpdateLoop; base::Closure dragUpdateLoopQuitClosure; diff --git a/tools/qmake/mkspecs/features/functions.prf b/tools/qmake/mkspecs/features/functions.prf index 95b8c5569..047f887d1 100644 --- a/tools/qmake/mkspecs/features/functions.prf +++ b/tools/qmake/mkspecs/features/functions.prf @@ -274,28 +274,17 @@ defineReplace(findOrBuildNinja) { !exists($$out) { src_3rd_party_dir = $$absolute_path("$${getChromiumSrcDir()}/../", "$$QTWEBENGINE_ROOT") - out = $$shadowed($$absolute_path("ninja/ninja", "$$src_3rd_party_dir")) + out = $$shadowed($$absolute_path(ninja/ninja, $$src_3rd_party_dir)) win32: out = $${out}.exe - out = $$system_path($$out) # If we did not find ninja, then we bootstrap it. !exists($$out) { - # If we are making a shadow build, copy the ninja sources to the build directory. - !equals(PWD, $${OUT_PWD}) { - log("Build directory is different from source directory - copying ninja sources to the build tree...") - shadow_3rd_party_path = $$system_path($$shadowed($$src_3rd_party_dir)) - - !exists($$dirname(out)): mkpath($$dirname(out)) - copy_dir_files { - system("$$QMAKE_COPY_DIR $$system_quote($$system_path($$absolute_path("ninja", "$$src_3rd_party_dir"))) $$system_quote($$dirname(out))") - } else { - system("$$QMAKE_COPY_DIR $$system_quote($$system_path($$absolute_path("ninja", "$$src_3rd_party_dir"))) $$system_quote($$shadow_3rd_party_path)") - } - } - system("cd $$system_quote($$dirname(out)) && python configure.py --bootstrap") + mkpath($$dirname(out)) + ninja_configure = $$absolute_path(ninja/configure.py, $$src_3rd_party_dir) + system("cd $$system_quote($$system_path($$dirname(out))) && python $$system_quote($$system_path($$ninja_configure)) --bootstrap") } } - return($$out) + return($$system_path($$out)) } defineTest(skipBuild) { |