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

Side by Side Diff: webkit/plugins/ppapi/event_conversion.cc

Issue 7715021: Add movement information to PPB_MouseInputEvent. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 9 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « ppapi/thunk/thunk.h ('k') | webkit/plugins/ppapi/plugin_module.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "webkit/plugins/ppapi/event_conversion.h" 5 #include "webkit/plugins/ppapi/event_conversion.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/i18n/char_iterator.h" 8 #include "base/i18n/char_iterator.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 InputEventData result = GetEventWithCommonFieldsAndType(event); 128 InputEventData result = GetEventWithCommonFieldsAndType(event);
129 result.event_modifiers = mouse_event.modifiers; 129 result.event_modifiers = mouse_event.modifiers;
130 if (mouse_event.type == WebInputEvent::MouseDown || 130 if (mouse_event.type == WebInputEvent::MouseDown ||
131 mouse_event.type == WebInputEvent::MouseUp) { 131 mouse_event.type == WebInputEvent::MouseUp) {
132 result.mouse_button = 132 result.mouse_button =
133 static_cast<PP_InputEvent_MouseButton>(mouse_event.button); 133 static_cast<PP_InputEvent_MouseButton>(mouse_event.button);
134 } 134 }
135 result.mouse_position.x = mouse_event.x; 135 result.mouse_position.x = mouse_event.x;
136 result.mouse_position.y = mouse_event.y; 136 result.mouse_position.y = mouse_event.y;
137 result.mouse_click_count = mouse_event.clickCount; 137 result.mouse_click_count = mouse_event.clickCount;
138
139 // TODO(yzshen): Make the change after WebMouseEvent adds movementX/Y.
140 result.mouse_movement.x = 0; // mouse_event.movementX
141 result.mouse_movement.y = 0; // mouse_event.movementY
138 result_events->push_back(result); 142 result_events->push_back(result);
139 } 143 }
140 144
141 void AppendMouseWheelEvent(const WebInputEvent& event, 145 void AppendMouseWheelEvent(const WebInputEvent& event,
142 std::vector<InputEventData>* result_events) { 146 std::vector<InputEventData>* result_events) {
143 const WebMouseWheelEvent& mouse_wheel_event = 147 const WebMouseWheelEvent& mouse_wheel_event =
144 static_cast<const WebMouseWheelEvent&>(event); 148 static_cast<const WebMouseWheelEvent&>(event);
145 InputEventData result = GetEventWithCommonFieldsAndType(event); 149 InputEventData result = GetEventWithCommonFieldsAndType(event);
146 result.event_modifiers = mouse_wheel_event.modifiers; 150 result.event_modifiers = mouse_wheel_event.modifiers;
147 result.wheel_delta.x = mouse_wheel_event.deltaX; 151 result.wheel_delta.x = mouse_wheel_event.deltaX;
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 NOTREACHED(); 222 NOTREACHED();
219 } 223 }
220 mouse_event->timeStampSeconds = 224 mouse_event->timeStampSeconds =
221 PPTimeTicksToEventTime(event.event_time_stamp); 225 PPTimeTicksToEventTime(event.event_time_stamp);
222 mouse_event->modifiers = event.event_modifiers; 226 mouse_event->modifiers = event.event_modifiers;
223 mouse_event->button = 227 mouse_event->button =
224 static_cast<WebMouseEvent::Button>(event.mouse_button); 228 static_cast<WebMouseEvent::Button>(event.mouse_button);
225 mouse_event->x = event.mouse_position.x; 229 mouse_event->x = event.mouse_position.x;
226 mouse_event->y = event.mouse_position.y; 230 mouse_event->y = event.mouse_position.y;
227 mouse_event->clickCount = event.mouse_click_count; 231 mouse_event->clickCount = event.mouse_click_count;
232
233 // TODO(yzshen): Uncomment the following lines after WebMouseEvent adds
234 // movementX/Y.
235 // mouse_event->movementX = event.mouse_position.x;
236 // mouse_event->movementY = event.mouse_position.y;
228 return mouse_event; 237 return mouse_event;
229 } 238 }
230 239
231 WebMouseWheelEvent* BuildMouseWheelEvent(const InputEventData& event) { 240 WebMouseWheelEvent* BuildMouseWheelEvent(const InputEventData& event) {
232 WebMouseWheelEvent* mouse_wheel_event = new WebMouseWheelEvent(); 241 WebMouseWheelEvent* mouse_wheel_event = new WebMouseWheelEvent();
233 mouse_wheel_event->type = WebInputEvent::MouseWheel; 242 mouse_wheel_event->type = WebInputEvent::MouseWheel;
234 mouse_wheel_event->timeStampSeconds = 243 mouse_wheel_event->timeStampSeconds =
235 PPTimeTicksToEventTime(event.event_time_stamp); 244 PPTimeTicksToEventTime(event.event_time_stamp);
236 mouse_wheel_event->modifiers = event.event_modifiers; 245 mouse_wheel_event->modifiers = event.event_modifiers;
237 mouse_wheel_event->deltaX = event.wheel_delta.x; 246 mouse_wheel_event->deltaX = event.wheel_delta.x;
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
321 return PP_INPUTEVENT_CLASS_KEYBOARD; 330 return PP_INPUTEVENT_CLASS_KEYBOARD;
322 case WebInputEvent::Undefined: 331 case WebInputEvent::Undefined:
323 default: 332 default:
324 NOTREACHED(); 333 NOTREACHED();
325 return PP_InputEvent_Class(0); 334 return PP_InputEvent_Class(0);
326 } 335 }
327 } 336 }
328 337
329 } // namespace ppapi 338 } // namespace ppapi
330 } // namespace webkit 339 } // namespace webkit
OLDNEW
« no previous file with comments | « ppapi/thunk/thunk.h ('k') | webkit/plugins/ppapi/plugin_module.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698