| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 // MSVC++ requires this to be set before any other includes to get M_PI. | 5 // MSVC++ requires this to be set before any other includes to get M_PI. |
| 6 #define _USE_MATH_DEFINES | 6 #define _USE_MATH_DEFINES |
| 7 | 7 |
| 8 #include "content/browser/renderer_host/input/web_input_event_util.h" | 8 #include "content/browser/renderer_host/input/web_input_event_util.h" |
| 9 | 9 |
| 10 #include <cmath> | 10 #include <cmath> |
| (...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 393 if (flags & ui::EF_LEFT_MOUSE_BUTTON) | 393 if (flags & ui::EF_LEFT_MOUSE_BUTTON) |
| 394 modifiers |= blink::WebInputEvent::LeftButtonDown; | 394 modifiers |= blink::WebInputEvent::LeftButtonDown; |
| 395 if (flags & ui::EF_MIDDLE_MOUSE_BUTTON) | 395 if (flags & ui::EF_MIDDLE_MOUSE_BUTTON) |
| 396 modifiers |= blink::WebInputEvent::MiddleButtonDown; | 396 modifiers |= blink::WebInputEvent::MiddleButtonDown; |
| 397 if (flags & ui::EF_RIGHT_MOUSE_BUTTON) | 397 if (flags & ui::EF_RIGHT_MOUSE_BUTTON) |
| 398 modifiers |= blink::WebInputEvent::RightButtonDown; | 398 modifiers |= blink::WebInputEvent::RightButtonDown; |
| 399 if (flags & ui::EF_CAPS_LOCK_DOWN) | 399 if (flags & ui::EF_CAPS_LOCK_DOWN) |
| 400 modifiers |= blink::WebInputEvent::CapsLockOn; | 400 modifiers |= blink::WebInputEvent::CapsLockOn; |
| 401 if (flags & ui::EF_IS_REPEAT) | 401 if (flags & ui::EF_IS_REPEAT) |
| 402 modifiers |= blink::WebInputEvent::IsAutoRepeat; | 402 modifiers |= blink::WebInputEvent::IsAutoRepeat; |
| 403 if (flags & ui::EF_NUMPAD_KEY) |
| 404 modifiers |= blink::WebInputEvent::IsKeyPad; |
| 403 | 405 |
| 404 return modifiers; | 406 return modifiers; |
| 405 } | 407 } |
| 406 | 408 |
| 407 int WebEventModifiersToEventFlags(int modifiers) { | 409 int WebEventModifiersToEventFlags(int modifiers) { |
| 408 int flags = 0; | 410 int flags = 0; |
| 409 | 411 |
| 410 if (modifiers & blink::WebInputEvent::ShiftKey) | 412 if (modifiers & blink::WebInputEvent::ShiftKey) |
| 411 flags |= ui::EF_SHIFT_DOWN; | 413 flags |= ui::EF_SHIFT_DOWN; |
| 412 if (modifiers & blink::WebInputEvent::ControlKey) | 414 if (modifiers & blink::WebInputEvent::ControlKey) |
| 413 flags |= ui::EF_CONTROL_DOWN; | 415 flags |= ui::EF_CONTROL_DOWN; |
| 414 if (modifiers & blink::WebInputEvent::AltKey) | 416 if (modifiers & blink::WebInputEvent::AltKey) |
| 415 flags |= ui::EF_ALT_DOWN; | 417 flags |= ui::EF_ALT_DOWN; |
| 416 if (modifiers & blink::WebInputEvent::MetaKey) | 418 if (modifiers & blink::WebInputEvent::MetaKey) |
| 417 flags |= ui::EF_COMMAND_DOWN; | 419 flags |= ui::EF_COMMAND_DOWN; |
| 418 | 420 |
| 419 if (modifiers & blink::WebInputEvent::LeftButtonDown) | 421 if (modifiers & blink::WebInputEvent::LeftButtonDown) |
| 420 flags |= ui::EF_LEFT_MOUSE_BUTTON; | 422 flags |= ui::EF_LEFT_MOUSE_BUTTON; |
| 421 if (modifiers & blink::WebInputEvent::MiddleButtonDown) | 423 if (modifiers & blink::WebInputEvent::MiddleButtonDown) |
| 422 flags |= ui::EF_MIDDLE_MOUSE_BUTTON; | 424 flags |= ui::EF_MIDDLE_MOUSE_BUTTON; |
| 423 if (modifiers & blink::WebInputEvent::RightButtonDown) | 425 if (modifiers & blink::WebInputEvent::RightButtonDown) |
| 424 flags |= ui::EF_RIGHT_MOUSE_BUTTON; | 426 flags |= ui::EF_RIGHT_MOUSE_BUTTON; |
| 425 if (modifiers & blink::WebInputEvent::CapsLockOn) | 427 if (modifiers & blink::WebInputEvent::CapsLockOn) |
| 426 flags |= ui::EF_CAPS_LOCK_DOWN; | 428 flags |= ui::EF_CAPS_LOCK_DOWN; |
| 427 if (modifiers & blink::WebInputEvent::IsAutoRepeat) | 429 if (modifiers & blink::WebInputEvent::IsAutoRepeat) |
| 428 flags |= ui::EF_IS_REPEAT; | 430 flags |= ui::EF_IS_REPEAT; |
| 431 if (modifiers & blink::WebInputEvent::IsKeyPad) |
| 432 flags |= ui::EF_NUMPAD_KEY; |
| 429 | 433 |
| 430 return flags; | 434 return flags; |
| 431 } | 435 } |
| 432 | 436 |
| 433 } // namespace content | 437 } // namespace content |
| OLD | NEW |