| OLD | NEW |
| 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 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 result.event_modifiers = key_event.modifiers; | 164 result.event_modifiers = key_event.modifiers; |
| 165 base::WriteUnicodeCharacter(iter.get(), &result.character_text); | 165 base::WriteUnicodeCharacter(iter.get(), &result.character_text); |
| 166 | 166 |
| 167 result_events->push_back(result); | 167 result_events->push_back(result); |
| 168 iter.Advance(); | 168 iter.Advance(); |
| 169 } | 169 } |
| 170 } | 170 } |
| 171 | 171 |
| 172 void AppendMouseEvent(const WebInputEvent& event, | 172 void AppendMouseEvent(const WebInputEvent& event, |
| 173 std::vector<InputEventData>* result_events) { | 173 std::vector<InputEventData>* result_events) { |
| 174 static_assert(static_cast<int>(WebMouseEvent::ButtonNone) == | 174 static_assert(static_cast<int>(WebMouseEvent::Button::NoButton) == |
| 175 static_cast<int>(PP_INPUTEVENT_MOUSEBUTTON_NONE), | 175 static_cast<int>(PP_INPUTEVENT_MOUSEBUTTON_NONE), |
| 176 "MouseNone should match"); | 176 "MouseNone should match"); |
| 177 static_assert(static_cast<int>(WebMouseEvent::ButtonLeft) == | 177 static_assert(static_cast<int>(WebMouseEvent::Button::Left) == |
| 178 static_cast<int>(PP_INPUTEVENT_MOUSEBUTTON_LEFT), | 178 static_cast<int>(PP_INPUTEVENT_MOUSEBUTTON_LEFT), |
| 179 "MouseLeft should match"); | 179 "MouseLeft should match"); |
| 180 static_assert(static_cast<int>(WebMouseEvent::ButtonRight) == | 180 static_assert(static_cast<int>(WebMouseEvent::Button::Right) == |
| 181 static_cast<int>(PP_INPUTEVENT_MOUSEBUTTON_RIGHT), | 181 static_cast<int>(PP_INPUTEVENT_MOUSEBUTTON_RIGHT), |
| 182 "MouseRight should match"); | 182 "MouseRight should match"); |
| 183 static_assert(static_cast<int>(WebMouseEvent::ButtonMiddle) == | 183 static_assert(static_cast<int>(WebMouseEvent::Button::Middle) == |
| 184 static_cast<int>(PP_INPUTEVENT_MOUSEBUTTON_MIDDLE), | 184 static_cast<int>(PP_INPUTEVENT_MOUSEBUTTON_MIDDLE), |
| 185 "MouseMiddle should match"); | 185 "MouseMiddle should match"); |
| 186 | 186 |
| 187 const WebMouseEvent& mouse_event = static_cast<const WebMouseEvent&>(event); | 187 const WebMouseEvent& mouse_event = static_cast<const WebMouseEvent&>(event); |
| 188 InputEventData result = GetEventWithCommonFieldsAndType(event); | 188 InputEventData result = GetEventWithCommonFieldsAndType(event); |
| 189 result.event_modifiers = mouse_event.modifiers; | 189 result.event_modifiers = mouse_event.modifiers; |
| 190 if (mouse_event.type == WebInputEvent::MouseDown || | 190 if (mouse_event.type == WebInputEvent::MouseDown || |
| 191 mouse_event.type == WebInputEvent::MouseMove || | 191 mouse_event.type == WebInputEvent::MouseMove || |
| 192 mouse_event.type == WebInputEvent::MouseUp) { | 192 mouse_event.type == WebInputEvent::MouseUp) { |
| 193 result.mouse_button = | 193 result.mouse_button = |
| (...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 425 mouse_event->type = WebInputEvent::ContextMenu; | 425 mouse_event->type = WebInputEvent::ContextMenu; |
| 426 break; | 426 break; |
| 427 default: | 427 default: |
| 428 NOTREACHED(); | 428 NOTREACHED(); |
| 429 } | 429 } |
| 430 mouse_event->timeStampSeconds = event.event_time_stamp; | 430 mouse_event->timeStampSeconds = event.event_time_stamp; |
| 431 mouse_event->modifiers = event.event_modifiers; | 431 mouse_event->modifiers = event.event_modifiers; |
| 432 mouse_event->button = static_cast<WebMouseEvent::Button>(event.mouse_button); | 432 mouse_event->button = static_cast<WebMouseEvent::Button>(event.mouse_button); |
| 433 if (mouse_event->type == WebInputEvent::MouseMove) { | 433 if (mouse_event->type == WebInputEvent::MouseMove) { |
| 434 if (mouse_event->modifiers & WebInputEvent::LeftButtonDown) | 434 if (mouse_event->modifiers & WebInputEvent::LeftButtonDown) |
| 435 mouse_event->button = WebMouseEvent::ButtonLeft; | 435 mouse_event->button = WebMouseEvent::Button::Left; |
| 436 else if (mouse_event->modifiers & WebInputEvent::MiddleButtonDown) | 436 else if (mouse_event->modifiers & WebInputEvent::MiddleButtonDown) |
| 437 mouse_event->button = WebMouseEvent::ButtonMiddle; | 437 mouse_event->button = WebMouseEvent::Button::Middle; |
| 438 else if (mouse_event->modifiers & WebInputEvent::RightButtonDown) | 438 else if (mouse_event->modifiers & WebInputEvent::RightButtonDown) |
| 439 mouse_event->button = WebMouseEvent::ButtonRight; | 439 mouse_event->button = WebMouseEvent::Button::Right; |
| 440 } | 440 } |
| 441 mouse_event->x = event.mouse_position.x; | 441 mouse_event->x = event.mouse_position.x; |
| 442 mouse_event->y = event.mouse_position.y; | 442 mouse_event->y = event.mouse_position.y; |
| 443 mouse_event->clickCount = event.mouse_click_count; | 443 mouse_event->clickCount = event.mouse_click_count; |
| 444 mouse_event->movementX = event.mouse_movement.x; | 444 mouse_event->movementX = event.mouse_movement.x; |
| 445 mouse_event->movementY = event.mouse_movement.y; | 445 mouse_event->movementY = event.mouse_movement.y; |
| 446 return mouse_event; | 446 return mouse_event; |
| 447 } | 447 } |
| 448 | 448 |
| 449 WebMouseWheelEvent* BuildMouseWheelEvent(const InputEventData& event) { | 449 WebMouseWheelEvent* BuildMouseWheelEvent(const InputEventData& event) { |
| (...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 740 return PP_INPUTEVENT_CLASS_TOUCH; | 740 return PP_INPUTEVENT_CLASS_TOUCH; |
| 741 case WebInputEvent::TouchScrollStarted: | 741 case WebInputEvent::TouchScrollStarted: |
| 742 return PP_InputEvent_Class(0); | 742 return PP_InputEvent_Class(0); |
| 743 default: | 743 default: |
| 744 CHECK(WebInputEvent::isGestureEventType(type)); | 744 CHECK(WebInputEvent::isGestureEventType(type)); |
| 745 return PP_InputEvent_Class(0); | 745 return PP_InputEvent_Class(0); |
| 746 } | 746 } |
| 747 } | 747 } |
| 748 | 748 |
| 749 } // namespace content | 749 } // namespace content |
| OLD | NEW |