Changeset 53296 in webkit
- Timestamp:
- Jan 14, 2010 4:06:18 PM (14 years ago)
- Location:
- trunk
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r53295 r53296 1 2010-01-14 Brian Weinstein <bweinstein@apple.com> 2 3 Reviewed by Adam Roben. 4 5 Drag and Drop source/destination code needs cleanup. 6 <https://bugs.webkit.org/show_bug.cgi?id=33691>. 7 8 Cleaned up some Drag and Drop code that deals with getting 9 source and destination operations, and added some ASSERTS to make 10 sure we don't get in bad states. 11 12 * dom/Clipboard.cpp: 13 (WebCore::Clipboard::sourceOperation): Make this return the operation itself. 14 (WebCore::Clipboard::destinationOperation): Ditto. 15 (WebCore::Clipboard::setSourceOperation): Add an assert to make sure we're valud. 16 (WebCore::Clipboard::setDestinationOperation): Ditto. 17 * dom/Clipboard.h: 18 * page/DragController.cpp: 19 (WebCore::DragController::tryDHTMLDrag): 20 * page/EventHandler.cpp: 21 (WebCore::EventHandler::handleDrag): 22 1 23 2010-01-14 Timothy Hatcher <timothy@apple.com> 2 24 -
trunk/WebCore/dom/Clipboard.cpp
r53288 r53296 101 101 } 102 102 103 bool Clipboard::sourceOperation(DragOperation& op) const103 DragOperation Clipboard::sourceOperation() const 104 104 { 105 op = dragOpFromIEOp(m_effectAllowed);105 DragOperation op = dragOpFromIEOp(m_effectAllowed); 106 106 ASSERT(op != DragOperationPrivate); 107 return true;107 return op; 108 108 } 109 109 110 bool Clipboard::destinationOperation(DragOperation& op) const110 DragOperation Clipboard::destinationOperation() const 111 111 { 112 op = dragOpFromIEOp(m_dropEffect);113 ASSERT (op == DragOperationCopy || op == DragOperationNone || op == DragOperationLink || op == DragOperationMove);114 return true;112 DragOperation op = dragOpFromIEOp(m_dropEffect); 113 ASSERT_ARG(op, op == DragOperationCopy || op == DragOperationNone || op == DragOperationLink || op == DragOperationGeneric); 114 return op; 115 115 } 116 116 117 117 void Clipboard::setSourceOperation(DragOperation op) 118 118 { 119 ASSERT_ARG(op, op != DragOperationPrivate); 119 120 m_effectAllowed = IEOpFromDragOp(op); 120 121 } … … 122 123 void Clipboard::setDestinationOperation(DragOperation op) 123 124 { 125 ASSERT(op == DragOperationCopy || op == DragOperationNone || op == DragOperationLink || op == DragOperationMove); 124 126 m_dropEffect = IEOpFromDragOp(op); 125 127 } -
trunk/WebCore/dom/Clipboard.h
r48426 r53296 75 75 void setAccessPolicy(ClipboardAccessPolicy); 76 76 77 bool sourceOperation(DragOperation&) const;78 bool destinationOperation(DragOperation&) const;77 DragOperation sourceOperation() const; 78 DragOperation destinationOperation() const; 79 79 void setSourceOperation(DragOperation); 80 80 void setDestinationOperation(DragOperation); -
trunk/WebCore/page/DragController.cpp
r49292 r53296 483 483 } 484 484 485 static DragOperation defaultOperationForDrag(DragOperation srcOpMask)486 {487 // This is designed to match IE's operation fallback for the case where488 // the page calls preventDefault() in a drag event but doesn't set dropEffect.489 if (srcOpMask & DragOperationCopy)490 return DragOperationCopy;491 if (srcOpMask & DragOperationMove || srcOpMask & DragOperationGeneric)492 return DragOperationMove;493 if (srcOpMask & DragOperationLink)494 return DragOperationLink;495 496 // FIXME: Does IE really return "generic" even if no operations were allowed by the source?497 return DragOperationGeneric;498 }499 500 485 bool DragController::tryDHTMLDrag(DragData* dragData, DragOperation& operation) 501 486 { … … 518 503 } 519 504 520 if (!clipboard->destinationOperation(operation)) { 521 // The element accepted but they didn't pick an operation, so we pick one (to match IE). 522 operation = defaultOperationForDrag(srcOpMask); 523 } else if (!(srcOpMask & operation)) { 505 operation = clipboard->destinationOperation(); 506 if (!(srcOpMask & operation)) { 524 507 // The element picked an operation which is not supported by the source 525 508 operation = DragOperationNone; -
trunk/WebCore/page/EventHandler.cpp
r53069 r53296 2334 2334 if (m_mouseDownMayStartDrag) { 2335 2335 // gather values from DHTML element, if it set any 2336 dragState().m_dragClipboard->sourceOperation(srcOp);2336 srcOp = dragState().m_dragClipboard->sourceOperation(); 2337 2337 2338 2338 // Yuck, a draggedImage:moveTo: message can be fired as a result of kicking off the -
trunk/WebKit/chromium/ChangeLog
r53290 r53296 1 2010-01-14 Brian Weinstein <bweinstein@apple.com> 2 3 Reviewed by Adam Roben. 4 5 Drag and Drop source/destination code needs cleanup. 6 <https://bugs.webkit.org/show_bug.cgi?id=33691>. 7 8 Update to new way of calling sourceOperation. 9 10 * src/DragClientImpl.cpp: 11 (WebKit::DragClientImpl::startDrag): 12 1 13 2010-01-14 Nate Chapin <japhet@chromium.org> 2 14 -
trunk/WebKit/chromium/src/DragClientImpl.cpp
r50742 r53296 80 80 WebDragData dragData = static_cast<ClipboardChromium*>(clipboard)->dataObject(); 81 81 82 DragOperation dragOperationMask; 83 if (!clipboard->sourceOperation(dragOperationMask)) 84 dragOperationMask = DragOperationEvery; 82 DragOperation dragOperationMask = clipboard->sourceOperation(); 85 83 86 84 m_webView->startDragging( -
trunk/WebKit/qt/ChangeLog
r53267 r53296 1 2010-01-14 Brian Weinstein <bweinstein@apple.com> 2 3 Reviewed by Adam Roben. 4 5 Drag and Drop source/destination code needs cleanup. 6 <https://bugs.webkit.org/show_bug.cgi?id=33691>. 7 8 Update to new way of calling sourceOperation. 9 10 * WebCoreSupport/DragClientQt.cpp: 11 (WebCore::DragClientQt::startDrag): 12 1 13 2010-01-14 Simon Hausmann <simon.hausmann@nokia.com> 2 14 -
trunk/WebKit/qt/WebCoreSupport/DragClientQt.cpp
r52815 r53296 97 97 if (clipboardData && clipboardData->hasImage()) 98 98 drag->setPixmap(qvariant_cast<QPixmap>(clipboardData->imageData())); 99 DragOperation dragOperationMask = DragOperationEvery; 100 clipboard->sourceOperation(dragOperationMask); 99 DragOperation dragOperationMask = clipboard->sourceOperation(); 101 100 drag->setMimeData(clipboardData); 102 101 Qt::DropAction actualDropAction = drag->exec(dragOperationsToDropActions(dragOperationMask));
Note: See TracChangeset
for help on using the changeset viewer.