| 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 958 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1055 dragImage = src->dragImageForSelection(DragImageAlpha); | 1057 dragImage = src->dragImageForSelection(DragImageAlpha); |
| 1056 dragLocation = dragLocationForSelectionDrag(src); | 1058 dragLocation = dragLocationForSelectionDrag(src); |
| 1057 } | 1059 } |
| 1058 doSystemDrag(dragImage.get(), dragLocation, dragOrigin, dataTransfer, src, | 1060 doSystemDrag(dragImage.get(), dragLocation, dragOrigin, dataTransfer, src, |
| 1059 false); | 1061 false); |
| 1060 } else if (state.m_dragType == DragSourceActionImage) { | 1062 } else if (state.m_dragType == DragSourceActionImage) { |
| 1061 if (imageURL.isEmpty() || !node || !node->isElementNode()) | 1063 if (imageURL.isEmpty() || !node || !node->isElementNode()) |
| 1062 return false; | 1064 return false; |
| 1063 Element* element = toElement(node); | 1065 Element* element = toElement(node); |
| 1064 Image* image = getImage(element); | 1066 Image* image = getImage(element); |
| 1065 if (!image || image->isNull()) | 1067 if (!image || image->isNull() || !image->data() || !image->data()->size()) |
| 1066 return false; | 1068 return false; |
| 1067 // We shouldn't be starting a drag for an image that can't provide an | 1069 // We shouldn't be starting a drag for an image that can't provide an |
| 1068 // extension. | 1070 // extension. |
| 1069 // This is an early detection for problems encountered later upon drop. | 1071 // This is an early detection for problems encountered later upon drop. |
| 1070 DCHECK(!image->filenameExtension().isEmpty()); | 1072 DCHECK(!image->filenameExtension().isEmpty()); |
| 1071 if (!dragImage) { | 1073 if (!dragImage) { |
| 1072 const IntRect& imageRect = hitTestResult.imageRect(); | 1074 const IntRect& imageRect = hitTestResult.imageRect(); |
| 1073 IntSize imageSizeInPixels = imageRect.size(); | 1075 IntSize imageSizeInPixels = imageRect.size(); |
| 1074 // TODO(oshima): Remove this scaling and simply pass imageRect to | 1076 // TODO(oshima): Remove this scaling and simply pass imageRect to |
| 1075 // dragImageForImage | 1077 // dragImageForImage |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1187 } | 1189 } |
| 1188 | 1190 |
| 1189 DEFINE_TRACE(DragController) { | 1191 DEFINE_TRACE(DragController) { |
| 1190 visitor->trace(m_page); | 1192 visitor->trace(m_page); |
| 1191 visitor->trace(m_documentUnderMouse); | 1193 visitor->trace(m_documentUnderMouse); |
| 1192 visitor->trace(m_dragInitiator); | 1194 visitor->trace(m_dragInitiator); |
| 1193 visitor->trace(m_fileInputElementUnderMouse); | 1195 visitor->trace(m_fileInputElementUnderMouse); |
| 1194 } | 1196 } |
| 1195 | 1197 |
| 1196 } // namespace blink | 1198 } // namespace blink |
| OLD | NEW |