Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(412)

Side by Side Diff: Source/web/WebInputEventFactoryMac.mm

Issue 788173002: Should set the modifiers for web mouse event on Mac. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: fixed Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2004, 2006, 2007 Apple Inc. All rights reserved. 2 * Copyright (C) 2004, 2006, 2007 Apple Inc. All rights reserved.
3 * Copyright (C) 2006-2009 Google Inc. 3 * Copyright (C) 2006-2009 Google Inc.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 704 matching lines...) Expand 10 before | Expand all | Expand 10 after
715 if ([event modifierFlags] & NSControlKeyMask) 715 if ([event modifierFlags] & NSControlKeyMask)
716 modifiers |= WebInputEvent::ControlKey; 716 modifiers |= WebInputEvent::ControlKey;
717 if ([event modifierFlags] & NSShiftKeyMask) 717 if ([event modifierFlags] & NSShiftKeyMask)
718 modifiers |= WebInputEvent::ShiftKey; 718 modifiers |= WebInputEvent::ShiftKey;
719 if ([event modifierFlags] & NSAlternateKeyMask) 719 if ([event modifierFlags] & NSAlternateKeyMask)
720 modifiers |= WebInputEvent::AltKey; 720 modifiers |= WebInputEvent::AltKey;
721 if ([event modifierFlags] & NSCommandKeyMask) 721 if ([event modifierFlags] & NSCommandKeyMask)
722 modifiers |= WebInputEvent::MetaKey; 722 modifiers |= WebInputEvent::MetaKey;
723 if ([event modifierFlags] & NSAlphaShiftKeyMask) 723 if ([event modifierFlags] & NSAlphaShiftKeyMask)
724 modifiers |= WebInputEvent::CapsLockOn; 724 modifiers |= WebInputEvent::CapsLockOn;
725 // TODO(port): Set mouse button states 725 if ([NSEvent pressedMouseButtons] & 1 << 0)
haraken 2014/12/11 16:24:13 Don't we want to have a constant variable for 1 <<
zino 2014/12/11 17:01:28 Done. IMHO, it is better to use constant values h
726 modifiers |= WebInputEvent::LeftButtonDown;
727 if ([NSEvent pressedMouseButtons] & 1 << 1)
728 modifiers |= WebInputEvent::RightButtonDown;
729 if ([NSEvent pressedMouseButtons] & 1 << 2)
730 modifiers |= WebInputEvent::MiddleButtonDown;
726 731
727 return modifiers; 732 return modifiers;
728 } 733 }
729 734
730 static inline void setWebEventLocationFromEventInView(WebMouseEvent* result, 735 static inline void setWebEventLocationFromEventInView(WebMouseEvent* result,
731 NSEvent* event, 736 NSEvent* event,
732 NSView* view) { 737 NSView* view) {
733 NSPoint windowLocal = [event locationInWindow]; 738 NSPoint windowLocal = [event locationInWindow];
734 739
735 NSPoint screenLocal = [[view window] convertBaseToScreen:windowLocal]; 740 NSPoint screenLocal = [[view window] convertBaseToScreen:windowLocal];
(...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after
1140 break; 1145 break;
1141 default: 1146 default:
1142 ASSERT_NOT_REACHED(); 1147 ASSERT_NOT_REACHED();
1143 result.type = WebInputEvent::Undefined; 1148 result.type = WebInputEvent::Undefined;
1144 } 1149 }
1145 1150
1146 return result; 1151 return result;
1147 } 1152 }
1148 1153
1149 } // namespace blink 1154 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698