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

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: rebase Created 5 years, 9 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
« no previous file with comments | « Source/core/clipboard/DataObject.cpp ('k') | Source/core/page/DragData.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 815 matching lines...) Expand 10 before | Expand all | Expand 10 after
948 // FIXME: To match the MacOS behaviour we should return DragOperationNone 943 // FIXME: To match the MacOS behaviour we should return DragOperationNone
949 // if we are a modal window, we are the drag source, or the window is an 944 // if we are a modal window, we are the drag source, or the window is an
950 // attached sheet If this can be determined from within WebCore 945 // attached sheet If this can be determined from within WebCore
951 // operationForDrag can be pulled into WebCore itself 946 // operationForDrag can be pulled into WebCore itself
952 ASSERT(dragData); 947 ASSERT(dragData);
953 return dragData->containsURL() && !m_didInitiateDrag ? DragOperationCopy : D ragOperationNone; 948 return dragData->containsURL() && !m_didInitiateDrag ? DragOperationCopy : D ragOperationNone;
954 } 949 }
955 950
956 bool DragController::isCopyKeyDown(DragData* dragData) 951 bool DragController::isCopyKeyDown(DragData* dragData)
957 { 952 {
958 int keyState = dragData->modifierKeyState(); 953 int modifiers = dragData->modifiers();
959 954
960 #if OS(MACOSX) 955 #if OS(MACOSX)
961 return keyState & PlatformEvent::AltKey; 956 return modifiers & PlatformEvent::AltKey;
962 #else 957 #else
963 return keyState & PlatformEvent::CtrlKey; 958 return modifiers & PlatformEvent::CtrlKey;
964 #endif 959 #endif
965 } 960 }
966 961
967 void DragController::cleanupAfterSystemDrag() 962 void DragController::cleanupAfterSystemDrag()
968 { 963 {
969 } 964 }
970 965
971 DEFINE_TRACE(DragController) 966 DEFINE_TRACE(DragController)
972 { 967 {
973 visitor->trace(m_page); 968 visitor->trace(m_page);
974 visitor->trace(m_documentUnderMouse); 969 visitor->trace(m_documentUnderMouse);
975 visitor->trace(m_dragInitiator); 970 visitor->trace(m_dragInitiator);
976 visitor->trace(m_fileInputElementUnderMouse); 971 visitor->trace(m_fileInputElementUnderMouse);
977 } 972 }
978 973
979 } // namespace blink 974 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/clipboard/DataObject.cpp ('k') | Source/core/page/DragData.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698