Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 #include "web/DragClientImpl.h" | 31 #include "web/DragClientImpl.h" |
| 32 | 32 |
| 33 #include "core/clipboard/DataObject.h" | 33 #include "core/clipboard/DataObject.h" |
| 34 #include "core/clipboard/DataTransfer.h" | 34 #include "core/clipboard/DataTransfer.h" |
| 35 #include "core/frame/LocalFrame.h" | 35 #include "core/frame/LocalFrame.h" |
| 36 #include "core/page/ChromeClient.h" | |
|
jbroman
2016/01/13 15:35:13
nit: Why this include? You don't seem to have adde
oshima
2016/01/13 18:19:43
m_webView->client() returns ChromeClient
dcheng
2016/01/13 18:20:53
This returns WebViewClient, not ChromeClient.
| |
| 36 #include "platform/DragImage.h" | 37 #include "platform/DragImage.h" |
| 37 #include "platform/geometry/IntSize.h" | 38 #include "platform/geometry/IntSize.h" |
| 38 #include "public/platform/WebCommon.h" | 39 #include "public/platform/WebCommon.h" |
| 39 #include "public/platform/WebDragData.h" | 40 #include "public/platform/WebDragData.h" |
| 40 #include "public/platform/WebImage.h" | 41 #include "public/platform/WebImage.h" |
| 41 #include "public/platform/WebPoint.h" | 42 #include "public/platform/WebPoint.h" |
| 42 #include "public/web/WebDragOperation.h" | 43 #include "public/web/WebDragOperation.h" |
| 43 #include "public/web/WebViewClient.h" | 44 #include "public/web/WebViewClient.h" |
| 44 #include "web/WebViewImpl.h" | 45 #include "web/WebViewImpl.h" |
| 45 #include "wtf/Assertions.h" | 46 #include "wtf/Assertions.h" |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 62 RefPtrWillBeRawPtr<LocalFrame> frameProtector(frame); | 63 RefPtrWillBeRawPtr<LocalFrame> frameProtector(frame); |
| 63 | 64 |
| 64 WebDragData dragData = dataTransfer->dataObject()->toWebDragData(); | 65 WebDragData dragData = dataTransfer->dataObject()->toWebDragData(); |
| 65 WebDragOperationsMask dragOperationMask = static_cast<WebDragOperationsMask> (dataTransfer->sourceOperation()); | 66 WebDragOperationsMask dragOperationMask = static_cast<WebDragOperationsMask> (dataTransfer->sourceOperation()); |
| 66 WebImage image; | 67 WebImage image; |
| 67 IntSize offsetSize(eventPos - dragImageOrigin); | 68 IntSize offsetSize(eventPos - dragImageOrigin); |
| 68 WebPoint offsetPoint(offsetSize.width(), offsetSize.height()); | 69 WebPoint offsetPoint(offsetSize.width(), offsetSize.height()); |
| 69 | 70 |
| 70 if (dragImage) { | 71 if (dragImage) { |
| 71 float resolutionScale = dragImage->resolutionScale(); | 72 float resolutionScale = dragImage->resolutionScale(); |
| 72 if (m_webView->deviceScaleFactor() != resolutionScale) { | 73 float deviceScaleFactor = |
| 74 m_webView->client()->screenInfo().deviceScaleFactor; | |
| 75 if (deviceScaleFactor != resolutionScale) { | |
| 73 ASSERT(resolutionScale > 0); | 76 ASSERT(resolutionScale > 0); |
| 74 float scale = m_webView->deviceScaleFactor() / resolutionScale; | 77 float scale = deviceScaleFactor / resolutionScale; |
| 75 dragImage->scale(scale, scale); | 78 dragImage->scale(scale, scale); |
| 76 } | 79 } |
| 77 image = dragImage->bitmap(); | 80 image = dragImage->bitmap(); |
| 78 } | 81 } |
| 79 | 82 |
| 80 m_webView->startDragging(frame, dragData, dragOperationMask, image, offsetPo int); | 83 m_webView->startDragging(frame, dragData, dragOperationMask, image, offsetPo int); |
| 81 } | 84 } |
| 82 | 85 |
| 83 } // namespace blink | 86 } // namespace blink |
| OLD | NEW |