Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(259)

Unified Diff: third_party/WebKit/Source/core/page/DragController.cpp

Issue 2950793002: Move drag related functions present in LocalFrame.cpp to correct files. (Closed)
Patch Set: Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/core/frame/LocalFrame.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/page/DragController.cpp
diff --git a/third_party/WebKit/Source/core/page/DragController.cpp b/third_party/WebKit/Source/core/page/DragController.cpp
index f5b309f22885e32fba7350c4a339df37498dde52..06c544bed155ed543989635af499616f2a07917d 100644
--- a/third_party/WebKit/Source/core/page/DragController.cpp
+++ b/third_party/WebKit/Source/core/page/DragController.cpp
@@ -76,6 +76,7 @@
#include "platform/graphics/BitmapImage.h"
#include "platform/graphics/Image.h"
#include "platform/graphics/ImageOrientation.h"
+#include "platform/graphics/paint/PaintRecordBuilder.h"
#include "platform/loader/fetch/ResourceFetcher.h"
#include "platform/loader/fetch/ResourceRequest.h"
#include "platform/weborigin/SecurityOrigin.h"
@@ -1080,6 +1081,29 @@ static std::unique_ptr<DragImage> DragImageForLink(
return drag_image;
}
+// static
+std::unique_ptr<DragImage> DragController::DragImageForSelection(
+ const LocalFrame& frame,
+ float opacity) {
+ if (!frame.Selection().ComputeVisibleSelectionInDOMTreeDeprecated().IsRange())
+ return nullptr;
+
+ frame.View()->UpdateAllLifecyclePhasesExceptPaint();
+ DCHECK(frame.GetDocument()->IsActive());
+
+ FloatRect painting_rect = FloatRect(frame.Selection().Bounds());
+ GlobalPaintFlags paint_flags =
+ kGlobalPaintSelectionOnly | kGlobalPaintFlattenCompositingLayers;
+
+ PaintRecordBuilder builder(
+ DataTransfer::DeviceSpaceBounds(painting_rect, frame));
+ frame.View()->PaintContents(builder.Context(), paint_flags,
+ EnclosingIntRect(painting_rect));
+ return DataTransfer::CreateDragImageForFrame(
+ frame, opacity, kDoNotRespectImageOrientation, painting_rect, builder,
+ PropertyTreeState::Root());
+}
+
bool DragController::StartDrag(LocalFrame* src,
const DragState& state,
const WebMouseEvent& drag_event,
« no previous file with comments | « third_party/WebKit/Source/core/frame/LocalFrame.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698