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

Side by Side Diff: Source/web/WebInputEventConversion.cpp

Issue 727593003: Implement MouseEvent buttons attribute. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: addressed comments Created 6 years 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) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2009 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * 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 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 97
98 m_modifiers = 0; 98 m_modifiers = 0;
99 if (e.modifiers & WebInputEvent::ShiftKey) 99 if (e.modifiers & WebInputEvent::ShiftKey)
100 m_modifiers |= PlatformEvent::ShiftKey; 100 m_modifiers |= PlatformEvent::ShiftKey;
101 if (e.modifiers & WebInputEvent::ControlKey) 101 if (e.modifiers & WebInputEvent::ControlKey)
102 m_modifiers |= PlatformEvent::CtrlKey; 102 m_modifiers |= PlatformEvent::CtrlKey;
103 if (e.modifiers & WebInputEvent::AltKey) 103 if (e.modifiers & WebInputEvent::AltKey)
104 m_modifiers |= PlatformEvent::AltKey; 104 m_modifiers |= PlatformEvent::AltKey;
105 if (e.modifiers & WebInputEvent::MetaKey) 105 if (e.modifiers & WebInputEvent::MetaKey)
106 m_modifiers |= PlatformEvent::MetaKey; 106 m_modifiers |= PlatformEvent::MetaKey;
107 if (e.modifiers & WebInputEvent::LeftButtonDown)
108 m_modifiers |= PlatformEvent::LeftButtonDown;
109 if (e.modifiers & WebInputEvent::MiddleButtonDown)
110 m_modifiers |= PlatformEvent::MiddleButtonDown;
111 if (e.modifiers & WebInputEvent::RightButtonDown)
112 m_modifiers |= PlatformEvent::RightButtonDown;
107 113
108 m_modifierFlags = e.modifiers; 114 m_modifierFlags = e.modifiers;
109 m_timestamp = e.timeStampSeconds; 115 m_timestamp = e.timeStampSeconds;
110 m_clickCount = e.clickCount; 116 m_clickCount = e.clickCount;
111 117
112 switch (e.type) { 118 switch (e.type) {
113 case WebInputEvent::MouseMove: 119 case WebInputEvent::MouseMove:
114 case WebInputEvent::MouseLeave: // synthesize a move event 120 case WebInputEvent::MouseLeave: // synthesize a move event
115 m_type = PlatformEvent::MouseMoved; 121 m_type = PlatformEvent::MouseMoved;
116 break; 122 break;
(...skipping 28 matching lines...) Expand all
145 151
146 m_modifiers = 0; 152 m_modifiers = 0;
147 if (e.modifiers & WebInputEvent::ShiftKey) 153 if (e.modifiers & WebInputEvent::ShiftKey)
148 m_modifiers |= PlatformEvent::ShiftKey; 154 m_modifiers |= PlatformEvent::ShiftKey;
149 if (e.modifiers & WebInputEvent::ControlKey) 155 if (e.modifiers & WebInputEvent::ControlKey)
150 m_modifiers |= PlatformEvent::CtrlKey; 156 m_modifiers |= PlatformEvent::CtrlKey;
151 if (e.modifiers & WebInputEvent::AltKey) 157 if (e.modifiers & WebInputEvent::AltKey)
152 m_modifiers |= PlatformEvent::AltKey; 158 m_modifiers |= PlatformEvent::AltKey;
153 if (e.modifiers & WebInputEvent::MetaKey) 159 if (e.modifiers & WebInputEvent::MetaKey)
154 m_modifiers |= PlatformEvent::MetaKey; 160 m_modifiers |= PlatformEvent::MetaKey;
161 if (e.modifiers & WebInputEvent::LeftButtonDown)
162 m_modifiers |= PlatformEvent::LeftButtonDown;
163 if (e.modifiers & WebInputEvent::MiddleButtonDown)
164 m_modifiers |= PlatformEvent::MiddleButtonDown;
165 if (e.modifiers & WebInputEvent::RightButtonDown)
166 m_modifiers |= PlatformEvent::RightButtonDown;
155 167
156 m_hasPreciseScrollingDeltas = e.hasPreciseScrollingDeltas; 168 m_hasPreciseScrollingDeltas = e.hasPreciseScrollingDeltas;
157 #if OS(MACOSX) 169 #if OS(MACOSX)
158 m_phase = static_cast<PlatformWheelEventPhase>(e.phase); 170 m_phase = static_cast<PlatformWheelEventPhase>(e.phase);
159 m_momentumPhase = static_cast<PlatformWheelEventPhase>(e.momentumPhase); 171 m_momentumPhase = static_cast<PlatformWheelEventPhase>(e.momentumPhase);
160 m_timestamp = e.timeStampSeconds; 172 m_timestamp = e.timeStampSeconds;
161 m_canRubberbandLeft = e.canRubberbandLeft; 173 m_canRubberbandLeft = e.canRubberbandLeft;
162 m_canRubberbandRight = e.canRubberbandRight; 174 m_canRubberbandRight = e.canRubberbandRight;
163 #endif 175 #endif
164 } 176 }
(...skipping 649 matching lines...) Expand 10 before | Expand all | Expand 10 after
814 modifiers = getWebInputModifiers(event); 826 modifiers = getWebInputModifiers(event);
815 827
816 globalX = event.screenX(); 828 globalX = event.screenX();
817 globalY = event.screenY(); 829 globalY = event.screenY();
818 IntPoint localPoint = convertAbsoluteLocationForRenderObject(event.absoluteL ocation(), *renderObject); 830 IntPoint localPoint = convertAbsoluteLocationForRenderObject(event.absoluteL ocation(), *renderObject);
819 x = localPoint.x(); 831 x = localPoint.x();
820 y = localPoint.y(); 832 y = localPoint.y();
821 } 833 }
822 834
823 } // namespace blink 835 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698