| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserv
ed. | 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserv
ed. |
| 3 * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org) | 3 * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org) |
| 4 * Copyright (C) 2012 Digia Plc. and/or its subsidiary(-ies) | 4 * Copyright (C) 2012 Digia Plc. and/or its subsidiary(-ies) |
| 5 * | 5 * |
| 6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
| 7 * modification, are permitted provided that the following conditions | 7 * modification, are permitted provided that the following conditions |
| 8 * are met: | 8 * are met: |
| 9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 // The minimum amount of time an element stays active after a ShowPress | 125 // The minimum amount of time an element stays active after a ShowPress |
| 126 // This is roughly 9 frames, which should be long enough to be noticeable. | 126 // This is roughly 9 frames, which should be long enough to be noticeable. |
| 127 static const double minimumActiveInterval = 0.15; | 127 static const double minimumActiveInterval = 0.15; |
| 128 | 128 |
| 129 #if OS(MACOSX) | 129 #if OS(MACOSX) |
| 130 static const double TextDragDelay = 0.15; | 130 static const double TextDragDelay = 0.15; |
| 131 #else | 131 #else |
| 132 static const double TextDragDelay = 0.0; | 132 static const double TextDragDelay = 0.0; |
| 133 #endif | 133 #endif |
| 134 | 134 |
| 135 // Report Overscroll if OverscrollDelta is greater than minimumOverscrollDelta |
| 136 // to maintain consistency as did in compositor. |
| 137 static const float minimumOverscrollDelta = 0.1; |
| 138 |
| 135 enum NoCursorChangeType { NoCursorChange }; | 139 enum NoCursorChangeType { NoCursorChange }; |
| 136 | 140 |
| 137 enum class DragInitiator { Mouse, Touch }; | 141 enum class DragInitiator { Mouse, Touch }; |
| 138 | 142 |
| 139 class OptionalCursor { | 143 class OptionalCursor { |
| 140 public: | 144 public: |
| 141 OptionalCursor(NoCursorChangeType) : m_isCursorChange(false) { } | 145 OptionalCursor(NoCursorChangeType) : m_isCursorChange(false) { } |
| 142 OptionalCursor(const Cursor& cursor) : m_isCursorChange(true), m_cursor(curs
or) { } | 146 OptionalCursor(const Cursor& cursor) : m_isCursorChange(true), m_cursor(curs
or) { } |
| 143 | 147 |
| 144 bool isCursorChange() const { return m_isCursorChange; } | 148 bool isCursorChange() const { return m_isCursorChange; } |
| (...skipping 2089 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2234 } | 2238 } |
| 2235 | 2239 |
| 2236 void EventHandler::resetOverscroll(bool didScrollX, bool didScrollY) | 2240 void EventHandler::resetOverscroll(bool didScrollX, bool didScrollY) |
| 2237 { | 2241 { |
| 2238 if (didScrollX) | 2242 if (didScrollX) |
| 2239 m_accumulatedRootOverscroll.setWidth(0); | 2243 m_accumulatedRootOverscroll.setWidth(0); |
| 2240 if (didScrollY) | 2244 if (didScrollY) |
| 2241 m_accumulatedRootOverscroll.setHeight(0); | 2245 m_accumulatedRootOverscroll.setHeight(0); |
| 2242 } | 2246 } |
| 2243 | 2247 |
| 2248 static inline FloatSize adjustOverscoll(FloatSize unusedDelta) |
| 2249 { |
| 2250 if (std::abs(unusedDelta.width()) < minimumOverscrollDelta) |
| 2251 unusedDelta.setWidth(0); |
| 2252 if (std::abs(unusedDelta.height()) < minimumOverscrollDelta) |
| 2253 unusedDelta.setHeight(0); |
| 2254 |
| 2255 return unusedDelta; |
| 2256 } |
| 2257 |
| 2244 void EventHandler::handleOverscroll(const ScrollResult& scrollResult, const Floa
tPoint& position, const FloatSize& velocity) | 2258 void EventHandler::handleOverscroll(const ScrollResult& scrollResult, const Floa
tPoint& position, const FloatSize& velocity) |
| 2245 { | 2259 { |
| 2246 FloatSize unusedDelta(scrollResult.unusedScrollDeltaX, scrollResult.unusedSc
rollDeltaY); | 2260 FloatSize unusedDelta(scrollResult.unusedScrollDeltaX, scrollResult.unusedSc
rollDeltaY); |
| 2261 unusedDelta = adjustOverscoll(unusedDelta); |
| 2247 resetOverscroll(scrollResult.didScrollX, scrollResult.didScrollY); | 2262 resetOverscroll(scrollResult.didScrollX, scrollResult.didScrollY); |
| 2248 if (unusedDelta != FloatSize()) { | 2263 if (unusedDelta != FloatSize()) { |
| 2249 m_accumulatedRootOverscroll += unusedDelta; | 2264 m_accumulatedRootOverscroll += unusedDelta; |
| 2250 m_frame->chromeClient().didOverscroll(unusedDelta, m_accumulatedRootOver
scroll, position, velocity); | 2265 m_frame->chromeClient().didOverscroll(unusedDelta, m_accumulatedRootOver
scroll, position, velocity); |
| 2251 } | 2266 } |
| 2252 } | 2267 } |
| 2253 | 2268 |
| 2254 bool EventHandler::handleGestureScrollUpdate(const PlatformGestureEvent& gesture
Event) | 2269 bool EventHandler::handleGestureScrollUpdate(const PlatformGestureEvent& gesture
Event) |
| 2255 { | 2270 { |
| 2256 ASSERT(gestureEvent.type() == PlatformEvent::GestureScrollUpdate); | 2271 ASSERT(gestureEvent.type() == PlatformEvent::GestureScrollUpdate); |
| (...skipping 1666 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3923 unsigned EventHandler::accessKeyModifiers() | 3938 unsigned EventHandler::accessKeyModifiers() |
| 3924 { | 3939 { |
| 3925 #if OS(MACOSX) | 3940 #if OS(MACOSX) |
| 3926 return PlatformEvent::CtrlKey | PlatformEvent::AltKey; | 3941 return PlatformEvent::CtrlKey | PlatformEvent::AltKey; |
| 3927 #else | 3942 #else |
| 3928 return PlatformEvent::AltKey; | 3943 return PlatformEvent::AltKey; |
| 3929 #endif | 3944 #endif |
| 3930 } | 3945 } |
| 3931 | 3946 |
| 3932 } // namespace blink | 3947 } // namespace blink |
| OLD | NEW |