OLD | NEW |
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 947 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
958 | 958 |
959 static WebMouseWheelEvent::Phase momentumPhaseForEvent(NSEvent *event) | 959 static WebMouseWheelEvent::Phase momentumPhaseForEvent(NSEvent *event) |
960 { | 960 { |
961 if (![event respondsToSelector:@selector(momentumPhase)]) | 961 if (![event respondsToSelector:@selector(momentumPhase)]) |
962 return WebMouseWheelEvent::PhaseNone; | 962 return WebMouseWheelEvent::PhaseNone; |
963 | 963 |
964 NSEventPhase eventMomentumPhase = [event momentumPhase]; | 964 NSEventPhase eventMomentumPhase = [event momentumPhase]; |
965 return phaseForNSEventPhase(eventMomentumPhase); | 965 return phaseForNSEventPhase(eventMomentumPhase); |
966 } | 966 } |
967 | 967 |
968 WebMouseWheelEvent WebInputEventFactory::mouseWheelEvent(NSEvent* event, NSView*
view) | 968 WebMouseWheelEvent WebInputEventFactory::mouseWheelEvent(NSEvent* event, NSView*
view, bool canRubberbandLeft, bool canRubberbandRight) |
969 { | 969 { |
970 WebMouseWheelEvent result; | 970 WebMouseWheelEvent result; |
971 | 971 |
972 result.type = WebInputEvent::MouseWheel; | 972 result.type = WebInputEvent::MouseWheel; |
973 result.button = WebMouseEvent::ButtonNone; | 973 result.button = WebMouseEvent::ButtonNone; |
974 | 974 |
975 result.modifiers = modifiersFromEvent(event); | 975 result.modifiers = modifiersFromEvent(event); |
976 | 976 |
977 setWebEventLocationFromEventInView(&result, event, view); | 977 setWebEventLocationFromEventInView(&result, event, view); |
978 | 978 |
| 979 result.canRubberbandLeft = canRubberbandLeft; |
| 980 result.canRubberbandRight = canRubberbandRight; |
| 981 |
979 // Of Mice and Men | 982 // Of Mice and Men |
980 // --------------- | 983 // --------------- |
981 // | 984 // |
982 // There are three types of scroll data available on a scroll wheel CGEvent. | 985 // There are three types of scroll data available on a scroll wheel CGEvent. |
983 // Apple's documentation ([1]) is rather vague in their differences, and not | 986 // Apple's documentation ([1]) is rather vague in their differences, and not |
984 // terribly helpful in deciding which to use. This is what's really going on
. | 987 // terribly helpful in deciding which to use. This is what's really going on
. |
985 // | 988 // |
986 // First, these events behave very differently depending on whether a standa
rd | 989 // First, these events behave very differently depending on whether a standa
rd |
987 // wheel mouse is used (one that scrolls in discrete units) or a | 990 // wheel mouse is used (one that scrolls in discrete units) or a |
988 // trackpad/Mighty Mouse is used (which both provide continuous scrolling). | 991 // trackpad/Mighty Mouse is used (which both provide continuous scrolling). |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1137 break; | 1140 break; |
1138 default: | 1141 default: |
1139 ASSERT_NOT_REACHED(); | 1142 ASSERT_NOT_REACHED(); |
1140 result.type = WebInputEvent::Undefined; | 1143 result.type = WebInputEvent::Undefined; |
1141 } | 1144 } |
1142 | 1145 |
1143 return result; | 1146 return result; |
1144 } | 1147 } |
1145 | 1148 |
1146 } // namespace blink | 1149 } // namespace blink |
OLD | NEW |