< prev index next >

modules/javafx.web/src/main/native/Source/WebCore/page/DragController.cpp

Print this page




 853             dragLoc = dragLocForSelectionDrag(src);
 854             m_dragOffset = IntPoint(dragOrigin.x() - dragLoc.x(), dragOrigin.y() - dragLoc.y());
 855         }
 856 
 857         if (!dragImage)
 858             return false;
 859 
 860         doSystemDrag(WTFMove(dragImage), dragLoc, dragOrigin, dragImageBounds, dataTransfer, src, DragSourceActionSelection);
 861         return true;
 862     }
 863 
 864     if (!src.document()->securityOrigin().canDisplay(linkURL)) {
 865         src.document()->addConsoleMessage(MessageSource::Security, MessageLevel::Error, "Not allowed to drag local resource: " + linkURL.stringCenterEllipsizedToLength());
 866         return false;
 867     }
 868 
 869     if (!imageURL.isEmpty() && image && !image->isNull() && (m_dragSourceAction & DragSourceActionImage)) {
 870         // We shouldn't be starting a drag for an image that can't provide an extension.
 871         // This is an early detection for problems encountered later upon drop.
 872         ASSERT(!image->filenameExtension().isEmpty());



 873         if (!dataTransfer.pasteboard().hasData()) {
 874             m_draggingImageURL = imageURL;
 875             if (element.isContentRichlyEditable())
 876                 selectElement(element);
 877             declareAndWriteDragImage(dataTransfer, element, !linkURL.isEmpty() ? linkURL : imageURL, hitTestResult.altDisplayString());
 878         }
 879 
 880         m_client.willPerformDragSourceAction(DragSourceActionImage, dragOrigin, dataTransfer);
 881 
 882         if (!dragImage) {
 883             IntRect imageRect = hitTestResult.imageRect();
 884             imageRect.setLocation(m_page.mainFrame().view()->rootViewToContents(src.view()->contentsToRootView(imageRect.location())));
 885             doImageDrag(element, dragOrigin, hitTestResult.imageRect(), dataTransfer, src, m_dragOffset);
 886         } else {
 887             // DHTML defined drag image
 888             doSystemDrag(WTFMove(dragImage), dragLoc, dragOrigin, { }, dataTransfer, src, DragSourceActionImage);
 889         }
 890 
 891         return true;
 892     }




 853             dragLoc = dragLocForSelectionDrag(src);
 854             m_dragOffset = IntPoint(dragOrigin.x() - dragLoc.x(), dragOrigin.y() - dragLoc.y());
 855         }
 856 
 857         if (!dragImage)
 858             return false;
 859 
 860         doSystemDrag(WTFMove(dragImage), dragLoc, dragOrigin, dragImageBounds, dataTransfer, src, DragSourceActionSelection);
 861         return true;
 862     }
 863 
 864     if (!src.document()->securityOrigin().canDisplay(linkURL)) {
 865         src.document()->addConsoleMessage(MessageSource::Security, MessageLevel::Error, "Not allowed to drag local resource: " + linkURL.stringCenterEllipsizedToLength());
 866         return false;
 867     }
 868 
 869     if (!imageURL.isEmpty() && image && !image->isNull() && (m_dragSourceAction & DragSourceActionImage)) {
 870         // We shouldn't be starting a drag for an image that can't provide an extension.
 871         // This is an early detection for problems encountered later upon drop.
 872         ASSERT(!image->filenameExtension().isEmpty());
 873 #if PLATFORM(JAVA)
 874         m_client.updateFileExtension(imageURL);
 875 #endif
 876         if (!dataTransfer.pasteboard().hasData()) {
 877             m_draggingImageURL = imageURL;
 878             if (element.isContentRichlyEditable())
 879                 selectElement(element);
 880             declareAndWriteDragImage(dataTransfer, element, !linkURL.isEmpty() ? linkURL : imageURL, hitTestResult.altDisplayString());
 881         }
 882 
 883         m_client.willPerformDragSourceAction(DragSourceActionImage, dragOrigin, dataTransfer);
 884 
 885         if (!dragImage) {
 886             IntRect imageRect = hitTestResult.imageRect();
 887             imageRect.setLocation(m_page.mainFrame().view()->rootViewToContents(src.view()->contentsToRootView(imageRect.location())));
 888             doImageDrag(element, dragOrigin, hitTestResult.imageRect(), dataTransfer, src, m_dragOffset);
 889         } else {
 890             // DHTML defined drag image
 891             doSystemDrag(WTFMove(dragImage), dragLoc, dragOrigin, { }, dataTransfer, src, DragSourceActionImage);
 892         }
 893 
 894         return true;
 895     }


< prev index next >