| 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 fafb0d48a3b7a0f4dfefcf1e76748a2d8b6d83c7..d1f4791f7087bd1d8645262ff1a32f743b1d3572 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,28 @@ static std::unique_ptr<DragImage> DragImageForLink(
|
| return drag_image;
|
| }
|
|
|
| +std::unique_ptr<DragImage> DragController::DragImageForSelection(
|
| + const LocalFrame& src,
|
| + float opacity) {
|
| + if (!src.Selection().ComputeVisibleSelectionInDOMTreeDeprecated().IsRange())
|
| + return nullptr;
|
| +
|
| + src.View()->UpdateAllLifecyclePhasesExceptPaint();
|
| + DCHECK(src.GetDocument()->IsActive());
|
| +
|
| + FloatRect painting_rect = FloatRect(src.Selection().Bounds());
|
| + GlobalPaintFlags paint_flags =
|
| + kGlobalPaintSelectionOnly | kGlobalPaintFlattenCompositingLayers;
|
| +
|
| + PaintRecordBuilder builder(
|
| + DataTransfer::DeviceSpaceBounds(painting_rect, src));
|
| + src.View()->PaintContents(builder.Context(), paint_flags,
|
| + EnclosingIntRect(painting_rect));
|
| + return DataTransfer::CreateDragImageForFrame(
|
| + src, opacity, kDoNotRespectImageOrientation, painting_rect, builder,
|
| + PropertyTreeState::Root());
|
| +}
|
| +
|
| bool DragController::StartDrag(LocalFrame* src,
|
| const DragState& state,
|
| const WebMouseEvent& drag_event,
|
| @@ -1124,7 +1147,7 @@ bool DragController::StartDrag(LocalFrame* src,
|
| Node* node = state.drag_src_.Get();
|
| if (state.drag_type_ == kDragSourceActionSelection) {
|
| if (!drag_image) {
|
| - drag_image = src->DragImageForSelection(kDragImageAlpha);
|
| + drag_image = DragImageForSelection(*src, kDragImageAlpha);
|
| drag_location = DragLocationForSelectionDrag(src);
|
| }
|
| DoSystemDrag(drag_image.get(), drag_location, drag_origin, data_transfer,
|
|
|