Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(133)

Side by Side Diff: third_party/WebKit/Source/core/page/DragController.cpp

Issue 1463823003: Return a enumeration of the state of handling of InputEvents. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 { 236 {
237 ASSERT(dragData); 237 ASSERT(dragData);
238 m_documentUnderMouse = m_page->deprecatedLocalMainFrame()->documentAtPoint(d ragData->clientPosition()); 238 m_documentUnderMouse = m_page->deprecatedLocalMainFrame()->documentAtPoint(d ragData->clientPosition());
239 if ((m_dragDestinationAction & DragDestinationActionDHTML) && m_documentIsHa ndlingDrag) { 239 if ((m_dragDestinationAction & DragDestinationActionDHTML) && m_documentIsHa ndlingDrag) {
240 RefPtrWillBeRawPtr<LocalFrame> mainFrame = m_page->deprecatedLocalMainFr ame(); 240 RefPtrWillBeRawPtr<LocalFrame> mainFrame = m_page->deprecatedLocalMainFr ame();
241 bool preventedDefault = false; 241 bool preventedDefault = false;
242 if (mainFrame->view()) { 242 if (mainFrame->view()) {
243 // Sending an event can result in the destruction of the view and pa rt. 243 // Sending an event can result in the destruction of the view and pa rt.
244 DataTransfer* dataTransfer = createDraggingDataTransfer(DataTransfer Readable, dragData); 244 DataTransfer* dataTransfer = createDraggingDataTransfer(DataTransfer Readable, dragData);
245 dataTransfer->setSourceOperation(dragData->draggingSourceOperationMa sk()); 245 dataTransfer->setSourceOperation(dragData->draggingSourceOperationMa sk());
246 preventedDefault = mainFrame->eventHandler().performDragAndDrop(crea teMouseEvent(dragData), dataTransfer); 246 preventedDefault = mainFrame->eventHandler().performDragAndDrop(crea teMouseEvent(dragData), dataTransfer) != WebInputEventResult::NotHandled;
247 dataTransfer->setAccessPolicy(DataTransferNumb); // Invalidate clipb oard here for security 247 dataTransfer->setAccessPolicy(DataTransferNumb); // Invalidate clipb oard here for security
248 } 248 }
249 if (preventedDefault) { 249 if (preventedDefault) {
250 m_documentUnderMouse = nullptr; 250 m_documentUnderMouse = nullptr;
251 cancelDrag(); 251 cancelDrag();
252 return true; 252 return true;
253 } 253 }
254 } 254 }
255 255
256 if ((m_dragDestinationAction & DragDestinationActionEdit) && concludeEditDra g(dragData)) { 256 if ((m_dragDestinationAction & DragDestinationActionEdit) && concludeEditDra g(dragData)) {
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after
595 if (!mainFrame->view()) 595 if (!mainFrame->view())
596 return false; 596 return false;
597 597
598 RefPtrWillBeRawPtr<FrameView> viewProtector(mainFrame->view()); 598 RefPtrWillBeRawPtr<FrameView> viewProtector(mainFrame->view());
599 DataTransferAccessPolicy policy = m_documentUnderMouse->securityOrigin()->is Local() ? DataTransferReadable : DataTransferTypesReadable; 599 DataTransferAccessPolicy policy = m_documentUnderMouse->securityOrigin()->is Local() ? DataTransferReadable : DataTransferTypesReadable;
600 DataTransfer* dataTransfer = createDraggingDataTransfer(policy, dragData); 600 DataTransfer* dataTransfer = createDraggingDataTransfer(policy, dragData);
601 DragOperation srcOpMask = dragData->draggingSourceOperationMask(); 601 DragOperation srcOpMask = dragData->draggingSourceOperationMask();
602 dataTransfer->setSourceOperation(srcOpMask); 602 dataTransfer->setSourceOperation(srcOpMask);
603 603
604 PlatformMouseEvent event = createMouseEvent(dragData); 604 PlatformMouseEvent event = createMouseEvent(dragData);
605 if (!mainFrame->eventHandler().updateDragAndDrop(event, dataTransfer)) { 605 if (mainFrame->eventHandler().updateDragAndDrop(event, dataTransfer) == WebI nputEventResult::NotHandled) {
606 dataTransfer->setAccessPolicy(DataTransferNumb); // invalidate clipboard here for security 606 dataTransfer->setAccessPolicy(DataTransferNumb); // invalidate clipboard here for security
607 return false; 607 return false;
608 } 608 }
609 609
610 operation = dataTransfer->destinationOperation(); 610 operation = dataTransfer->destinationOperation();
611 if (dataTransfer->dropEffectIsUninitialized()) { 611 if (dataTransfer->dropEffectIsUninitialized()) {
612 operation = defaultOperationForDrag(srcOpMask); 612 operation = defaultOperationForDrag(srcOpMask);
613 } else if (!(srcOpMask & operation)) { 613 } else if (!(srcOpMask & operation)) {
614 // The element picked an operation which is not supported by the source 614 // The element picked an operation which is not supported by the source
615 operation = DragOperationNone; 615 operation = DragOperationNone;
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after
961 961
962 DEFINE_TRACE(DragController) 962 DEFINE_TRACE(DragController)
963 { 963 {
964 visitor->trace(m_page); 964 visitor->trace(m_page);
965 visitor->trace(m_documentUnderMouse); 965 visitor->trace(m_documentUnderMouse);
966 visitor->trace(m_dragInitiator); 966 visitor->trace(m_dragInitiator);
967 visitor->trace(m_fileInputElementUnderMouse); 967 visitor->trace(m_fileInputElementUnderMouse);
968 } 968 }
969 969
970 } // namespace blink 970 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698