Chromium Code Reviews| 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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 90 #include "platform/heap/Handle.h" | 90 #include "platform/heap/Handle.h" |
| 91 #include "platform/scroll/ScrollAnimator.h" | 91 #include "platform/scroll/ScrollAnimator.h" |
| 92 #include "platform/scroll/Scrollbar.h" | 92 #include "platform/scroll/Scrollbar.h" |
| 93 #include "wtf/Assertions.h" | 93 #include "wtf/Assertions.h" |
| 94 #include "wtf/CurrentTime.h" | 94 #include "wtf/CurrentTime.h" |
| 95 #include "wtf/StdLibExtras.h" | 95 #include "wtf/StdLibExtras.h" |
| 96 #include "wtf/TemporaryChange.h" | 96 #include "wtf/TemporaryChange.h" |
| 97 | 97 |
| 98 namespace blink { | 98 namespace blink { |
| 99 | 99 |
| 100 // Report Overscroll if OverscrollDelta is greater than minimumOverscrollDelta | |
| 101 // to maintain consistency as did in compositor. | |
| 102 static const float minimumOverscrollDelta = 0.1; | |
|
majidvp
2015/07/09 18:01:18
Please move this next to other constants.
MuVen
2015/07/09 18:10:06
Done.
| |
| 103 | |
| 104 static inline FloatSize adjustOverscoll(FloatSize unusedDelta) | |
|
majidvp
2015/07/09 18:01:18
Given that there is a single member func that uses
MuVen
2015/07/09 18:10:06
Done.
| |
| 105 { | |
| 106 if (std::abs(unusedDelta.width()) < minimumOverscrollDelta) | |
| 107 unusedDelta.setWidth(0); | |
| 108 if (std::abs(unusedDelta.height()) < minimumOverscrollDelta) | |
| 109 unusedDelta.setHeight(0); | |
| 110 | |
| 111 return unusedDelta; | |
| 112 } | |
| 113 | |
| 100 using namespace HTMLNames; | 114 using namespace HTMLNames; |
| 101 | 115 |
| 102 // The link drag hysteresis is much larger than the others because there | 116 // The link drag hysteresis is much larger than the others because there |
| 103 // needs to be enough space to cancel the link press without starting a link dra g, | 117 // needs to be enough space to cancel the link press without starting a link dra g, |
| 104 // and because dragging links is rare. | 118 // and because dragging links is rare. |
| 105 static const int LinkDragHysteresis = 40; | 119 static const int LinkDragHysteresis = 40; |
| 106 static const int ImageDragHysteresis = 5; | 120 static const int ImageDragHysteresis = 5; |
| 107 static const int TextDragHysteresis = 3; | 121 static const int TextDragHysteresis = 3; |
| 108 static const int GeneralDragHysteresis = 3; | 122 static const int GeneralDragHysteresis = 3; |
| 109 | 123 |
| (...skipping 2127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2237 { | 2251 { |
| 2238 if (didScrollX) | 2252 if (didScrollX) |
| 2239 m_accumulatedRootOverscroll.setWidth(0); | 2253 m_accumulatedRootOverscroll.setWidth(0); |
| 2240 if (didScrollY) | 2254 if (didScrollY) |
| 2241 m_accumulatedRootOverscroll.setHeight(0); | 2255 m_accumulatedRootOverscroll.setHeight(0); |
| 2242 } | 2256 } |
| 2243 | 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 |