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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
61 #include "core/page/DragState.h" | 61 #include "core/page/DragState.h" |
62 #include "core/page/EventHandler.h" | 62 #include "core/page/EventHandler.h" |
63 #include "core/page/Page.h" | 63 #include "core/page/Page.h" |
64 #include "core/frame/Settings.h" | 64 #include "core/frame/Settings.h" |
65 #include "core/rendering/HitTestRequest.h" | 65 #include "core/rendering/HitTestRequest.h" |
66 #include "core/rendering/HitTestResult.h" | 66 #include "core/rendering/HitTestResult.h" |
67 #include "core/rendering/RenderImage.h" | 67 #include "core/rendering/RenderImage.h" |
68 #include "core/rendering/RenderTheme.h" | 68 #include "core/rendering/RenderTheme.h" |
69 #include "core/rendering/RenderView.h" | 69 #include "core/rendering/RenderView.h" |
70 #include "platform/DragImage.h" | 70 #include "platform/DragImage.h" |
71 #include "platform/UserGestureIndicator.h" | |
71 #include "platform/geometry/FloatRect.h" | 72 #include "platform/geometry/FloatRect.h" |
72 #include "platform/graphics/Image.h" | 73 #include "platform/graphics/Image.h" |
73 #include "platform/graphics/ImageOrientation.h" | 74 #include "platform/graphics/ImageOrientation.h" |
74 #include "platform/network/ResourceRequest.h" | 75 #include "platform/network/ResourceRequest.h" |
75 #include "platform/weborigin/SecurityOrigin.h" | 76 #include "platform/weborigin/SecurityOrigin.h" |
76 #include "wtf/CurrentTime.h" | 77 #include "wtf/CurrentTime.h" |
77 #include "wtf/OwnPtr.h" | 78 #include "wtf/OwnPtr.h" |
78 #include "wtf/PassOwnPtr.h" | 79 #include "wtf/PassOwnPtr.h" |
79 #include "wtf/RefPtr.h" | 80 #include "wtf/RefPtr.h" |
80 | 81 |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
227 if (m_fileInputElementUnderMouse) | 228 if (m_fileInputElementUnderMouse) |
228 m_fileInputElementUnderMouse->setCanReceiveDroppedFiles(false); | 229 m_fileInputElementUnderMouse->setCanReceiveDroppedFiles(false); |
229 m_fileInputElementUnderMouse = nullptr; | 230 m_fileInputElementUnderMouse = nullptr; |
230 } | 231 } |
231 | 232 |
232 DragSession DragController::dragUpdated(DragData* dragData) | 233 DragSession DragController::dragUpdated(DragData* dragData) |
233 { | 234 { |
234 return dragEnteredOrUpdated(dragData); | 235 return dragEnteredOrUpdated(dragData); |
235 } | 236 } |
236 | 237 |
237 bool DragController::performDrag(DragData* dragData) | 238 bool DragController::performDrag(DragData* dragData) |
abarth-chromium
2014/03/24 03:51:29
Are you sure this can't be triggered by script?
wjywbs
2014/03/24 12:14:10
I tried to use script to trigger this function and
| |
238 { | 239 { |
239 ASSERT(dragData); | 240 ASSERT(dragData); |
241 UserGestureIndicator gesture(DefinitelyProcessingNewUserGesture); | |
242 | |
240 m_documentUnderMouse = m_page->mainFrame()->documentAtPoint(dragData->client Position()); | 243 m_documentUnderMouse = m_page->mainFrame()->documentAtPoint(dragData->client Position()); |
241 if ((m_dragDestinationAction & DragDestinationActionDHTML) && m_documentIsHa ndlingDrag) { | 244 if ((m_dragDestinationAction & DragDestinationActionDHTML) && m_documentIsHa ndlingDrag) { |
242 RefPtr<LocalFrame> mainFrame = m_page->mainFrame(); | 245 RefPtr<LocalFrame> mainFrame = m_page->mainFrame(); |
243 bool preventedDefault = false; | 246 bool preventedDefault = false; |
244 if (mainFrame->view()) { | 247 if (mainFrame->view()) { |
245 // Sending an event can result in the destruction of the view and pa rt. | 248 // Sending an event can result in the destruction of the view and pa rt. |
246 RefPtrWillBeRawPtr<Clipboard> clipboard = createDraggingClipboard(Cl ipboardReadable, dragData); | 249 RefPtrWillBeRawPtr<Clipboard> clipboard = createDraggingClipboard(Cl ipboardReadable, dragData); |
247 clipboard->setSourceOperation(dragData->draggingSourceOperationMask( )); | 250 clipboard->setSourceOperation(dragData->draggingSourceOperationMask( )); |
248 preventedDefault = mainFrame->eventHandler().performDragAndDrop(crea teMouseEvent(dragData), clipboard.get()); | 251 preventedDefault = mainFrame->eventHandler().performDragAndDrop(crea teMouseEvent(dragData), clipboard.get()); |
249 clipboard->setAccessPolicy(ClipboardNumb); // Invalidate clipboard h ere for security | 252 clipboard->setAccessPolicy(ClipboardNumb); // Invalidate clipboard h ere for security |
(...skipping 708 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
958 #else | 961 #else |
959 return keyState & PlatformEvent::CtrlKey; | 962 return keyState & PlatformEvent::CtrlKey; |
960 #endif | 963 #endif |
961 } | 964 } |
962 | 965 |
963 void DragController::cleanupAfterSystemDrag() | 966 void DragController::cleanupAfterSystemDrag() |
964 { | 967 { |
965 } | 968 } |
966 | 969 |
967 } // namespace WebCore | 970 } // namespace WebCore |
OLD | NEW |