| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2007, 2009, 2010 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007, 2009, 2010 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2008 Google Inc. | 3 * Copyright (C) 2008 Google Inc. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 #include "core/dom/Node.h" | 39 #include "core/dom/Node.h" |
| 40 #include "core/dom/Text.h" | 40 #include "core/dom/Text.h" |
| 41 #include "core/dom/shadow/ShadowRoot.h" | 41 #include "core/dom/shadow/ShadowRoot.h" |
| 42 #include "core/editing/DragCaret.h" | 42 #include "core/editing/DragCaret.h" |
| 43 #include "core/editing/EditingUtilities.h" | 43 #include "core/editing/EditingUtilities.h" |
| 44 #include "core/editing/Editor.h" | 44 #include "core/editing/Editor.h" |
| 45 #include "core/editing/FrameSelection.h" | 45 #include "core/editing/FrameSelection.h" |
| 46 #include "core/editing/commands/DragAndDropCommand.h" | 46 #include "core/editing/commands/DragAndDropCommand.h" |
| 47 #include "core/editing/serializers/Serialization.h" | 47 #include "core/editing/serializers/Serialization.h" |
| 48 #include "core/events/TextEvent.h" | 48 #include "core/events/TextEvent.h" |
| 49 #include "core/frame/FrameHost.h" | |
| 50 #include "core/frame/FrameView.h" | 49 #include "core/frame/FrameView.h" |
| 51 #include "core/frame/LocalFrame.h" | 50 #include "core/frame/LocalFrame.h" |
| 52 #include "core/frame/Settings.h" | 51 #include "core/frame/Settings.h" |
| 53 #include "core/html/HTMLAnchorElement.h" | 52 #include "core/html/HTMLAnchorElement.h" |
| 54 #include "core/html/HTMLFormElement.h" | 53 #include "core/html/HTMLFormElement.h" |
| 55 #include "core/html/HTMLInputElement.h" | 54 #include "core/html/HTMLInputElement.h" |
| 56 #include "core/html/HTMLPlugInElement.h" | 55 #include "core/html/HTMLPlugInElement.h" |
| 57 #include "core/input/EventHandler.h" | 56 #include "core/input/EventHandler.h" |
| 58 #include "core/layout/HitTestRequest.h" | 57 #include "core/layout/HitTestRequest.h" |
| 59 #include "core/layout/HitTestResult.h" | 58 #include "core/layout/HitTestResult.h" |
| (...skipping 1063 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1123 if (!image || image->isNull() || !image->data() || !image->data()->size()) | 1122 if (!image || image->isNull() || !image->data() || !image->data()->size()) |
| 1124 return false; | 1123 return false; |
| 1125 // We shouldn't be starting a drag for an image that can't provide an | 1124 // We shouldn't be starting a drag for an image that can't provide an |
| 1126 // extension. | 1125 // extension. |
| 1127 // This is an early detection for problems encountered later upon drop. | 1126 // This is an early detection for problems encountered later upon drop. |
| 1128 DCHECK(!image->filenameExtension().isEmpty()); | 1127 DCHECK(!image->filenameExtension().isEmpty()); |
| 1129 if (!dragImage) { | 1128 if (!dragImage) { |
| 1130 const IntRect& imageRect = hitTestResult.imageRect(); | 1129 const IntRect& imageRect = hitTestResult.imageRect(); |
| 1131 IntSize imageSizeInPixels = imageRect.size(); | 1130 IntSize imageSizeInPixels = imageRect.size(); |
| 1132 // TODO(oshima): Remove this scaling and simply pass imageRect to | 1131 // TODO(oshima): Remove this scaling and simply pass imageRect to |
| 1133 // dragImageForImage | 1132 // dragImageForImage once all platforms are migrated to use zoom for dsf. |
| 1134 // once all platforms are migrated to use zoom for dsf. | 1133 imageSizeInPixels.scale(src->page()->deviceScaleFactorDeprecated()); |
| 1135 imageSizeInPixels.scale(src->host()->deviceScaleFactorDeprecated()); | |
| 1136 | 1134 |
| 1137 float screenDeviceScaleFactor = | 1135 float screenDeviceScaleFactor = |
| 1138 src->page()->chromeClient().screenInfo().deviceScaleFactor; | 1136 src->page()->chromeClient().screenInfo().deviceScaleFactor; |
| 1139 // Pass the selected image size in DIP becasue dragImageForImage clips the | 1137 // Pass the selected image size in DIP becasue dragImageForImage clips the |
| 1140 // image in DIP. The coordinates of the locations are in Viewport | 1138 // image in DIP. The coordinates of the locations are in Viewport |
| 1141 // coordinates, and they're converted in the Blink client. | 1139 // coordinates, and they're converted in the Blink client. |
| 1142 // TODO(oshima): Currently, the dragged image on high DPI is scaled and | 1140 // TODO(oshima): Currently, the dragged image on high DPI is scaled and |
| 1143 // can be blurry because of this. Consider to clip in the screen | 1141 // can be blurry because of this. Consider to clip in the screen |
| 1144 // coordinates to use high resolution image on high DPI screens. | 1142 // coordinates to use high resolution image on high DPI screens. |
| 1145 dragImage = dragImageForImage(element, image, screenDeviceScaleFactor, | 1143 dragImage = dragImageForImage(element, image, screenDeviceScaleFactor, |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1257 | 1255 |
| 1258 DEFINE_TRACE(DragController) { | 1256 DEFINE_TRACE(DragController) { |
| 1259 visitor->trace(m_page); | 1257 visitor->trace(m_page); |
| 1260 visitor->trace(m_documentUnderMouse); | 1258 visitor->trace(m_documentUnderMouse); |
| 1261 visitor->trace(m_dragInitiator); | 1259 visitor->trace(m_dragInitiator); |
| 1262 visitor->trace(m_dragState); | 1260 visitor->trace(m_dragState); |
| 1263 visitor->trace(m_fileInputElementUnderMouse); | 1261 visitor->trace(m_fileInputElementUnderMouse); |
| 1264 } | 1262 } |
| 1265 | 1263 |
| 1266 } // namespace blink | 1264 } // namespace blink |
| OLD | NEW |