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

Side by Side Diff: content/renderer/pepper/event_conversion.cc

Issue 2289273002: Eraser tool type plumbing from ui/events to web events and PPAPI. (Closed)
Patch Set: cleanup Created 4 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "content/renderer/pepper/event_conversion.h" 5 #include "content/renderer/pepper/event_conversion.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 #include <string.h> 9 #include <string.h>
10 10
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 "CapsLock should match"); 73 "CapsLock should match");
74 static_assert(static_cast<int>(PP_INPUTEVENT_MODIFIER_NUMLOCKKEY) == 74 static_assert(static_cast<int>(PP_INPUTEVENT_MODIFIER_NUMLOCKKEY) ==
75 static_cast<int>(WebInputEvent::NumLockOn), 75 static_cast<int>(WebInputEvent::NumLockOn),
76 "NumLock should match"); 76 "NumLock should match");
77 static_assert(static_cast<int>(PP_INPUTEVENT_MODIFIER_ISLEFT) == 77 static_assert(static_cast<int>(PP_INPUTEVENT_MODIFIER_ISLEFT) ==
78 static_cast<int>(WebInputEvent::IsLeft), 78 static_cast<int>(WebInputEvent::IsLeft),
79 "IsLeft should match"); 79 "IsLeft should match");
80 static_assert(static_cast<int>(PP_INPUTEVENT_MODIFIER_ISRIGHT) == 80 static_assert(static_cast<int>(PP_INPUTEVENT_MODIFIER_ISRIGHT) ==
81 static_cast<int>(WebInputEvent::IsRight), 81 static_cast<int>(WebInputEvent::IsRight),
82 "IsRight should match"); 82 "IsRight should match");
83 static_assert(static_cast<int>(PP_INPUTEVENT_MODIFIER_ISERASER) ==
84 static_cast<int>(WebInputEvent::IsEraser),
85 "IsEraser should match");
bbudge 2016/08/30 20:46:36 Eliminate.
denniskempin 2016/08/30 21:09:41 Done.
83 86
84 PP_InputEvent_Type ConvertEventTypes(WebInputEvent::Type wetype) { 87 PP_InputEvent_Type ConvertEventTypes(WebInputEvent::Type wetype) {
85 switch (wetype) { 88 switch (wetype) {
86 case WebInputEvent::MouseDown: 89 case WebInputEvent::MouseDown:
87 return PP_INPUTEVENT_TYPE_MOUSEDOWN; 90 return PP_INPUTEVENT_TYPE_MOUSEDOWN;
88 case WebInputEvent::MouseUp: 91 case WebInputEvent::MouseUp:
89 return PP_INPUTEVENT_TYPE_MOUSEUP; 92 return PP_INPUTEVENT_TYPE_MOUSEUP;
90 case WebInputEvent::MouseMove: 93 case WebInputEvent::MouseMove:
91 return PP_INPUTEVENT_TYPE_MOUSEMOVE; 94 return PP_INPUTEVENT_TYPE_MOUSEMOVE;
92 case WebInputEvent::MouseEnter: 95 case WebInputEvent::MouseEnter:
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 static_assert(static_cast<int>(WebMouseEvent::Button::Right) == 183 static_assert(static_cast<int>(WebMouseEvent::Button::Right) ==
181 static_cast<int>(PP_INPUTEVENT_MOUSEBUTTON_RIGHT), 184 static_cast<int>(PP_INPUTEVENT_MOUSEBUTTON_RIGHT),
182 "MouseRight should match"); 185 "MouseRight should match");
183 static_assert(static_cast<int>(WebMouseEvent::Button::Middle) == 186 static_assert(static_cast<int>(WebMouseEvent::Button::Middle) ==
184 static_cast<int>(PP_INPUTEVENT_MOUSEBUTTON_MIDDLE), 187 static_cast<int>(PP_INPUTEVENT_MOUSEBUTTON_MIDDLE),
185 "MouseMiddle should match"); 188 "MouseMiddle should match");
186 189
187 const WebMouseEvent& mouse_event = static_cast<const WebMouseEvent&>(event); 190 const WebMouseEvent& mouse_event = static_cast<const WebMouseEvent&>(event);
188 InputEventData result = GetEventWithCommonFieldsAndType(event); 191 InputEventData result = GetEventWithCommonFieldsAndType(event);
189 result.event_modifiers = mouse_event.modifiers; 192 result.event_modifiers = mouse_event.modifiers;
193 if (mouse_event.pointerType == blink::WebPointerProperties::PointerType::Erase r) {
bradnelson 2016/08/30 18:19:29 Keep it under 80 columns
denniskempin 2016/08/30 20:49:34 Done.
194 result.event_modifiers |= PP_INPUTEVENT_MODIFIER_ISERASER;
195 }
190 if (mouse_event.type == WebInputEvent::MouseDown || 196 if (mouse_event.type == WebInputEvent::MouseDown ||
191 mouse_event.type == WebInputEvent::MouseMove || 197 mouse_event.type == WebInputEvent::MouseMove ||
192 mouse_event.type == WebInputEvent::MouseUp) { 198 mouse_event.type == WebInputEvent::MouseUp) {
193 result.mouse_button = 199 result.mouse_button =
194 static_cast<PP_InputEvent_MouseButton>(mouse_event.button); 200 static_cast<PP_InputEvent_MouseButton>(mouse_event.button);
195 } 201 }
196 result.mouse_position.x = mouse_event.x; 202 result.mouse_position.x = mouse_event.x;
197 result.mouse_position.y = mouse_event.y; 203 result.mouse_position.y = mouse_event.y;
198 result.mouse_click_count = mouse_event.clickCount; 204 result.mouse_click_count = mouse_event.clickCount;
199 result.mouse_movement.x = mouse_event.movementX; 205 result.mouse_movement.x = mouse_event.movementX;
(...skipping 540 matching lines...) Expand 10 before | Expand all | Expand 10 after
740 return PP_INPUTEVENT_CLASS_TOUCH; 746 return PP_INPUTEVENT_CLASS_TOUCH;
741 case WebInputEvent::TouchScrollStarted: 747 case WebInputEvent::TouchScrollStarted:
742 return PP_InputEvent_Class(0); 748 return PP_InputEvent_Class(0);
743 default: 749 default:
744 CHECK(WebInputEvent::isGestureEventType(type)); 750 CHECK(WebInputEvent::isGestureEventType(type));
745 return PP_InputEvent_Class(0); 751 return PP_InputEvent_Class(0);
746 } 752 }
747 } 753 }
748 754
749 } // namespace content 755 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698