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

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

Issue 879333002: Support buttons attribute for drag event (blink side). (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 10 months 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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 case DragSourceActionNone: 104 case DragSourceActionNone:
105 return false; 105 return false;
106 } 106 }
107 // Make sure MSVC doesn't complain that not all control paths return a value . 107 // Make sure MSVC doesn't complain that not all control paths return a value .
108 return false; 108 return false;
109 } 109 }
110 #endif 110 #endif
111 111
112 static PlatformMouseEvent createMouseEvent(DragData* dragData) 112 static PlatformMouseEvent createMouseEvent(DragData* dragData)
113 { 113 {
114 int keyState = dragData->modifierKeyState();
115 bool shiftKey = static_cast<bool>(keyState & PlatformEvent::ShiftKey);
116 bool ctrlKey = static_cast<bool>(keyState & PlatformEvent::CtrlKey);
117 bool altKey = static_cast<bool>(keyState & PlatformEvent::AltKey);
118 bool metaKey = static_cast<bool>(keyState & PlatformEvent::MetaKey);
119
120 return PlatformMouseEvent(dragData->clientPosition(), dragData->globalPositi on(), 114 return PlatformMouseEvent(dragData->clientPosition(), dragData->globalPositi on(),
121 LeftButton, PlatformEvent::MouseMoved, 0, shiftKey, ctrlKey, altKey, 115 LeftButton, PlatformEvent::MouseMoved, 0,
122 metaKey, PlatformMouseEvent::RealOrIndistinguishable, currentTime()); 116 static_cast<PlatformEvent::Modifiers>(dragData->modifiers()),
117 PlatformMouseEvent::RealOrIndistinguishable, currentTime());
123 } 118 }
124 119
125 static PassRefPtrWillBeRawPtr<DataTransfer> createDraggingDataTransfer(DataTrans ferAccessPolicy policy, DragData* dragData) 120 static PassRefPtrWillBeRawPtr<DataTransfer> createDraggingDataTransfer(DataTrans ferAccessPolicy policy, DragData* dragData)
126 { 121 {
127 return DataTransfer::create(DataTransfer::DragAndDrop, policy, dragData->pla tformData()); 122 return DataTransfer::create(DataTransfer::DragAndDrop, policy, dragData->pla tformData());
128 } 123 }
129 124
130 DragController::DragController(Page* page, DragClient* client) 125 DragController::DragController(Page* page, DragClient* client)
131 : m_page(page) 126 : m_page(page)
132 , m_client(client) 127 , m_client(client)
(...skipping 831 matching lines...) Expand 10 before | Expand all | Expand 10 after
964 // FIXME: To match the MacOS behaviour we should return DragOperationNone 959 // FIXME: To match the MacOS behaviour we should return DragOperationNone
965 // if we are a modal window, we are the drag source, or the window is an 960 // if we are a modal window, we are the drag source, or the window is an
966 // attached sheet If this can be determined from within WebCore 961 // attached sheet If this can be determined from within WebCore
967 // operationForDrag can be pulled into WebCore itself 962 // operationForDrag can be pulled into WebCore itself
968 ASSERT(dragData); 963 ASSERT(dragData);
969 return dragData->containsURL() && !m_didInitiateDrag ? DragOperationCopy : D ragOperationNone; 964 return dragData->containsURL() && !m_didInitiateDrag ? DragOperationCopy : D ragOperationNone;
970 } 965 }
971 966
972 bool DragController::isCopyKeyDown(DragData* dragData) 967 bool DragController::isCopyKeyDown(DragData* dragData)
973 { 968 {
974 int keyState = dragData->modifierKeyState(); 969 int modifiers = dragData->modifiers();
975 970
976 #if OS(MACOSX) 971 #if OS(MACOSX)
977 return keyState & PlatformEvent::AltKey; 972 return modifiers & PlatformEvent::AltKey;
978 #else 973 #else
979 return keyState & PlatformEvent::CtrlKey; 974 return modifiers & PlatformEvent::CtrlKey;
980 #endif 975 #endif
981 } 976 }
982 977
983 void DragController::cleanupAfterSystemDrag() 978 void DragController::cleanupAfterSystemDrag()
984 { 979 {
985 } 980 }
986 981
987 void DragController::trace(Visitor* visitor) 982 void DragController::trace(Visitor* visitor)
988 { 983 {
989 visitor->trace(m_page); 984 visitor->trace(m_page);
990 visitor->trace(m_documentUnderMouse); 985 visitor->trace(m_documentUnderMouse);
991 visitor->trace(m_dragInitiator); 986 visitor->trace(m_dragInitiator);
992 visitor->trace(m_fileInputElementUnderMouse); 987 visitor->trace(m_fileInputElementUnderMouse);
993 } 988 }
994 989
995 } // namespace blink 990 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698