Changeset 48229 in webkit
- Timestamp:
- Sep 9, 2009 3:19:22 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r48228 r48229 1 2009-09-09 Jens Alfke <snej@chromium.org> 2 3 Reviewed by Eric Seidel. 4 5 Initialize DataTransfer's effectAllowed and dropEffect properties correctly 6 according to HTML5 spec (sec. 7.9.2-7.9.3). 7 https://bugs.webkit.org/show_bug.cgi?id=26700 8 9 * fast/events/drag-dropeffect-expected.txt: Added. 10 * fast/events/drag-dropeffect.html: Added. 11 1 12 2009-09-09 Zan Dobersek <zandobersek@gmail.com> 2 13 -
trunk/WebCore/ChangeLog
r48227 r48229 1 2009-09-09 Jens Alfke <snej@chromium.org> 2 3 Reviewed by Eric Seidel. 4 5 Initialize DataTransfer's effectAllowed and dropEffect properties correctly 6 according to HTML5 spec (sec. 7.9.2-7.9.3). 7 https://bugs.webkit.org/show_bug.cgi?id=26700 8 - At the start of a drag operation, the value of effectAllowed should be 9 the string "uninitialized". 10 - At end of dragstart handler, if effectAllowed hasn't been set yet, it 11 should be set to "copy". 12 - on dragenter and dragover event, dropEffect should be initialized to a 13 default value based on the value of effectAllowed. 14 - at end of dragenter and dragover the dropEffect should be set to "none" 15 if the value set by the handler doesn't match the effectAllowed. 16 - on dragleave event, dropEffect should be "none". 17 - on drop event, dropEffect should be the previously negotiated value. 18 19 Test: fast/events/drag-dropeffect.html 20 21 * WebCore.base.exp: 22 Added a parameter to EventHandler::dragSourceMovedTo. 23 * dom/Clipboard.cpp: 24 (WebCore::Clipboard::Clipboard): 25 Initialize m_effectAllowed to "uninitialized". 26 (WebCore::Clipboard::sourceOperation): 27 Treat "uninitialized" as meaning no value has been set. 28 * page/DragController.cpp: 29 (WebCore::DragController::DragController): 30 Initialize new member m_destinationDragOperation. 31 (WebCore::DragController::dragExited): 32 Set m_destinationDragOperation to none on dragExit. 33 (WebCore::DragController::performDrag): 34 Set m_destinationDragOperation to current dropEffect. 35 (WebCore::DragController::dragEnteredOrUpdated): 36 Make sure to clear the operation if drag source doesn't allow it. 37 (WebCore::DragController::tryDHTMLDrag): 38 Set a default value for the dst drag op before sending dragEnter/Over. 39 (WebCore::DragController::startDrag): 40 Clear m_destinationDragOperation at start of drag. 41 * page/DragController.h: 42 (WebCore::DragController::destinationDragOperation): 43 Added new member m_destinationDragOperation, and its public getter. 44 * page/EventHandler.cpp: 45 (WebCore::EventHandler::updateDragAndDrop): 46 dropEffect should be 'none' during dropleave handler, per spec. 47 (WebCore::EventHandler::dragSourceMovedTo): 48 Added DragOperation parameter, so the handler sees the current dropEffect. 49 (WebCore::EventHandler::handleDrag): 50 Assume DragOperationEvery for non-DHTML drags. 51 * page/EventHandler.h: 52 Added DragOperation parameter to dragSourceMovedTo(). 53 1 54 2009-09-09 Dumitru Daniliuc <dumi@chromium.org> 2 55 -
trunk/WebCore/WebCore.base.exp
r48222 r48229 225 225 __ZN7WebCore12EventHandler15sendScrollEventEv 226 226 __ZN7WebCore12EventHandler17dragSourceEndedAtERKNS_18PlatformMouseEventENS_13DragOperationE 227 __ZN7WebCore12EventHandler17dragSourceMovedToERKNS_18PlatformMouseEventE 227 __ZN7WebCore12EventHandler17dragSourceMovedToERKNS_18PlatformMouseEventENS_13DragOperationE 228 228 __ZN7WebCore12EventHandler17eventMayStartDragEP7NSEvent 229 229 __ZN7WebCore12EventHandler20handleTextInputEventERKNS_6StringEPNS_5EventEbb -
trunk/WebCore/dom/Clipboard.cpp
r41525 r48229 41 41 , m_dragImage(0) 42 42 { 43 if (isForDragging) { 44 // per HTML5 spec, sec. 7.9.2 45 m_effectAllowed = "uninitialized"; 46 } 43 47 } 44 48 … … 99 103 bool Clipboard::sourceOperation(DragOperation& op) const 100 104 { 101 if (m_effectAllowed.isNull() )105 if (m_effectAllowed.isNull() || m_effectAllowed == "uninitialized") 102 106 return false; 103 107 op = dragOpFromIEOp(m_effectAllowed); -
trunk/WebCore/page/DragController.cpp
r47688 r48229 84 84 , m_isHandlingDrag(false) 85 85 , m_sourceDragOperation(DragOperationNone) 86 , m_destinationDragOperation(DragOperationNone) 86 87 { 87 88 } … … 159 160 RefPtr<Clipboard> clipboard = dragData->createClipboard(policy); 160 161 clipboard->setSourceOperation(dragData->draggingSourceOperationMask()); 162 clipboard->setDestinationOperation(DragOperationNone); // HTML5 spec, sec. 7.9.3 161 163 mainFrame->eventHandler()->cancelDragAndDrop(createMouseEvent(dragData), clipboard.get()); 162 164 clipboard->setAccessPolicy(ClipboardNumb); // invalidate clipboard here for security … … 182 184 RefPtr<Clipboard> clipboard = dragData->createClipboard(ClipboardReadable); 183 185 clipboard->setSourceOperation(dragData->draggingSourceOperationMask()); 186 clipboard->setDestinationOperation(m_destinationDragOperation); // HTML5 spec, sec. 7.9.3 184 187 mainFrame->eventHandler()->performDragAndDrop(createMouseEvent(dragData), clipboard.get()); 185 188 clipboard->setAccessPolicy(ClipboardNumb); // invalidate clipboard here for security … … 230 233 bool handledByDocument = tryDocumentDrag(dragData, m_dragDestinationAction, operation); 231 234 if (!handledByDocument && (m_dragDestinationAction & DragDestinationActionLoad)) 232 return operationForLoad(dragData); 235 operation = operationForLoad(dragData); 236 237 // Restrict the operation to what the drag source allows: 238 if ((operation & dragData->draggingSourceOperationMask()) != operation) 239 operation = DragOperationNone; 240 m_destinationDragOperation = operation; 233 241 return operation; 234 242 } … … 492 500 DragOperation srcOpMask = dragData->draggingSourceOperationMask(); 493 501 clipboard->setSourceOperation(srcOpMask); 502 m_destinationDragOperation = defaultOperationForDrag(srcOpMask); // HTML5 spec, sec. 7.9.3 503 clipboard->setDestinationOperation(m_destinationDragOperation); 494 504 495 505 PlatformMouseEvent event = createMouseEvent(dragData); … … 624 634 m_draggingImageURL = KURL(); 625 635 m_sourceDragOperation = srcOp; 636 m_destinationDragOperation = DragOperationNone; 626 637 627 638 DragImageRef dragImage = 0; -
trunk/WebCore/page/DragController.h
r45064 r48229 66 66 bool isHandlingDrag() const { return m_isHandlingDrag; } 67 67 DragOperation sourceDragOperation() const { return m_sourceDragOperation; } 68 DragOperation destinationDragOperation() const { return m_destinationDragOperation; } 68 69 void setDraggingImageURL(const KURL& url) { m_draggingImageURL = url; } 69 70 const KURL& draggingImageURL() const { return m_draggingImageURL; } … … 123 124 bool m_isHandlingDrag; 124 125 DragOperation m_sourceDragOperation; // Set in startDrag when a drag starts from a mouse down within WebKit 126 DragOperation m_destinationDragOperation; // Last operation set by event handler 125 127 IntPoint m_dragOffset; 126 128 KURL m_draggingImageURL; -
trunk/WebCore/page/EventHandler.cpp
r48106 r48229 1507 1507 if (frame) 1508 1508 accept = frame->eventHandler()->updateDragAndDrop(event, clipboard); 1509 else 1509 else { 1510 // Temporarily set dropEffect to 'none' while calling dropleave handler (as per HTML5 spec) 1511 DragOperation saveOp = DragOperationNone; 1512 clipboard->destinationOperation(saveOp); 1513 clipboard->setDestinationOperation(DragOperationNone); 1510 1514 dispatchDragEvent(eventNames().dragleaveEvent, m_dragTarget.get(), event, clipboard); 1515 clipboard->setDestinationOperation(saveOp); 1516 } 1511 1517 } 1512 1518 } else { … … 2132 2138 } 2133 2139 2134 void EventHandler::dragSourceMovedTo(const PlatformMouseEvent& event) 2135 { 2136 if (dragState().m_dragSrc && dragState().m_dragSrcMayBeDHTML) 2140 void EventHandler::dragSourceMovedTo(const PlatformMouseEvent& event, DragOperation operation) 2141 { 2142 if (dragState().m_dragSrc && dragState().m_dragSrcMayBeDHTML) { 2143 dragState().m_dragClipboard->setDestinationOperation(operation); 2137 2144 // for now we don't care if event handler cancels default behavior, since there is none 2138 2145 dispatchDragSrcEvent(eventNames().dragEvent, event); 2146 } 2139 2147 } 2140 2148 … … 2230 2238 invalidateClick(); 2231 2239 2232 DragOperation srcOp = DragOperation None;2240 DragOperation srcOp = DragOperationEvery; 2233 2241 2234 2242 freeClipboard(); // would only happen if we missed a dragEnd. Do it anyway, just … … 2253 2261 } 2254 2262 2263 dragState().m_dragClipboard->setDestinationOperation(DragOperationNone); // HTML5 spec 2255 2264 m_mouseDownMayStartDrag = dispatchDragSrcEvent(eventNames().dragstartEvent, m_mouseDown) 2256 2265 && !m_frame->selection()->isInPasswordField(); -
trunk/WebCore/page/EventHandler.h
r47594 r48229 147 147 bool eventMayStartDrag(const PlatformMouseEvent&) const; 148 148 149 void dragSourceMovedTo(const PlatformMouseEvent& );149 void dragSourceMovedTo(const PlatformMouseEvent&, DragOperation = DragOperationNone); 150 150 void dragSourceEndedAt(const PlatformMouseEvent&, DragOperation); 151 151 -
trunk/WebKit/mac/ChangeLog
r48222 r48229 1 2009-09-09 Jens Alfke <snej@chromium.org> 2 3 Reviewed by Eric Seidel. 4 5 Initialize DataTransfer's effectAllowed and dropEffect properties correctly 6 according to HTML5 spec (sec. 7.9.2-7.9.3). 7 https://bugs.webkit.org/show_bug.cgi?id=26700 8 9 * WebView/WebFrame.mm: 10 (-[WebFrame _dragSourceMovedTo:]): 11 Pass current drag operation (if known) to EventHandler::dragSourceMovedTo(). 12 1 13 2009-09-09 Dave Hyatt <hyatt@apple.com> 2 14 -
trunk/WebKit/mac/WebView/WebFrame.mm
r46647 r48229 60 60 #import <WebCore/DocLoader.h> 61 61 #import <WebCore/DocumentFragment.h> 62 #import <WebCore/DragController.h> 62 63 #import <WebCore/EventHandler.h> 63 64 #import <WebCore/EventNames.h> … … 933 934 PlatformMouseEvent event(IntPoint(windowLoc), globalPoint(windowLoc, [view->platformWidget() window]), 934 935 LeftButton, MouseEventMoved, 0, false, false, false, false, currentTime()); 935 _private->coreFrame->eventHandler()->dragSourceMovedTo(event); 936 937 // Get the current destination drag operation, if this is an intra-page drag: 938 DragOperation operation = DragOperationNone; 939 if (Page* page = _private->coreFrame->page()) 940 operation = page->dragController()->destinationDragOperation(); 941 942 _private->coreFrame->eventHandler()->dragSourceMovedTo(event, operation); 936 943 } 937 944
Note: See TracChangeset
for help on using the changeset viewer.