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 1764 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1775 if (node && !node->dispatchWheelEvent(event)) | 1775 if (node && !node->dispatchWheelEvent(event)) |
1776 RETURN_WHEEL_EVENT_HANDLED(); | 1776 RETURN_WHEEL_EVENT_HANDLED(); |
1777 } | 1777 } |
1778 | 1778 |
1779 // We do another check on the frame view because the event handler can run | 1779 // We do another check on the frame view because the event handler can run |
1780 // JS which results in the frame getting destroyed. | 1780 // JS which results in the frame getting destroyed. |
1781 view = m_frame->view(); | 1781 view = m_frame->view(); |
1782 if (!view) | 1782 if (!view) |
1783 return false; | 1783 return false; |
1784 | 1784 |
1785 if (view->scrollableArea()->handleWheel(event).didScroll()) | 1785 ScrollResult scrollResult = view->scrollableArea()->handleWheel(event); |
1786 #if defined(WTF_OS_MACOSX) | |
bokan
2015/06/23 16:20:45
This should be based on a setting rather than an #
| |
1787 handleOverscroll(scrollResult); | |
1788 #endif | |
1789 | |
1790 if (scrollResult.didScroll()) | |
1786 RETURN_WHEEL_EVENT_HANDLED(); | 1791 RETURN_WHEEL_EVENT_HANDLED(); |
1787 | 1792 |
1788 return false; | 1793 return false; |
1789 #undef RETURN_WHEEL_EVENT_HANDLED | 1794 #undef RETURN_WHEEL_EVENT_HANDLED |
1790 } | 1795 } |
1791 | 1796 |
1792 void EventHandler::defaultWheelEventHandler(Node* startNode, WheelEvent* wheelEv ent) | 1797 void EventHandler::defaultWheelEventHandler(Node* startNode, WheelEvent* wheelEv ent) |
1793 { | 1798 { |
1794 if (!startNode || !wheelEvent) | 1799 if (!startNode || !wheelEvent) |
1795 return; | 1800 return; |
(...skipping 452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2248 } | 2253 } |
2249 | 2254 |
2250 void EventHandler::resetOverscroll(bool didScrollX, bool didScrollY) | 2255 void EventHandler::resetOverscroll(bool didScrollX, bool didScrollY) |
2251 { | 2256 { |
2252 if (didScrollX) | 2257 if (didScrollX) |
2253 m_accumulatedRootOverscroll.setWidth(0); | 2258 m_accumulatedRootOverscroll.setWidth(0); |
2254 if (didScrollY) | 2259 if (didScrollY) |
2255 m_accumulatedRootOverscroll.setHeight(0); | 2260 m_accumulatedRootOverscroll.setHeight(0); |
2256 } | 2261 } |
2257 | 2262 |
2258 void EventHandler::handleOverscroll(const ScrollResult& scrollResult, const Plat formGestureEvent& gestureEvent) | 2263 void EventHandler::handleOverscroll(const ScrollResult& scrollResult, const Floa tPoint& position, const FloatSize& velocity) |
2259 { | 2264 { |
2260 if (m_frame->isMainFrame() && m_frame->view() && m_frame->view()->scrollable Area()) { | 2265 if (m_frame->isMainFrame() && m_frame->view() && m_frame->view()->scrollable Area()) { |
2261 ScrollableArea* scrollablearea = m_frame->view()->scrollableArea(); | 2266 ScrollableArea* scrollablearea = m_frame->view()->scrollableArea(); |
2262 // Set unusedDelta if axis is scrollable, else set 0 to ensure overflow is not reported on non-scrollable axes. | 2267 // Set unusedDelta if axis is scrollable, else set 0 to ensure overflow is not reported on non-scrollable axes. |
2263 FloatSize unusedDelta(scrollablearea->scrollSize(HorizontalScrollbar) ? scrollResult.unusedScrollDeltaX : 0, scrollablearea->scrollSize(VerticalScrollba r) ? scrollResult.unusedScrollDeltaY : 0); | 2268 FloatSize unusedDelta(scrollablearea->scrollSize(HorizontalScrollbar) ? scrollResult.unusedScrollDeltaX : 0, scrollablearea->scrollSize(VerticalScrollba r) ? scrollResult.unusedScrollDeltaY : 0); |
2264 resetOverscroll(scrollResult.didScrollX, scrollResult.didScrollY); | 2269 resetOverscroll(scrollResult.didScrollX, scrollResult.didScrollY); |
2265 if (unusedDelta != FloatSize()) { | 2270 if (unusedDelta != FloatSize()) { |
2266 m_accumulatedRootOverscroll += unusedDelta; | 2271 m_accumulatedRootOverscroll += unusedDelta; |
2267 FloatPoint position = FloatPoint(gestureEvent.position().x(), gestur eEvent.position().y()); | |
2268 FloatSize velocity = FloatSize(gestureEvent.velocityX(), gestureEven t.velocityY()); | |
2269 m_frame->chromeClient().didOverscroll(unusedDelta, m_accumulatedRoot Overscroll, position, velocity); | 2272 m_frame->chromeClient().didOverscroll(unusedDelta, m_accumulatedRoot Overscroll, position, velocity); |
2270 } | 2273 } |
2271 } | 2274 } |
2272 } | 2275 } |
2273 | 2276 |
2274 bool EventHandler::handleGestureScrollUpdate(const PlatformGestureEvent& gesture Event) | 2277 bool EventHandler::handleGestureScrollUpdate(const PlatformGestureEvent& gesture Event) |
2275 { | 2278 { |
2276 ASSERT(gestureEvent.type() == PlatformEvent::GestureScrollUpdate); | 2279 ASSERT(gestureEvent.type() == PlatformEvent::GestureScrollUpdate); |
2277 | 2280 |
2278 FloatSize delta(gestureEvent.deltaX(), gestureEvent.deltaY()); | 2281 FloatSize delta(gestureEvent.deltaX(), gestureEvent.deltaY()); |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2347 setFrameWasScrolledByUser(); | 2350 setFrameWasScrolledByUser(); |
2348 return true; | 2351 return true; |
2349 } | 2352 } |
2350 } | 2353 } |
2351 | 2354 |
2352 if (RuntimeEnabledFeatures::scrollCustomizationEnabled()) | 2355 if (RuntimeEnabledFeatures::scrollCustomizationEnabled()) |
2353 return false; | 2356 return false; |
2354 | 2357 |
2355 // Try to scroll the frame view. | 2358 // Try to scroll the frame view. |
2356 ScrollResult scrollResult = m_frame->applyScrollDelta(delta, false); | 2359 ScrollResult scrollResult = m_frame->applyScrollDelta(delta, false); |
2357 handleOverscroll(scrollResult, gestureEvent); | 2360 FloatPoint position = FloatPoint(gestureEvent.position().x(), gestureEvent.p osition().y()); |
2361 FloatSize velocity = FloatSize(gestureEvent.velocityX(), gestureEvent.veloci tyY()); | |
2362 handleOverscroll(scrollResult, position, velocity); | |
2358 if (scrollResult.didScroll()) { | 2363 if (scrollResult.didScroll()) { |
2359 setFrameWasScrolledByUser(); | 2364 setFrameWasScrolledByUser(); |
2360 return true; | 2365 return true; |
2361 } | 2366 } |
2362 | 2367 |
2363 return false; | 2368 return false; |
2364 } | 2369 } |
2365 | 2370 |
2366 void EventHandler::clearGestureScrollState() | 2371 void EventHandler::clearGestureScrollState() |
2367 { | 2372 { |
(...skipping 1522 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3890 unsigned EventHandler::accessKeyModifiers() | 3895 unsigned EventHandler::accessKeyModifiers() |
3891 { | 3896 { |
3892 #if OS(MACOSX) | 3897 #if OS(MACOSX) |
3893 return PlatformEvent::CtrlKey | PlatformEvent::AltKey; | 3898 return PlatformEvent::CtrlKey | PlatformEvent::AltKey; |
3894 #else | 3899 #else |
3895 return PlatformEvent::AltKey; | 3900 return PlatformEvent::AltKey; |
3896 #endif | 3901 #endif |
3897 } | 3902 } |
3898 | 3903 |
3899 } // namespace blink | 3904 } // namespace blink |
OLD | NEW |