Changeset 55977 in webkit
- Timestamp:
- Mar 14, 2010 5:01:57 PM (14 years ago)
- Location:
- trunk
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r55950 r55977 1 2010-03-14 Oliver Hunt <oliver@apple.com> 2 3 Reviewed by Darin Adler. 4 5 REGRESSION(r53287): drop event is not fired if dataTransfer.dropEffect is not explicitly set 6 https://bugs.webkit.org/show_bug.cgi?id=36095 7 8 Correct this test to cover the somewhat bizarre "correct" handling 9 of undefined dropEffect 10 11 * fast/events/drag-and-drop-expected.txt: 12 * fast/events/drag-and-drop.html: 13 1 14 2010-03-12 Shu Chang <chang.shu@nokia.com> 2 15 -
trunk/LayoutTests/fast/events/drag-and-drop-expected.txt
r53287 r55977 12 12 PASS event.dataTransfer.dropEffect is "move" 13 13 PASS event.dataTransfer.dropEffect is "link" 14 PASS event.dataTransfer.dropEffect is " none"14 PASS event.dataTransfer.dropEffect is "copy" 15 15 16 16 When effectAllowed == "undefined" … … 25 25 PASS event.dataTransfer.dropEffect is "link" 26 26 PASS event.dataTransfer.effectAllowed is "uninitialized" 27 PASS event.dataTransfer.dropEffect is " none"27 PASS event.dataTransfer.dropEffect is "copy" 28 28 29 29 When effectAllowed == "none" … … 41 41 PASS event.dataTransfer.dropEffect is "move" 42 42 PASS event.dataTransfer.dropEffect is "link" 43 PASS event.dataTransfer.dropEffect is " none"43 PASS event.dataTransfer.dropEffect is "copy" 44 44 45 45 When effectAllowed == "copy" … … 49 49 PASS event.dataTransfer.dropEffect is "none" 50 50 PASS event.dataTransfer.dropEffect is "none" 51 PASS event.dataTransfer.dropEffect is " none"51 PASS event.dataTransfer.dropEffect is "copy" 52 52 53 53 When effectAllowed == "move" … … 57 57 PASS event.dataTransfer.dropEffect is "move" 58 58 PASS event.dataTransfer.dropEffect is "none" 59 PASS event.dataTransfer.dropEffect is " none"59 PASS event.dataTransfer.dropEffect is "move" 60 60 61 61 When effectAllowed == "link" … … 65 65 PASS event.dataTransfer.dropEffect is "none" 66 66 PASS event.dataTransfer.dropEffect is "link" 67 PASS event.dataTransfer.dropEffect is " none"67 PASS event.dataTransfer.dropEffect is "link" 68 68 69 69 When effectAllowed == "copyMove" … … 73 73 PASS event.dataTransfer.dropEffect is "move" 74 74 PASS event.dataTransfer.dropEffect is "none" 75 PASS event.dataTransfer.dropEffect is " none"75 PASS event.dataTransfer.dropEffect is "move" 76 76 77 77 When effectAllowed == "copyLink" … … 81 81 PASS event.dataTransfer.dropEffect is "none" 82 82 PASS event.dataTransfer.dropEffect is "link" 83 PASS event.dataTransfer.dropEffect is " none"83 PASS event.dataTransfer.dropEffect is "copy" 84 84 85 85 When effectAllowed == "linkMove" … … 89 89 PASS event.dataTransfer.dropEffect is "move" 90 90 PASS event.dataTransfer.dropEffect is "link" 91 PASS event.dataTransfer.dropEffect is " none"91 PASS event.dataTransfer.dropEffect is "move" 92 92 93 93 When effectAllowed == "dummy" … … 102 102 PASS event.dataTransfer.dropEffect is "link" 103 103 PASS event.dataTransfer.effectAllowed is "uninitialized" 104 PASS event.dataTransfer.dropEffect is " none"104 PASS event.dataTransfer.dropEffect is "copy" 105 105 106 106 TEST COMPLETE -
trunk/LayoutTests/fast/events/drag-and-drop.html
r53287 r55977 109 109 chosenEffectAllowed = "uninitialized"; 110 110 } 111 111 expected = dropEffectElem.options[dropEffectElem.selectedIndex].value; 112 if (chosenDropEffect == "dummy") { 113 switch (chosenEffectAllowed) { 114 case "undefined": 115 case "copyLink": 116 case "uninitialized": 117 case "all": 118 expected = "copy"; 119 break; 120 case "copyMove": 121 case "move": 122 case "linkMove": 123 expected = "move"; 124 break; 125 default: 126 expected = chosenEffectAllowed; 127 } 128 } 112 129 if (isDropEffectAllowed(chosenDropEffect, chosenEffectAllowed)) 113 shouldBeEqualToString('event.dataTransfer.dropEffect', dropEffectElem.options[dropEffectElem.selectedIndex].value);130 shouldBeEqualToString('event.dataTransfer.dropEffect', expected); 114 131 else 115 132 shouldBeEqualToString('event.dataTransfer.dropEffect', 'none'); … … 127 144 if (chosenDropEffect == "link" && ["link", "copyLink", "linkMove", "uninitialized", "all"].indexOf(allowedDropEffect) != -1) 128 145 return true; 146 if (chosenDropEffect == "dummy" && ["copy", "link", "move", "copyLink", "copyMove", "linkMove", "uninitialized", "all"].indexOf(allowedDropEffect) != -1) 147 return true; 129 148 return false; 130 149 } -
trunk/WebCore/ChangeLog
r55976 r55977 1 2010-03-14 Oliver Hunt <oliver@apple.com> 2 3 Reviewed by Darin Adler. 4 5 REGRESSION(r53287): drop event is not fired if dataTransfer.dropEffect is not explicitly set 6 https://bugs.webkit.org/show_bug.cgi?id=36095 7 8 The issue here is that while dropEffect is meant to be initialized 9 to "none", the behaviour of the drag is differs between dragEffect 10 not being set and dragEffect being explicitly set to "none" 11 12 This patch corrects this behaviour by making Clipboard distinguish 13 between the initial "none" value of dropEffect and an explicit "none". 14 This alone is insufficient for correct behaviour, we also need to 15 resurrect the removed defaultOperationForDrag function, but we now 16 use the function only when dragEffect is uninitialized. There are a 17 few tweaks to the behaviour of the defaultOperationForDrag as well 18 to ensure exactly the same set of outcomes for all cases that we 19 may hit it. 20 21 * dom/Clipboard.cpp: 22 (WebCore::Clipboard::Clipboard): 23 (WebCore::dragOpFromIEOp): 24 (WebCore::Clipboard::destinationOperation): 25 * dom/Clipboard.h: 26 (WebCore::Clipboard::dropEffect): 27 (WebCore::Clipboard::dropEffectIsUninitialized): 28 * page/DragController.cpp: 29 (WebCore::defaultOperationForDrag): 30 (WebCore::DragController::tryDHTMLDrag): 31 1 32 2010-03-14 Antti Koivisto <koivisto@iki.fi> 2 33 -
trunk/WebCore/dom/Clipboard.cpp
r53301 r55977 37 37 Clipboard::Clipboard(ClipboardAccessPolicy policy, bool isForDragging) 38 38 : m_policy(policy) 39 , m_dropEffect(" none")39 , m_dropEffect("uninitialized") 40 40 , m_effectAllowed("uninitialized") 41 41 , m_dragStarted(false) … … 111 111 { 112 112 DragOperation op = dragOpFromIEOp(m_dropEffect); 113 ASSERT(op == DragOperationCopy || op == DragOperationNone || op == DragOperationLink || op == DragOperationGeneric || op == DragOperationMove );113 ASSERT(op == DragOperationCopy || op == DragOperationNone || op == DragOperationLink || op == DragOperationGeneric || op == DragOperationMove || op == DragOperationEvery); 114 114 return op; 115 115 } -
trunk/WebCore/dom/Clipboard.h
r54368 r55977 44 44 bool isForDragging() const { return m_forDragging; } 45 45 46 String dropEffect() const { return m_dropEffect; }46 String dropEffect() const { return dropEffectIsUninitialized() ? "none" : m_dropEffect; } 47 47 void setDropEffect(const String&); 48 bool dropEffectIsUninitialized() const { return m_dropEffect == "uninitialized"; } 48 49 String effectAllowed() const { return m_effectAllowed; } 49 50 void setEffectAllowed(const String&); -
trunk/WebCore/page/DragController.cpp
r55974 r55977 486 486 } 487 487 488 static DragOperation defaultOperationForDrag(DragOperation srcOpMask) 489 { 490 // This is designed to match IE's operation fallback for the case where 491 // the page calls preventDefault() in a drag event but doesn't set dropEffect. 492 if (srcOpMask == DragOperationEvery) 493 return DragOperationCopy; 494 if (srcOpMask == DragOperationNone) 495 return DragOperationNone; 496 if (srcOpMask & DragOperationMove || srcOpMask & DragOperationGeneric) 497 return DragOperationMove; 498 if (srcOpMask & DragOperationCopy) 499 return DragOperationCopy; 500 if (srcOpMask & DragOperationLink) 501 return DragOperationLink; 502 503 // FIXME: Does IE really return "generic" even if no operations were allowed by the source? 504 return DragOperationGeneric; 505 } 506 488 507 bool DragController::tryDHTMLDrag(DragData* dragData, DragOperation& operation) 489 508 { … … 507 526 508 527 operation = clipboard->destinationOperation(); 509 if (!(srcOpMask & operation)) { 528 if (clipboard->dropEffectIsUninitialized()) 529 operation = defaultOperationForDrag(srcOpMask); 530 else if (!(srcOpMask & operation)) { 510 531 // The element picked an operation which is not supported by the source 511 532 operation = DragOperationNone;
Note: See TracChangeset
for help on using the changeset viewer.