OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 /* | 5 /* |
6 * Copyright (C) 2004, 2006, 2007 Apple Inc. All rights reserved. | 6 * Copyright (C) 2004, 2006, 2007 Apple Inc. All rights reserved. |
7 * Copyright (C) 2006-2009 Google Inc. | 7 * Copyright (C) 2006-2009 Google Inc. |
8 * | 8 * |
9 * Redistribution and use in source and binary forms, with or without | 9 * Redistribution and use in source and binary forms, with or without |
10 * modification, are permitted provided that the following conditions | 10 * modification, are permitted provided that the following conditions |
(...skipping 508 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
519 result->movementX = [event deltaX]; | 519 result->movementX = [event deltaX]; |
520 result->movementY = [event deltaY]; | 520 result->movementY = [event deltaY]; |
521 } | 521 } |
522 | 522 |
523 bool IsSystemKeyEvent(const blink::WebKeyboardEvent& event) { | 523 bool IsSystemKeyEvent(const blink::WebKeyboardEvent& event) { |
524 // Windows and Linux set |isSystemKey| if alt is down. Blink looks at this | 524 // Windows and Linux set |isSystemKey| if alt is down. Blink looks at this |
525 // flag to decide if it should handle a key or not. E.g. alt-left/right | 525 // flag to decide if it should handle a key or not. E.g. alt-left/right |
526 // shouldn't be used by Blink to scroll the current page, because we want | 526 // shouldn't be used by Blink to scroll the current page, because we want |
527 // to get that key back for it to do history navigation. Hence, the | 527 // to get that key back for it to do history navigation. Hence, the |
528 // corresponding situation on OS X is to set this for cmd key presses. | 528 // corresponding situation on OS X is to set this for cmd key presses. |
| 529 |
529 // cmd-b and and cmd-i are system wide key bindings that OS X doesn't | 530 // cmd-b and and cmd-i are system wide key bindings that OS X doesn't |
530 // handle for us, so the editor handles them. | 531 // handle for us, so the editor handles them. |
531 return event.modifiers & blink::WebInputEvent::MetaKey && | 532 int modifiers = event.modifiers & blink::WebInputEvent::InputModifiers; |
532 event.windowsKeyCode != ui::VKEY_B && | 533 if (modifiers == blink::WebInputEvent::MetaKey && |
533 event.windowsKeyCode != ui::VKEY_I; | 534 event.windowsKeyCode == ui::VKEY_B) |
| 535 return false; |
| 536 if (modifiers == blink::WebInputEvent::MetaKey && |
| 537 event.windowsKeyCode == ui::VKEY_I) |
| 538 return false; |
| 539 |
| 540 return event.modifiers & blink::WebInputEvent::MetaKey; |
534 } | 541 } |
535 | 542 |
536 blink::WebMouseWheelEvent::Phase PhaseForNSEventPhase( | 543 blink::WebMouseWheelEvent::Phase PhaseForNSEventPhase( |
537 NSEventPhase event_phase) { | 544 NSEventPhase event_phase) { |
538 uint32_t phase = blink::WebMouseWheelEvent::PhaseNone; | 545 uint32_t phase = blink::WebMouseWheelEvent::PhaseNone; |
539 if (event_phase & NSEventPhaseBegan) | 546 if (event_phase & NSEventPhaseBegan) |
540 phase |= blink::WebMouseWheelEvent::PhaseBegan; | 547 phase |= blink::WebMouseWheelEvent::PhaseBegan; |
541 if (event_phase & NSEventPhaseStationary) | 548 if (event_phase & NSEventPhaseStationary) |
542 phase |= blink::WebMouseWheelEvent::PhaseStationary; | 549 phase |= blink::WebMouseWheelEvent::PhaseStationary; |
543 if (event_phase & NSEventPhaseChanged) | 550 if (event_phase & NSEventPhaseChanged) |
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
911 break; | 918 break; |
912 default: | 919 default: |
913 NOTIMPLEMENTED(); | 920 NOTIMPLEMENTED(); |
914 result.type = blink::WebInputEvent::Undefined; | 921 result.type = blink::WebInputEvent::Undefined; |
915 } | 922 } |
916 | 923 |
917 return result; | 924 return result; |
918 } | 925 } |
919 | 926 |
920 } // namespace content | 927 } // namespace content |
OLD | NEW |