| 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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 if (m_webView->client() && m_webView->client()->acceptsLoadDrops()) | 54 if (m_webView->client() && m_webView->client()->acceptsLoadDrops()) |
| 55 return DragDestinationActionAny; | 55 return DragDestinationActionAny; |
| 56 | 56 |
| 57 return static_cast<DragDestinationAction>( | 57 return static_cast<DragDestinationAction>( |
| 58 DragDestinationActionDHTML | DragDestinationActionEdit); | 58 DragDestinationActionDHTML | DragDestinationActionEdit); |
| 59 } | 59 } |
| 60 | 60 |
| 61 void DragClientImpl::startDrag(DragImage* dragImage, const IntPoint& dragImageOr
igin, const IntPoint& eventPos, DataTransfer* dataTransfer, LocalFrame* frame, b
ool isLinkDrag) | 61 void DragClientImpl::startDrag(DragImage* dragImage, const IntPoint& dragImageOr
igin, const IntPoint& eventPos, DataTransfer* dataTransfer, LocalFrame* frame, b
ool isLinkDrag) |
| 62 { | 62 { |
| 63 // Add a ref to the frame just in case a load occurs mid-drag. | 63 // Add a ref to the frame just in case a load occurs mid-drag. |
| 64 RefPtr<LocalFrame> frameProtector = frame; | 64 RefPtrWillBeRawPtr<LocalFrame> frameProtector(frame); |
| 65 | 65 |
| 66 WebDragData dragData(dataTransfer->dataObject()); | 66 WebDragData dragData(dataTransfer->dataObject()); |
| 67 WebDragOperationsMask dragOperationMask = static_cast<WebDragOperationsMask>
(dataTransfer->sourceOperation()); | 67 WebDragOperationsMask dragOperationMask = static_cast<WebDragOperationsMask>
(dataTransfer->sourceOperation()); |
| 68 WebImage image; | 68 WebImage image; |
| 69 IntSize offsetSize(eventPos - dragImageOrigin); | 69 IntSize offsetSize(eventPos - dragImageOrigin); |
| 70 WebPoint offsetPoint(offsetSize.width(), offsetSize.height()); | 70 WebPoint offsetPoint(offsetSize.width(), offsetSize.height()); |
| 71 | 71 |
| 72 if (dragImage) { | 72 if (dragImage) { |
| 73 float resolutionScale = dragImage->resolutionScale(); | 73 float resolutionScale = dragImage->resolutionScale(); |
| 74 if (m_webView->deviceScaleFactor() != resolutionScale) { | 74 if (m_webView->deviceScaleFactor() != resolutionScale) { |
| 75 ASSERT(resolutionScale > 0); | 75 ASSERT(resolutionScale > 0); |
| 76 float scale = m_webView->deviceScaleFactor() / resolutionScale; | 76 float scale = m_webView->deviceScaleFactor() / resolutionScale; |
| 77 dragImage->scale(scale, scale); | 77 dragImage->scale(scale, scale); |
| 78 } | 78 } |
| 79 image = dragImage->bitmap(); | 79 image = dragImage->bitmap(); |
| 80 } | 80 } |
| 81 | 81 |
| 82 m_webView->startDragging(frame, dragData, dragOperationMask, image, offsetPo
int); | 82 m_webView->startDragging(frame, dragData, dragOperationMask, image, offsetPo
int); |
| 83 } | 83 } |
| 84 | 84 |
| 85 } // namespace blink | 85 } // namespace blink |
| OLD | NEW |