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 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 , m_selectionInitiationState(HaveNotStartedSelection) | 225 , m_selectionInitiationState(HaveNotStartedSelection) |
226 , m_hoverTimer(this, &EventHandler::hoverTimerFired) | 226 , m_hoverTimer(this, &EventHandler::hoverTimerFired) |
227 , m_cursorUpdateTimer(this, &EventHandler::cursorUpdateTimerFired) | 227 , m_cursorUpdateTimer(this, &EventHandler::cursorUpdateTimerFired) |
228 , m_mouseDownMayStartAutoscroll(false) | 228 , m_mouseDownMayStartAutoscroll(false) |
229 , m_fakeMouseMoveEventTimer(this, &EventHandler::fakeMouseMoveEventTimerFire
d) | 229 , m_fakeMouseMoveEventTimer(this, &EventHandler::fakeMouseMoveEventTimerFire
d) |
230 , m_svgPan(false) | 230 , m_svgPan(false) |
231 , m_resizeScrollableArea(nullptr) | 231 , m_resizeScrollableArea(nullptr) |
232 , m_eventHandlerWillResetCapturingMouseEventsNode(0) | 232 , m_eventHandlerWillResetCapturingMouseEventsNode(0) |
233 , m_clickCount(0) | 233 , m_clickCount(0) |
234 , m_shouldOnlyFireDragOverEvent(false) | 234 , m_shouldOnlyFireDragOverEvent(false) |
| 235 , m_accumulatedRootOverscroll(FloatSize()) |
235 , m_mousePositionIsUnknown(true) | 236 , m_mousePositionIsUnknown(true) |
236 , m_mouseDownTimestamp(0) | 237 , m_mouseDownTimestamp(0) |
237 , m_widgetIsLatched(false) | 238 , m_widgetIsLatched(false) |
238 , m_touchPressed(false) | 239 , m_touchPressed(false) |
239 , m_scrollGestureHandlingNode(nullptr) | 240 , m_scrollGestureHandlingNode(nullptr) |
240 , m_lastGestureScrollOverWidget(false) | 241 , m_lastGestureScrollOverWidget(false) |
241 , m_maxMouseMovedDuration(0) | 242 , m_maxMouseMovedDuration(0) |
242 , m_longTapShouldInvokeContextMenu(false) | 243 , m_longTapShouldInvokeContextMenu(false) |
243 , m_activeIntervalTimer(this, &EventHandler::activeIntervalTimerFired) | 244 , m_activeIntervalTimer(this, &EventHandler::activeIntervalTimerFired) |
244 , m_lastShowPressTimestamp(0) | 245 , m_lastShowPressTimestamp(0) |
(...skipping 671 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
916 | 917 |
917 return result; | 918 return result; |
918 } | 919 } |
919 | 920 |
920 void EventHandler::stopAutoscroll() | 921 void EventHandler::stopAutoscroll() |
921 { | 922 { |
922 if (AutoscrollController* controller = autoscrollController()) | 923 if (AutoscrollController* controller = autoscrollController()) |
923 controller->stopAutoscroll(); | 924 controller->stopAutoscroll(); |
924 } | 925 } |
925 | 926 |
926 bool EventHandler::scroll(ScrollDirection direction, ScrollGranularity granulari
ty, Node* startNode, Node** stopNode, float delta, IntPoint absolutePoint) | 927 ScrollResultOneDimensional EventHandler::scroll(ScrollDirection direction, Scrol
lGranularity granularity, Node* startNode, Node** stopNode, float delta, IntPoin
t absolutePoint) |
927 { | 928 { |
928 if (!delta) | 929 if (!delta) |
929 return false; | 930 return ScrollResultOneDimensional(false); |
930 | 931 |
931 Node* node = startNode; | 932 Node* node = startNode; |
932 | 933 |
933 if (!node) | 934 if (!node) |
934 node = m_frame->document()->focusedElement(); | 935 node = m_frame->document()->focusedElement(); |
935 | 936 |
936 if (!node) | 937 if (!node) |
937 node = m_mousePressNode.get(); | 938 node = m_mousePressNode.get(); |
938 | 939 |
939 if (!node || !node->layoutObject()) | 940 if (!node || !node->layoutObject()) |
940 return false; | 941 return ScrollResultOneDimensional(false, delta); |
941 | 942 |
942 LayoutBox* curBox = node->layoutObject()->enclosingBox(); | 943 LayoutBox* curBox = node->layoutObject()->enclosingBox(); |
943 while (curBox && !curBox->isLayoutView()) { | 944 while (curBox && !curBox->isLayoutView()) { |
944 ScrollDirectionPhysical physicalDirection = toPhysicalDirection( | 945 ScrollDirectionPhysical physicalDirection = toPhysicalDirection( |
945 direction, curBox->isHorizontalWritingMode(), curBox->style()->isFli
ppedBlocksWritingMode()); | 946 direction, curBox->isHorizontalWritingMode(), curBox->style()->isFli
ppedBlocksWritingMode()); |
946 | 947 |
947 // If we're at the stopNode, we should try to scroll it but we shouldn't
bubble past it | 948 // If we're at the stopNode, we should try to scroll it but we shouldn't
bubble past it |
948 bool shouldStopBubbling = stopNode && *stopNode && curBox->node() == *st
opNode; | 949 bool shouldStopBubbling = stopNode && *stopNode && curBox->node() == *st
opNode; |
949 bool didScroll = curBox->scroll(physicalDirection, granularity, delta); | 950 ScrollResultOneDimensional result = curBox->scroll(physicalDirection, gr
anularity, delta); |
950 | 951 |
951 if (didScroll && stopNode) | 952 if (result.didScroll && stopNode) |
952 *stopNode = curBox->node(); | 953 *stopNode = curBox->node(); |
953 | 954 |
954 if (didScroll || shouldStopBubbling) { | 955 if (result.didScroll || shouldStopBubbling) { |
955 setFrameWasScrolledByUser(); | 956 setFrameWasScrolledByUser(); |
956 return true; | 957 result.didScroll = true; |
| 958 return result; |
957 } | 959 } |
958 | 960 |
959 curBox = curBox->containingBlock(); | 961 curBox = curBox->containingBlock(); |
960 } | 962 } |
961 | 963 |
962 return false; | 964 return ScrollResultOneDimensional(false, delta); |
963 } | 965 } |
964 | 966 |
965 void EventHandler::customizedScroll(const Node& startNode, ScrollState& scrollSt
ate) | 967 void EventHandler::customizedScroll(const Node& startNode, ScrollState& scrollSt
ate) |
966 { | 968 { |
967 if (scrollState.fullyConsumed()) | 969 if (scrollState.fullyConsumed()) |
968 return; | 970 return; |
969 | 971 |
970 if (m_currentScrollChain.isEmpty()) | 972 if (m_currentScrollChain.isEmpty()) |
971 recomputeScrollChain(*m_frame, startNode, m_currentScrollChain); | 973 recomputeScrollChain(*m_frame, startNode, m_currentScrollChain); |
972 scrollState.setScrollChain(m_currentScrollChain); | 974 scrollState.setScrollChain(m_currentScrollChain); |
973 scrollState.distributeToScrollChainDescendant(); | 975 scrollState.distributeToScrollChainDescendant(); |
974 } | 976 } |
975 | 977 |
976 bool EventHandler::bubblingScroll(ScrollDirection direction, ScrollGranularity g
ranularity, Node* startingNode) | 978 bool EventHandler::bubblingScroll(ScrollDirection direction, ScrollGranularity g
ranularity, Node* startingNode) |
977 { | 979 { |
978 // The layout needs to be up to date to determine if we can scroll. We may b
e | 980 // The layout needs to be up to date to determine if we can scroll. We may b
e |
979 // here because of an onLoad event, in which case the final layout hasn't be
en performed yet. | 981 // here because of an onLoad event, in which case the final layout hasn't be
en performed yet. |
980 m_frame->document()->updateLayoutIgnorePendingStylesheets(); | 982 m_frame->document()->updateLayoutIgnorePendingStylesheets(); |
981 // FIXME: enable scroll customization in this case. See crbug.com/410974. | 983 // FIXME: enable scroll customization in this case. See crbug.com/410974. |
982 if (scroll(direction, granularity, startingNode)) | 984 if (scroll(direction, granularity, startingNode).didScroll) |
983 return true; | 985 return true; |
984 LocalFrame* frame = m_frame; | 986 LocalFrame* frame = m_frame; |
985 FrameView* view = frame->view(); | 987 FrameView* view = frame->view(); |
986 if (view) { | 988 if (view) { |
987 ScrollDirectionPhysical physicalDirection = | 989 ScrollDirectionPhysical physicalDirection = |
988 toPhysicalDirection(direction, view->isVerticalDocument(), view->isF
lippedDocument()); | 990 toPhysicalDirection(direction, view->isVerticalDocument(), view->isF
lippedDocument()); |
989 if (view->scrollableArea()->userScroll(physicalDirection, granularity))
{ | 991 if (view->scrollableArea()->userScroll(physicalDirection, granularity).d
idScroll) { |
990 setFrameWasScrolledByUser(); | 992 setFrameWasScrolledByUser(); |
991 return true; | 993 return true; |
992 } | 994 } |
993 } | 995 } |
994 | 996 |
995 Frame* parentFrame = frame->tree().parent(); | 997 Frame* parentFrame = frame->tree().parent(); |
996 if (!parentFrame || !parentFrame->isLocalFrame()) | 998 if (!parentFrame || !parentFrame->isLocalFrame()) |
997 return false; | 999 return false; |
998 // FIXME: Broken for OOPI. | 1000 // FIXME: Broken for OOPI. |
999 return toLocalFrame(parentFrame)->eventHandler().bubblingScroll(direction, g
ranularity, m_frame->deprecatedLocalOwner()); | 1001 return toLocalFrame(parentFrame)->eventHandler().bubblingScroll(direction, g
ranularity, m_frame->deprecatedLocalOwner()); |
(...skipping 1170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2170 if (node && !node->dispatchWheelEvent(event)) | 2172 if (node && !node->dispatchWheelEvent(event)) |
2171 RETURN_WHEEL_EVENT_HANDLED(); | 2173 RETURN_WHEEL_EVENT_HANDLED(); |
2172 } | 2174 } |
2173 | 2175 |
2174 // We do another check on the frame view because the event handler can run | 2176 // We do another check on the frame view because the event handler can run |
2175 // JS which results in the frame getting destroyed. | 2177 // JS which results in the frame getting destroyed. |
2176 view = m_frame->view(); | 2178 view = m_frame->view(); |
2177 if (!view) | 2179 if (!view) |
2178 return false; | 2180 return false; |
2179 | 2181 |
2180 if (view->scrollableArea()->handleWheel(event).didScroll) | 2182 if (view->scrollableArea()->handleWheel(event).didScroll()) |
2181 RETURN_WHEEL_EVENT_HANDLED(); | 2183 RETURN_WHEEL_EVENT_HANDLED(); |
2182 | 2184 |
2183 return false; | 2185 return false; |
2184 #undef RETURN_WHEEL_EVENT_HANDLED | 2186 #undef RETURN_WHEEL_EVENT_HANDLED |
2185 } | 2187 } |
2186 | 2188 |
2187 void EventHandler::defaultWheelEventHandler(Node* startNode, WheelEvent* wheelEv
ent) | 2189 void EventHandler::defaultWheelEventHandler(Node* startNode, WheelEvent* wheelEv
ent) |
2188 { | 2190 { |
2189 if (!startNode || !wheelEvent) | 2191 if (!startNode || !wheelEvent) |
2190 return; | 2192 return; |
2191 | 2193 |
2192 // When the wheelEvent do not scroll, we trigger zoom in/out instead. | 2194 // When the wheelEvent do not scroll, we trigger zoom in/out instead. |
2193 if (!wheelEvent->canScroll()) | 2195 if (!wheelEvent->canScroll()) |
2194 return; | 2196 return; |
2195 | 2197 |
2196 Node* stopNode = m_previousWheelScrolledNode.get(); | 2198 Node* stopNode = m_previousWheelScrolledNode.get(); |
2197 ScrollGranularity granularity = wheelGranularityToScrollGranularity(wheelEve
nt); | 2199 ScrollGranularity granularity = wheelGranularityToScrollGranularity(wheelEve
nt); |
2198 IntPoint absolutePosition = roundedIntPoint(wheelEvent->absoluteLocation()); | 2200 IntPoint absolutePosition = roundedIntPoint(wheelEvent->absoluteLocation()); |
2199 | 2201 |
2200 // Break up into two scrolls if we need to. Diagonal movement on | 2202 // Break up into two scrolls if we need to. Diagonal movement on |
2201 // a MacBook pro is an example of a 2-dimensional mouse wheel event (where b
oth deltaX and deltaY can be set). | 2203 // a MacBook pro is an example of a 2-dimensional mouse wheel event (where b
oth deltaX and deltaY can be set). |
2202 | 2204 |
2203 // FIXME: enable scroll customization in this case. See crbug.com/410974. | 2205 // FIXME: enable scroll customization in this case. See crbug.com/410974. |
2204 if (wheelEvent->railsMode() != Event::RailsModeVertical | 2206 if (wheelEvent->railsMode() != Event::RailsModeVertical |
2205 && scroll(ScrollRightIgnoringWritingMode, granularity, startNode, &stopN
ode, wheelEvent->deltaX(), absolutePosition)) | 2207 && scroll(ScrollRightIgnoringWritingMode, granularity, startNode, &stopN
ode, wheelEvent->deltaX(), absolutePosition).didScroll) |
2206 wheelEvent->setDefaultHandled(); | 2208 wheelEvent->setDefaultHandled(); |
2207 | 2209 |
2208 if (wheelEvent->railsMode() != Event::RailsModeHorizontal | 2210 if (wheelEvent->railsMode() != Event::RailsModeHorizontal |
2209 && scroll(ScrollDownIgnoringWritingMode, granularity, startNode, &stopNo
de, wheelEvent->deltaY(), absolutePosition)) | 2211 && scroll(ScrollDownIgnoringWritingMode, granularity, startNode, &stopNo
de, wheelEvent->deltaY(), absolutePosition).didScroll) |
2210 wheelEvent->setDefaultHandled(); | 2212 wheelEvent->setDefaultHandled(); |
2211 | 2213 |
2212 if (!m_latchedWheelEventNode) | 2214 if (!m_latchedWheelEventNode) |
2213 m_previousWheelScrolledNode = stopNode; | 2215 m_previousWheelScrolledNode = stopNode; |
2214 } | 2216 } |
2215 | 2217 |
2216 bool EventHandler::handleGestureShowPress() | 2218 bool EventHandler::handleGestureShowPress() |
2217 { | 2219 { |
2218 m_lastShowPressTimestamp = WTF::currentTime(); | 2220 m_lastShowPressTimestamp = WTF::currentTime(); |
2219 | 2221 |
(...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2600 if (node) { | 2602 if (node) { |
2601 passScrollGestureEventToWidget(gestureEvent, node->layoutObject()); | 2603 passScrollGestureEventToWidget(gestureEvent, node->layoutObject()); |
2602 if (RuntimeEnabledFeatures::scrollCustomizationEnabled()) { | 2604 if (RuntimeEnabledFeatures::scrollCustomizationEnabled()) { |
2603 RefPtrWillBeRawPtr<ScrollState> scrollState = ScrollState::create( | 2605 RefPtrWillBeRawPtr<ScrollState> scrollState = ScrollState::create( |
2604 0, 0, 0, 0, 0, gestureEvent.inertial(), /* isBeginning */ | 2606 0, 0, 0, 0, 0, gestureEvent.inertial(), /* isBeginning */ |
2605 false, /* isEnding */ true, /* fromUserInput */ true); | 2607 false, /* isEnding */ true, /* fromUserInput */ true); |
2606 customizedScroll(*node.get(), *scrollState); | 2608 customizedScroll(*node.get(), *scrollState); |
2607 } | 2609 } |
2608 } | 2610 } |
2609 | 2611 |
2610 clearGestureScrollNodes(); | 2612 clearGestureScrollState(); |
2611 return false; | 2613 return false; |
2612 } | 2614 } |
2613 | 2615 |
2614 bool EventHandler::handleGestureScrollBegin(const PlatformGestureEvent& gestureE
vent) | 2616 bool EventHandler::handleGestureScrollBegin(const PlatformGestureEvent& gestureE
vent) |
2615 { | 2617 { |
2616 Document* document = m_frame->document(); | 2618 Document* document = m_frame->document(); |
2617 if (!document->layoutView()) | 2619 if (!document->layoutView()) |
2618 return false; | 2620 return false; |
2619 | 2621 |
2620 FrameView* view = m_frame->view(); | 2622 FrameView* view = m_frame->view(); |
(...skipping 20 matching lines...) Expand all Loading... |
2641 0, 0, 0, 0, 0, /* inInertialPhase */ false, /* isBeginning */ | 2643 0, 0, 0, 0, 0, /* inInertialPhase */ false, /* isBeginning */ |
2642 true, /* isEnding */ false, /* fromUserInput */ true); | 2644 true, /* isEnding */ false, /* fromUserInput */ true); |
2643 customizedScroll(*m_scrollGestureHandlingNode.get(), *scrollState); | 2645 customizedScroll(*m_scrollGestureHandlingNode.get(), *scrollState); |
2644 } else { | 2646 } else { |
2645 if (m_frame->isMainFrame()) | 2647 if (m_frame->isMainFrame()) |
2646 m_frame->host()->topControls().scrollBegin(); | 2648 m_frame->host()->topControls().scrollBegin(); |
2647 } | 2649 } |
2648 return true; | 2650 return true; |
2649 } | 2651 } |
2650 | 2652 |
| 2653 void EventHandler::resetOverscroll(bool didScrollX, bool didScrollY) |
| 2654 { |
| 2655 if (didScrollX) |
| 2656 m_accumulatedRootOverscroll.setWidth(0); |
| 2657 if (didScrollY) |
| 2658 m_accumulatedRootOverscroll.setHeight(0); |
| 2659 } |
| 2660 |
| 2661 void EventHandler::handleOverscroll(const ScrollResult& scrollResult, const Plat
formGestureEvent& gestureEvent) |
| 2662 { |
| 2663 if (m_frame->isMainFrame() && m_frame->view() && m_frame->view()->scrollable
Area()) { |
| 2664 ScrollableArea* scrollablearea = m_frame->view()->scrollableArea(); |
| 2665 // Set unusedDelta if axis is scrollable, else set 0 to ensure overflow
is not reported on non-scrollable axes. |
| 2666 FloatSize unusedDelta(scrollablearea->scrollSize(HorizontalScrollbar) ?
scrollResult.unusedScrollDeltaX : 0, scrollablearea->scrollSize(VerticalScrollba
r) ? scrollResult.unusedScrollDeltaY : 0); |
| 2667 resetOverscroll(scrollResult.didScrollX, scrollResult.didScrollY); |
| 2668 if (unusedDelta != FloatSize()) { |
| 2669 m_accumulatedRootOverscroll += unusedDelta; |
| 2670 FloatPoint position = FloatPoint(gestureEvent.position().x(), gestur
eEvent.position().y()); |
| 2671 FloatSize velocity = FloatSize(gestureEvent.velocityX(), gestureEven
t.velocityY()); |
| 2672 m_frame->chromeClient().didOverscroll(unusedDelta, m_accumulatedRoot
Overscroll, position, velocity); |
| 2673 } |
| 2674 } |
| 2675 } |
| 2676 |
2651 bool EventHandler::handleGestureScrollUpdate(const PlatformGestureEvent& gesture
Event) | 2677 bool EventHandler::handleGestureScrollUpdate(const PlatformGestureEvent& gesture
Event) |
2652 { | 2678 { |
2653 ASSERT(gestureEvent.type() == PlatformEvent::GestureScrollUpdate); | 2679 ASSERT(gestureEvent.type() == PlatformEvent::GestureScrollUpdate); |
2654 | 2680 |
2655 FloatSize delta(gestureEvent.deltaX(), gestureEvent.deltaY()); | 2681 FloatSize delta(gestureEvent.deltaX(), gestureEvent.deltaY()); |
2656 if (delta.isZero()) | 2682 if (delta.isZero()) |
2657 return false; | 2683 return false; |
2658 | 2684 |
2659 Node* node = m_scrollGestureHandlingNode.get(); | 2685 Node* node = m_scrollGestureHandlingNode.get(); |
2660 if (node) { | 2686 if (node) { |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2700 m_previousGestureScrolledNode = scrollState->currentNativeScrollingE
lement(); | 2726 m_previousGestureScrolledNode = scrollState->currentNativeScrollingE
lement(); |
2701 m_deltaConsumedForScrollSequence = scrollState->deltaConsumedForScro
llSequence(); | 2727 m_deltaConsumedForScrollSequence = scrollState->deltaConsumedForScro
llSequence(); |
2702 scrolled = scrollState->deltaX() != gestureEvent.deltaX() | 2728 scrolled = scrollState->deltaX() != gestureEvent.deltaX() |
2703 || scrollState->deltaY() != gestureEvent.deltaY(); | 2729 || scrollState->deltaY() != gestureEvent.deltaY(); |
2704 } else { | 2730 } else { |
2705 if (gestureEvent.preventPropagation()) | 2731 if (gestureEvent.preventPropagation()) |
2706 stopNode = m_previousGestureScrolledNode.get(); | 2732 stopNode = m_previousGestureScrolledNode.get(); |
2707 | 2733 |
2708 // First try to scroll the closest scrollable LayoutBox ancestor of
|node|. | 2734 // First try to scroll the closest scrollable LayoutBox ancestor of
|node|. |
2709 ScrollGranularity granularity = ScrollByPrecisePixel; | 2735 ScrollGranularity granularity = ScrollByPrecisePixel; |
2710 bool horizontalScroll = scroll(ScrollLeftIgnoringWritingMode, granul
arity, node, &stopNode, delta.width()); | 2736 ScrollResultOneDimensional result = scroll(ScrollLeftIgnoringWriting
Mode, granularity, node, &stopNode, delta.width()); |
| 2737 bool horizontalScroll = result.didScroll; |
2711 if (!gestureEvent.preventPropagation()) | 2738 if (!gestureEvent.preventPropagation()) |
2712 stopNode = nullptr; | 2739 stopNode = nullptr; |
2713 bool verticalScroll = scroll(ScrollUpIgnoringWritingMode, granularit
y, node, &stopNode, delta.height()); | 2740 result = scroll(ScrollUpIgnoringWritingMode, granularity, node, &sto
pNode, delta.height()); |
| 2741 bool verticalScroll = result.didScroll; |
2714 scrolled = horizontalScroll || verticalScroll; | 2742 scrolled = horizontalScroll || verticalScroll; |
2715 | 2743 |
2716 if (gestureEvent.preventPropagation()) | 2744 if (gestureEvent.preventPropagation()) |
2717 m_previousGestureScrolledNode = stopNode; | 2745 m_previousGestureScrolledNode = stopNode; |
| 2746 |
| 2747 resetOverscroll(horizontalScroll, verticalScroll); |
2718 } | 2748 } |
2719 if (scrolled) { | 2749 if (scrolled) { |
2720 setFrameWasScrolledByUser(); | 2750 setFrameWasScrolledByUser(); |
2721 return true; | 2751 return true; |
2722 } | 2752 } |
2723 } | 2753 } |
2724 | 2754 |
2725 if (RuntimeEnabledFeatures::scrollCustomizationEnabled()) | 2755 if (RuntimeEnabledFeatures::scrollCustomizationEnabled()) |
2726 return false; | 2756 return false; |
2727 | 2757 |
2728 // Try to scroll the frame view. | 2758 // Try to scroll the frame view. |
2729 if (m_frame->applyScrollDelta(delta, false)) { | 2759 ScrollResult scrollResult = m_frame->applyScrollDelta(delta, false); |
| 2760 handleOverscroll(scrollResult, gestureEvent); |
| 2761 if (scrollResult.didScroll()) { |
2730 setFrameWasScrolledByUser(); | 2762 setFrameWasScrolledByUser(); |
2731 return true; | 2763 return true; |
2732 } | 2764 } |
2733 | 2765 |
2734 return false; | 2766 return false; |
2735 } | 2767 } |
2736 | 2768 |
2737 void EventHandler::clearGestureScrollNodes() | 2769 void EventHandler::clearGestureScrollState() |
2738 { | 2770 { |
2739 m_scrollGestureHandlingNode = nullptr; | 2771 m_scrollGestureHandlingNode = nullptr; |
2740 m_previousGestureScrolledNode = nullptr; | 2772 m_previousGestureScrolledNode = nullptr; |
2741 m_deltaConsumedForScrollSequence = false; | 2773 m_deltaConsumedForScrollSequence = false; |
2742 m_currentScrollChain.clear(); | 2774 m_currentScrollChain.clear(); |
| 2775 m_accumulatedRootOverscroll = FloatSize(); |
2743 } | 2776 } |
2744 | 2777 |
2745 bool EventHandler::isScrollbarHandlingGestures() const | 2778 bool EventHandler::isScrollbarHandlingGestures() const |
2746 { | 2779 { |
2747 return m_scrollbarHandlingScrollGesture.get(); | 2780 return m_scrollbarHandlingScrollGesture.get(); |
2748 } | 2781 } |
2749 | 2782 |
2750 bool EventHandler::shouldApplyTouchAdjustment(const PlatformGestureEvent& event)
const | 2783 bool EventHandler::shouldApplyTouchAdjustment(const PlatformGestureEvent& event)
const |
2751 { | 2784 { |
2752 if (m_frame->settings() && !m_frame->settings()->touchAdjustmentEnabled()) | 2785 if (m_frame->settings() && !m_frame->settings()->touchAdjustmentEnabled()) |
(...skipping 882 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3635 void EventHandler::defaultSpaceEventHandler(KeyboardEvent* event) | 3668 void EventHandler::defaultSpaceEventHandler(KeyboardEvent* event) |
3636 { | 3669 { |
3637 ASSERT(event->type() == EventTypeNames::keypress); | 3670 ASSERT(event->type() == EventTypeNames::keypress); |
3638 | 3671 |
3639 if (event->ctrlKey() || event->metaKey() || event->altKey()) | 3672 if (event->ctrlKey() || event->metaKey() || event->altKey()) |
3640 return; | 3673 return; |
3641 | 3674 |
3642 ScrollDirection direction = event->shiftKey() ? ScrollBlockDirectionBackward
: ScrollBlockDirectionForward; | 3675 ScrollDirection direction = event->shiftKey() ? ScrollBlockDirectionBackward
: ScrollBlockDirectionForward; |
3643 | 3676 |
3644 // FIXME: enable scroll customization in this case. See crbug.com/410974. | 3677 // FIXME: enable scroll customization in this case. See crbug.com/410974. |
3645 if (scroll(direction, ScrollByPage)) { | 3678 if (scroll(direction, ScrollByPage).didScroll) { |
3646 event->setDefaultHandled(); | 3679 event->setDefaultHandled(); |
3647 return; | 3680 return; |
3648 } | 3681 } |
3649 | 3682 |
3650 FrameView* view = m_frame->view(); | 3683 FrameView* view = m_frame->view(); |
3651 if (!view) | 3684 if (!view) |
3652 return; | 3685 return; |
3653 | 3686 |
3654 ScrollDirectionPhysical physicalDirection = | 3687 ScrollDirectionPhysical physicalDirection = |
3655 toPhysicalDirection(direction, view->isVerticalDocument(), view->isFlipp
edDocument()); | 3688 toPhysicalDirection(direction, view->isVerticalDocument(), view->isFlipp
edDocument()); |
3656 | 3689 |
3657 if (view->scrollableArea()->userScroll(physicalDirection, ScrollByPage)) | 3690 if (view->scrollableArea()->userScroll(physicalDirection, ScrollByPage).didS
croll) |
3658 event->setDefaultHandled(); | 3691 event->setDefaultHandled(); |
3659 } | 3692 } |
3660 | 3693 |
3661 void EventHandler::defaultBackspaceEventHandler(KeyboardEvent* event) | 3694 void EventHandler::defaultBackspaceEventHandler(KeyboardEvent* event) |
3662 { | 3695 { |
3663 ASSERT(event->type() == EventTypeNames::keydown); | 3696 ASSERT(event->type() == EventTypeNames::keydown); |
3664 | 3697 |
3665 if (event->ctrlKey() || event->metaKey() || event->altKey()) | 3698 if (event->ctrlKey() || event->metaKey() || event->altKey()) |
3666 return; | 3699 return; |
3667 | 3700 |
(...skipping 502 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4170 unsigned EventHandler::accessKeyModifiers() | 4203 unsigned EventHandler::accessKeyModifiers() |
4171 { | 4204 { |
4172 #if OS(MACOSX) | 4205 #if OS(MACOSX) |
4173 return PlatformEvent::CtrlKey | PlatformEvent::AltKey; | 4206 return PlatformEvent::CtrlKey | PlatformEvent::AltKey; |
4174 #else | 4207 #else |
4175 return PlatformEvent::AltKey; | 4208 return PlatformEvent::AltKey; |
4176 #endif | 4209 #endif |
4177 } | 4210 } |
4178 | 4211 |
4179 } // namespace blink | 4212 } // namespace blink |
OLD | NEW |