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/browser/renderer_host/web_input_event_aura.h" | 5 #include "content/browser/renderer_host/web_input_event_aura.h" |
6 | 6 |
7 #include "content/browser/renderer_host/input/web_input_event_util.h" | 7 #include "content/browser/renderer_host/input/web_input_event_util.h" |
8 #include "content/browser/renderer_host/ui_events_helper.h" | 8 #include "content/browser/renderer_host/ui_events_helper.h" |
9 #include "ui/aura/client/screen_position_client.h" | 9 #include "ui/aura/client/screen_position_client.h" |
10 #include "ui/aura/window.h" | 10 #include "ui/aura/window.h" |
(...skipping 15 matching lines...) Expand all Loading... |
26 aura::client::ScreenPositionClient* spc = | 26 aura::client::ScreenPositionClient* spc = |
27 aura::client::GetScreenPositionClient(root); | 27 aura::client::GetScreenPositionClient(root); |
28 if (!spc) | 28 if (!spc) |
29 return event.root_location(); | 29 return event.root_location(); |
30 | 30 |
31 gfx::Point screen_location(event.root_location()); | 31 gfx::Point screen_location(event.root_location()); |
32 spc->ConvertPointToScreen(root, &screen_location); | 32 spc->ConvertPointToScreen(root, &screen_location); |
33 return screen_location; | 33 return screen_location; |
34 } | 34 } |
35 | 35 |
36 blink::WebInputEvent::Modifiers DomCodeToWebInputEventModifiers( | |
37 ui::DomCode code) { | |
38 switch (ui::KeycodeConverter::DomCodeToLocation(code)) { | |
39 case ui::DomKeyLocation::LEFT: | |
40 return blink::WebInputEvent::IsLeft; | |
41 case ui::DomKeyLocation::RIGHT: | |
42 return blink::WebInputEvent::IsRight; | |
43 case ui::DomKeyLocation::NUMPAD: | |
44 return blink::WebInputEvent::IsKeyPad; | |
45 case ui::DomKeyLocation::STANDARD: | |
46 break; | |
47 } | |
48 return static_cast<blink::WebInputEvent::Modifiers>(0); | |
49 } | |
50 | |
51 blink::WebPointerProperties::PointerType EventPointerTypeToWebPointerType( | 36 blink::WebPointerProperties::PointerType EventPointerTypeToWebPointerType( |
52 ui::EventPointerType pointer_type) { | 37 ui::EventPointerType pointer_type) { |
53 switch (pointer_type) { | 38 switch (pointer_type) { |
54 case ui::EventPointerType::POINTER_TYPE_UNKNOWN: | 39 case ui::EventPointerType::POINTER_TYPE_UNKNOWN: |
55 return blink::WebPointerProperties::PointerType::PointerTypeUnknown; | 40 return blink::WebPointerProperties::PointerType::PointerTypeUnknown; |
56 case ui::EventPointerType::POINTER_TYPE_MOUSE: | 41 case ui::EventPointerType::POINTER_TYPE_MOUSE: |
57 return blink::WebPointerProperties::PointerType::PointerTypeMouse; | 42 return blink::WebPointerProperties::PointerType::PointerTypeMouse; |
58 case ui::EventPointerType::POINTER_TYPE_PEN: | 43 case ui::EventPointerType::POINTER_TYPE_PEN: |
59 return blink::WebPointerProperties::PointerType::PointerTypePen; | 44 return blink::WebPointerProperties::PointerType::PointerTypePen; |
60 case ui::EventPointerType::POINTER_TYPE_TOUCH: | 45 case ui::EventPointerType::POINTER_TYPE_TOUCH: |
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
429 webkit_event.tiltX = roundf(event.pointer_details().tilt_x()); | 414 webkit_event.tiltX = roundf(event.pointer_details().tilt_x()); |
430 webkit_event.tiltY = roundf(event.pointer_details().tilt_y()); | 415 webkit_event.tiltY = roundf(event.pointer_details().tilt_y()); |
431 webkit_event.force = event.pointer_details().force(); | 416 webkit_event.force = event.pointer_details().force(); |
432 webkit_event.pointerType = | 417 webkit_event.pointerType = |
433 EventPointerTypeToWebPointerType(event.pointer_details().pointer_type()); | 418 EventPointerTypeToWebPointerType(event.pointer_details().pointer_type()); |
434 | 419 |
435 return webkit_event; | 420 return webkit_event; |
436 } | 421 } |
437 | 422 |
438 } // namespace content | 423 } // namespace content |
OLD | NEW |