| 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 645 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 656 encoding:NSASCIIStringEncoding]; | 656 encoding:NSASCIIStringEncoding]; |
| 657 | 657 |
| 658 result.timeStampSeconds = [event timestamp]; | 658 result.timeStampSeconds = [event timestamp]; |
| 659 result.isSystemKey = IsSystemKeyEvent(result); | 659 result.isSystemKey = IsSystemKeyEvent(result); |
| 660 | 660 |
| 661 return result; | 661 return result; |
| 662 } | 662 } |
| 663 | 663 |
| 664 // WebMouseEvent -------------------------------------------------------------- | 664 // WebMouseEvent -------------------------------------------------------------- |
| 665 | 665 |
| 666 blink::WebMouseEvent WebMouseEventBuilder::Build(NSEvent* event, NSView* view) { | 666 blink::WebMouseEvent WebMouseEventBuilder::Build( |
| 667 NSEvent* event, |
| 668 NSView* view, |
| 669 blink::WebPointerProperties::PointerType pointerType) { |
| 667 blink::WebMouseEvent result; | 670 blink::WebMouseEvent result; |
| 668 | 671 |
| 669 result.clickCount = 0; | 672 result.clickCount = 0; |
| 670 | 673 |
| 671 switch ([event type]) { | 674 switch ([event type]) { |
| 672 case NSMouseExited: | 675 case NSMouseExited: |
| 673 result.type = blink::WebInputEvent::MouseLeave; | 676 result.type = blink::WebInputEvent::MouseLeave; |
| 674 result.button = blink::WebMouseEvent::ButtonNone; | 677 result.button = blink::WebMouseEvent::ButtonNone; |
| 675 break; | 678 break; |
| 676 case NSLeftMouseDown: | 679 case NSLeftMouseDown: |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 722 default: | 725 default: |
| 723 NOTIMPLEMENTED(); | 726 NOTIMPLEMENTED(); |
| 724 } | 727 } |
| 725 | 728 |
| 726 SetWebEventLocationFromEventInView(&result, event, view); | 729 SetWebEventLocationFromEventInView(&result, event, view); |
| 727 | 730 |
| 728 result.modifiers = ModifiersFromEvent(event); | 731 result.modifiers = ModifiersFromEvent(event); |
| 729 | 732 |
| 730 result.timeStampSeconds = [event timestamp]; | 733 result.timeStampSeconds = [event timestamp]; |
| 731 | 734 |
| 735 NSEventSubtype subtype = NSMouseEventSubtype; |
| 736 if ([event type] != NSMouseExited && [event type] != NSMouseEntered) |
| 737 subtype = [event subtype]; |
| 738 // For the mouse events and the touchpad events, the pointer type is mouse. |
| 739 // For all tablet events, the pointer type will be just pen. |
| 740 if (subtype == NSTabletPointEventSubtype || |
| 741 subtype == NSTabletProximityEventSubtype) { |
| 742 result.pointerType = blink::WebPointerProperties::PointerType::Pen; |
| 743 return result; |
| 744 } |
| 745 |
| 746 // Set the pointerType based on if the pointing device enters or leaves the |
| 747 // proximity of its tablet. |
| 748 result.pointerType = pointerType; |
| 732 return result; | 749 return result; |
| 733 } | 750 } |
| 734 | 751 |
| 735 // WebMouseWheelEvent --------------------------------------------------------- | 752 // WebMouseWheelEvent --------------------------------------------------------- |
| 736 | 753 |
| 737 blink::WebMouseWheelEvent WebMouseWheelEventBuilder::Build( | 754 blink::WebMouseWheelEvent WebMouseWheelEventBuilder::Build( |
| 738 NSEvent* event, | 755 NSEvent* event, |
| 739 NSView* view, | 756 NSView* view, |
| 740 bool can_rubberband_left, | 757 bool can_rubberband_left, |
| 741 bool can_rubberband_right) { | 758 bool can_rubberband_right) { |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 931 break; | 948 break; |
| 932 default: | 949 default: |
| 933 NOTIMPLEMENTED(); | 950 NOTIMPLEMENTED(); |
| 934 result.type = blink::WebInputEvent::Undefined; | 951 result.type = blink::WebInputEvent::Undefined; |
| 935 } | 952 } |
| 936 | 953 |
| 937 return result; | 954 return result; |
| 938 } | 955 } |
| 939 | 956 |
| 940 } // namespace content | 957 } // namespace content |
| OLD | NEW |