| 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 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 return dragEnteredOrUpdated(dragData); | 208 return dragEnteredOrUpdated(dragData); |
| 209 } | 209 } |
| 210 | 210 |
| 211 void DragController::dragExited(DragData* dragData) | 211 void DragController::dragExited(DragData* dragData) |
| 212 { | 212 { |
| 213 ASSERT(dragData); | 213 ASSERT(dragData); |
| 214 LocalFrame* mainFrame = m_page->deprecatedLocalMainFrame(); | 214 LocalFrame* mainFrame = m_page->deprecatedLocalMainFrame(); |
| 215 | 215 |
| 216 RefPtrWillBeRawPtr<FrameView> frameView(mainFrame->view()); | 216 RefPtrWillBeRawPtr<FrameView> frameView(mainFrame->view()); |
| 217 if (frameView) { | 217 if (frameView) { |
| 218 DataTransferAccessPolicy policy = (!m_documentUnderMouse || m_documentUn
derMouse->securityOrigin()->isLocal()) ? DataTransferReadable : DataTransferType
sReadable; | 218 DataTransferAccessPolicy policy = (!m_documentUnderMouse || m_documentUn
derMouse->getSecurityOrigin()->isLocal()) ? DataTransferReadable : DataTransferT
ypesReadable; |
| 219 DataTransfer* dataTransfer = createDraggingDataTransfer(policy, dragData
); | 219 DataTransfer* dataTransfer = createDraggingDataTransfer(policy, dragData
); |
| 220 dataTransfer->setSourceOperation(dragData->draggingSourceOperationMask()
); | 220 dataTransfer->setSourceOperation(dragData->draggingSourceOperationMask()
); |
| 221 mainFrame->eventHandler().cancelDragAndDrop(createMouseEvent(dragData),
dataTransfer); | 221 mainFrame->eventHandler().cancelDragAndDrop(createMouseEvent(dragData),
dataTransfer); |
| 222 dataTransfer->setAccessPolicy(DataTransferNumb); // invalidate clipboard
here for security | 222 dataTransfer->setAccessPolicy(DataTransferNumb); // invalidate clipboard
here for security |
| 223 } | 223 } |
| 224 mouseMovedIntoDocument(nullptr); | 224 mouseMovedIntoDocument(nullptr); |
| 225 if (m_fileInputElementUnderMouse) | 225 if (m_fileInputElementUnderMouse) |
| 226 m_fileInputElementUnderMouse->setCanReceiveDroppedFiles(false); | 226 m_fileInputElementUnderMouse->setCanReceiveDroppedFiles(false); |
| 227 m_fileInputElementUnderMouse = nullptr; | 227 m_fileInputElementUnderMouse = nullptr; |
| 228 } | 228 } |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 324 return toElement(n); | 324 return toElement(n); |
| 325 } | 325 } |
| 326 | 326 |
| 327 bool DragController::tryDocumentDrag(DragData* dragData, DragDestinationAction a
ctionMask, DragSession& dragSession) | 327 bool DragController::tryDocumentDrag(DragData* dragData, DragDestinationAction a
ctionMask, DragSession& dragSession) |
| 328 { | 328 { |
| 329 ASSERT(dragData); | 329 ASSERT(dragData); |
| 330 | 330 |
| 331 if (!m_documentUnderMouse) | 331 if (!m_documentUnderMouse) |
| 332 return false; | 332 return false; |
| 333 | 333 |
| 334 if (m_dragInitiator && !m_documentUnderMouse->securityOrigin()->canAccess(m_
dragInitiator->securityOrigin())) | 334 if (m_dragInitiator && !m_documentUnderMouse->getSecurityOrigin()->canAccess
(m_dragInitiator->getSecurityOrigin())) |
| 335 return false; | 335 return false; |
| 336 | 336 |
| 337 bool isHandlingDrag = false; | 337 bool isHandlingDrag = false; |
| 338 if (actionMask & DragDestinationActionDHTML) { | 338 if (actionMask & DragDestinationActionDHTML) { |
| 339 isHandlingDrag = tryDHTMLDrag(dragData, dragSession.operation); | 339 isHandlingDrag = tryDHTMLDrag(dragData, dragSession.operation); |
| 340 // Do not continue if m_documentUnderMouse has been reset by tryDHTMLDra
g. | 340 // Do not continue if m_documentUnderMouse has been reset by tryDHTMLDra
g. |
| 341 // tryDHTMLDrag fires dragenter event. The event listener that listens | 341 // tryDHTMLDrag fires dragenter event. The event listener that listens |
| 342 // to this event may create a nested message loop (open a modal dialog), | 342 // to this event may create a nested message loop (open a modal dialog), |
| 343 // which could process dragleave event and reset m_documentUnderMouse in | 343 // which could process dragleave event and reset m_documentUnderMouse in |
| 344 // dragExited. | 344 // dragExited. |
| (...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 582 | 582 |
| 583 bool DragController::tryDHTMLDrag(DragData* dragData, DragOperation& operation) | 583 bool DragController::tryDHTMLDrag(DragData* dragData, DragOperation& operation) |
| 584 { | 584 { |
| 585 ASSERT(dragData); | 585 ASSERT(dragData); |
| 586 ASSERT(m_documentUnderMouse); | 586 ASSERT(m_documentUnderMouse); |
| 587 RefPtrWillBeRawPtr<LocalFrame> mainFrame = m_page->deprecatedLocalMainFrame(
); | 587 RefPtrWillBeRawPtr<LocalFrame> mainFrame = m_page->deprecatedLocalMainFrame(
); |
| 588 if (!mainFrame->view()) | 588 if (!mainFrame->view()) |
| 589 return false; | 589 return false; |
| 590 | 590 |
| 591 RefPtrWillBeRawPtr<FrameView> viewProtector(mainFrame->view()); | 591 RefPtrWillBeRawPtr<FrameView> viewProtector(mainFrame->view()); |
| 592 DataTransferAccessPolicy policy = m_documentUnderMouse->securityOrigin()->is
Local() ? DataTransferReadable : DataTransferTypesReadable; | 592 DataTransferAccessPolicy policy = m_documentUnderMouse->getSecurityOrigin()-
>isLocal() ? DataTransferReadable : DataTransferTypesReadable; |
| 593 DataTransfer* dataTransfer = createDraggingDataTransfer(policy, dragData); | 593 DataTransfer* dataTransfer = createDraggingDataTransfer(policy, dragData); |
| 594 DragOperation srcOpMask = dragData->draggingSourceOperationMask(); | 594 DragOperation srcOpMask = dragData->draggingSourceOperationMask(); |
| 595 dataTransfer->setSourceOperation(srcOpMask); | 595 dataTransfer->setSourceOperation(srcOpMask); |
| 596 | 596 |
| 597 PlatformMouseEvent event = createMouseEvent(dragData); | 597 PlatformMouseEvent event = createMouseEvent(dragData); |
| 598 if (mainFrame->eventHandler().updateDragAndDrop(event, dataTransfer) == WebI
nputEventResult::NotHandled) { | 598 if (mainFrame->eventHandler().updateDragAndDrop(event, dataTransfer) == WebI
nputEventResult::NotHandled) { |
| 599 dataTransfer->setAccessPolicy(DataTransferNumb); // invalidate clipboard
here for security | 599 dataTransfer->setAccessPolicy(DataTransferNumb); // invalidate clipboard
here for security |
| 600 return false; | 600 return false; |
| 601 } | 601 } |
| 602 | 602 |
| (...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 973 | 973 |
| 974 DEFINE_TRACE(DragController) | 974 DEFINE_TRACE(DragController) |
| 975 { | 975 { |
| 976 visitor->trace(m_page); | 976 visitor->trace(m_page); |
| 977 visitor->trace(m_documentUnderMouse); | 977 visitor->trace(m_documentUnderMouse); |
| 978 visitor->trace(m_dragInitiator); | 978 visitor->trace(m_dragInitiator); |
| 979 visitor->trace(m_fileInputElementUnderMouse); | 979 visitor->trace(m_fileInputElementUnderMouse); |
| 980 } | 980 } |
| 981 | 981 |
| 982 } // namespace blink | 982 } // namespace blink |
| OLD | NEW |