Chromium Code Reviews| 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 cd5db69054923e406dfdbe8d4f841baababf622c..5388ee4e823a22a047c6efd41df535d38de43cc1 100644 |
| --- a/third_party/WebKit/Source/core/page/DragController.cpp |
| +++ b/third_party/WebKit/Source/core/page/DragController.cpp |
| @@ -60,6 +60,7 @@ |
| #include "core/layout/LayoutView.h" |
| #include "core/loader/FrameLoadRequest.h" |
| #include "core/loader/FrameLoader.h" |
| +#include "core/page/ChromeClient.h" |
| #include "core/page/DragClient.h" |
| #include "core/page/DragData.h" |
| #include "core/page/DragSession.h" |
| @@ -75,6 +76,7 @@ |
| #include "platform/graphics/ImageOrientation.h" |
| #include "platform/network/ResourceRequest.h" |
| #include "platform/weborigin/SecurityOrigin.h" |
| +#include "public/platform/WebScreenInfo.h" |
| #include "wtf/CurrentTime.h" |
| #include "wtf/OwnPtr.h" |
| #include "wtf/PassOwnPtr.h" |
| @@ -790,7 +792,7 @@ static const IntSize& maxDragImageSize() |
| return maxDragImageSize; |
| } |
| -static PassOwnPtr<DragImage> dragImageForImage(Element* element, Image* image, const IntPoint& dragOrigin, const IntRect& imageRect, IntPoint& dragLocation) |
| +static PassOwnPtr<DragImage> dragImageForImage(Element* element, Image* image, const IntPoint& dragOrigin, const IntPoint& imageLocation, const IntSize& imageSizeInDIP, IntPoint& dragLocation) |
| { |
| OwnPtr<DragImage> dragImage; |
| IntPoint origin; |
| @@ -805,9 +807,9 @@ static PassOwnPtr<DragImage> dragImageForImage(Element* element, Image* image, c |
| if (image->size().height() * image->size().width() <= MaxOriginalImageArea |
| && (dragImage = DragImage::create(image, shouldRespectImageOrientation, |
| 1 /* deviceScaleFactor */, interpolationQuality, DragImageAlpha, |
| - DragImage::clampedImageScale(orientation.usesWidthAsHeight() ? image->size().transposedSize() : image->size(), imageRect.size(), maxDragImageSize())))) { |
| - IntSize originalSize = imageRect.size(); |
| - origin = imageRect.location(); |
| + DragImage::clampedImageScale(orientation.usesWidthAsHeight() ? image->size().transposedSize() : image->size(), imageSizeInDIP, maxDragImageSize())))) { |
| + IntSize originalSize = imageSizeInDIP; |
| + origin = imageLocation; |
| IntSize newSize = dragImage->size(); |
| @@ -886,7 +888,9 @@ bool DragController::startDrag(LocalFrame* src, const DragState& state, const Pl |
| // This is an early detection for problems encountered later upon drop. |
| ASSERT(!image->filenameExtension().isEmpty()); |
| if (!dragImage) { |
| - dragImage = dragImageForImage(element, image, dragOrigin, hitTestResult.imageRect(), dragLocation); |
| + const IntRect& imageRect = hitTestResult.imageRect(); |
| + const IntSize& imageSizeInDIP = src->page()->chromeClient().viewportToScreen(imageRect).size(); |
| + dragImage = dragImageForImage(element, image, dragOrigin, imageRect.location(), imageSizeInDIP, dragLocation); |
|
dcheng
2016/01/22 17:37:41
I don't really understand what transformations are
oshima
2016/01/22 22:49:02
This is because dragImageForImage clips the image
|
| } |
| doSystemDrag(dragImage.get(), dragLocation, dragOrigin, dataTransfer, src, false); |
| } else if (state.m_dragType == DragSourceActionLink) { |
| @@ -902,8 +906,8 @@ bool DragController::startDrag(LocalFrame* src, const DragState& state, const Pl |
| if (!dragImage) { |
| ASSERT(src->page()); |
| - float deviceScaleFactor = src->page()->deviceScaleFactor(); |
| - dragImage = dragImageForLink(linkURL, hitTestResult.textContent(), deviceScaleFactor, mouseDraggedPoint, dragLocation); |
| + float screenDeviceScaleFactor = src->page()->chromeClient().screenInfo().deviceScaleFactor; |
| + dragImage = dragImageForLink(linkURL, hitTestResult.textContent(), screenDeviceScaleFactor, mouseDraggedPoint, dragLocation); |
| } |
| doSystemDrag(dragImage.get(), dragLocation, mouseDraggedPoint, dataTransfer, src, true); |
| } else if (state.m_dragType == DragSourceActionDHTML) { |