| 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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 #include "core/layout/LayoutTheme.h" | 62 #include "core/layout/LayoutTheme.h" |
| 63 #include "core/layout/api/LayoutViewItem.h" | 63 #include "core/layout/api/LayoutViewItem.h" |
| 64 #include "core/loader/FrameLoadRequest.h" | 64 #include "core/loader/FrameLoadRequest.h" |
| 65 #include "core/loader/FrameLoader.h" | 65 #include "core/loader/FrameLoader.h" |
| 66 #include "core/page/ChromeClient.h" | 66 #include "core/page/ChromeClient.h" |
| 67 #include "core/page/DragData.h" | 67 #include "core/page/DragData.h" |
| 68 #include "core/page/DragSession.h" | 68 #include "core/page/DragSession.h" |
| 69 #include "core/page/DragState.h" | 69 #include "core/page/DragState.h" |
| 70 #include "core/page/Page.h" | 70 #include "core/page/Page.h" |
| 71 #include "platform/DragImage.h" | 71 #include "platform/DragImage.h" |
| 72 #include "platform/SharedBuffer.h" |
| 72 #include "platform/geometry/IntRect.h" | 73 #include "platform/geometry/IntRect.h" |
| 73 #include "platform/geometry/IntSize.h" | 74 #include "platform/geometry/IntSize.h" |
| 74 #include "platform/graphics/BitmapImage.h" | 75 #include "platform/graphics/BitmapImage.h" |
| 75 #include "platform/graphics/Image.h" | 76 #include "platform/graphics/Image.h" |
| 76 #include "platform/graphics/ImageOrientation.h" | 77 #include "platform/graphics/ImageOrientation.h" |
| 77 #include "platform/network/ResourceRequest.h" | 78 #include "platform/network/ResourceRequest.h" |
| 78 #include "platform/weborigin/SecurityOrigin.h" | 79 #include "platform/weborigin/SecurityOrigin.h" |
| 79 #include "public/platform/WebCommon.h" | 80 #include "public/platform/WebCommon.h" |
| 80 #include "public/platform/WebDragData.h" | 81 #include "public/platform/WebDragData.h" |
| 81 #include "public/platform/WebDragOperation.h" | 82 #include "public/platform/WebDragOperation.h" |
| 82 #include "public/platform/WebImage.h" | 83 #include "public/platform/WebImage.h" |
| 83 #include "public/platform/WebPoint.h" | 84 #include "public/platform/WebPoint.h" |
| 84 #include "public/platform/WebScreenInfo.h" | 85 #include "public/platform/WebScreenInfo.h" |
| 85 #include "wtf/Assertions.h" | 86 #include "wtf/Assertions.h" |
| 86 #include "wtf/CurrentTime.h" | 87 #include "wtf/CurrentTime.h" |
| 88 #include "wtf/PassRefPtr.h" |
| 87 #include "wtf/RefPtr.h" | 89 #include "wtf/RefPtr.h" |
| 88 #include <memory> | 90 #include <memory> |
| 89 | 91 |
| 90 #if OS(WIN) | 92 #if OS(WIN) |
| 91 #include <windows.h> | 93 #include <windows.h> |
| 92 #endif | 94 #endif |
| 93 | 95 |
| 94 namespace blink { | 96 namespace blink { |
| 95 | 97 |
| 96 static const int MaxOriginalImageArea = 1500 * 1500; | 98 static const int MaxOriginalImageArea = 1500 * 1500; |
| (...skipping 982 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1079 dragImage = src->dragImageForSelection(DragImageAlpha); | 1081 dragImage = src->dragImageForSelection(DragImageAlpha); |
| 1080 dragLocation = dragLocationForSelectionDrag(src); | 1082 dragLocation = dragLocationForSelectionDrag(src); |
| 1081 } | 1083 } |
| 1082 doSystemDrag(dragImage.get(), dragLocation, dragOrigin, dataTransfer, src, | 1084 doSystemDrag(dragImage.get(), dragLocation, dragOrigin, dataTransfer, src, |
| 1083 false); | 1085 false); |
| 1084 } else if (state.m_dragType == DragSourceActionImage) { | 1086 } else if (state.m_dragType == DragSourceActionImage) { |
| 1085 if (imageURL.isEmpty() || !node || !node->isElementNode()) | 1087 if (imageURL.isEmpty() || !node || !node->isElementNode()) |
| 1086 return false; | 1088 return false; |
| 1087 Element* element = toElement(node); | 1089 Element* element = toElement(node); |
| 1088 Image* image = getImage(element); | 1090 Image* image = getImage(element); |
| 1089 if (!image || image->isNull()) | 1091 if (!image || image->isNull() || !image->data() || !image->data()->size()) |
| 1090 return false; | 1092 return false; |
| 1091 // We shouldn't be starting a drag for an image that can't provide an | 1093 // We shouldn't be starting a drag for an image that can't provide an |
| 1092 // extension. | 1094 // extension. |
| 1093 // This is an early detection for problems encountered later upon drop. | 1095 // This is an early detection for problems encountered later upon drop. |
| 1094 DCHECK(!image->filenameExtension().isEmpty()); | 1096 DCHECK(!image->filenameExtension().isEmpty()); |
| 1095 if (!dragImage) { | 1097 if (!dragImage) { |
| 1096 const IntRect& imageRect = hitTestResult.imageRect(); | 1098 const IntRect& imageRect = hitTestResult.imageRect(); |
| 1097 IntSize imageSizeInPixels = imageRect.size(); | 1099 IntSize imageSizeInPixels = imageRect.size(); |
| 1098 // TODO(oshima): Remove this scaling and simply pass imageRect to | 1100 // TODO(oshima): Remove this scaling and simply pass imageRect to |
| 1099 // dragImageForImage | 1101 // dragImageForImage |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1211 } | 1213 } |
| 1212 | 1214 |
| 1213 DEFINE_TRACE(DragController) { | 1215 DEFINE_TRACE(DragController) { |
| 1214 visitor->trace(m_page); | 1216 visitor->trace(m_page); |
| 1215 visitor->trace(m_documentUnderMouse); | 1217 visitor->trace(m_documentUnderMouse); |
| 1216 visitor->trace(m_dragInitiator); | 1218 visitor->trace(m_dragInitiator); |
| 1217 visitor->trace(m_fileInputElementUnderMouse); | 1219 visitor->trace(m_fileInputElementUnderMouse); |
| 1218 } | 1220 } |
| 1219 | 1221 |
| 1220 } // namespace blink | 1222 } // namespace blink |
| OLD | NEW |