Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(262)

Side by Side Diff: third_party/WebKit/Source/core/input/EventHandler.cpp

Issue 1840113005: Move viewport actions into an ApplyScroll callback. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 case PlatformTouchPoint::TouchMoved: 123 case PlatformTouchPoint::TouchMoved:
124 return EventTypeNames::touchmove; 124 return EventTypeNames::touchmove;
125 case PlatformTouchPoint::TouchStationary: 125 case PlatformTouchPoint::TouchStationary:
126 // Fall through to default 126 // Fall through to default
127 default: 127 default:
128 ASSERT_NOT_REACHED(); 128 ASSERT_NOT_REACHED();
129 return emptyAtom; 129 return emptyAtom;
130 } 130 }
131 } 131 }
132 132
133 void computeScrollChainForOne(Node& node, std::deque<int>& scrollChain)
tdresser 2016/04/05 19:31:12 Let's be a bit more verbose, and go with "computeS
bokan 2016/04/06 15:21:01 Both done.
134 {
135 scrollChain.clear();
136
137 ASSERT(node.layoutObject());
138 Element* element = toElement(&node);
139
140 scrollChain.push_front(DOMNodeIds::idForNode(element));
141 }
142
143 void recomputeScrollChain(const LocalFrame& frame, const Node& startNode,
144 std::deque<int>& scrollChain)
145 {
146 scrollChain.clear();
147
148 ASSERT(startNode.layoutObject());
149 LayoutBox* curBox = startNode.layoutObject()->enclosingBox();
150
151 // Scrolling propagates along the containing block chain.
152 while (curBox && !curBox->isLayoutView()) {
153 Node* curNode = curBox->node();
154 // FIXME: this should reject more elements, as part of crbug.com/410974.
155 if (curNode && curNode->isElementNode()) {
156 Element* curElement = toElement(curNode);
157 if (curElement == frame.document()->scrollingElement())
158 break;
159 scrollChain.push_front(DOMNodeIds::idForNode(curElement));
160 }
161 curBox = curBox->containingBlock();
162 }
163 // TODO(tdresser): this should sometimes be excluded, as part of crbug.com/4 10974.
164 // We need to ensure that the scrollingElement is always part of
165 // the scroll chain. In quirks mode, when the scrollingElement is
166 // the body, some elements may use the documentElement as their
167 // containingBlock, so we ensure the scrollingElement is added
168 // here.
169 scrollChain.push_front(DOMNodeIds::idForNode(frame.document()->scrollingElem ent()));
170 }
171
133 } // namespace 172 } // namespace
134 173
135 using namespace HTMLNames; 174 using namespace HTMLNames;
136 175
137 // The link drag hysteresis is much larger than the others because there 176 // The link drag hysteresis is much larger than the others because there
138 // needs to be enough space to cancel the link press without starting a link dra g, 177 // needs to be enough space to cancel the link press without starting a link dra g,
139 // and because dragging links is rare. 178 // and because dragging links is rare.
140 static const int LinkDragHysteresis = 40; 179 static const int LinkDragHysteresis = 40;
141 static const int ImageDragHysteresis = 5; 180 static const int ImageDragHysteresis = 5;
142 static const int TextDragHysteresis = 3; 181 static const int TextDragHysteresis = 3;
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 // we'd like to EventHandler::handleMousePressEvent to pass the event to the wid get and thus the 243 // we'd like to EventHandler::handleMousePressEvent to pass the event to the wid get and thus the
205 // event target node can't still be the shadow node. 244 // event target node can't still be the shadow node.
206 static inline bool shouldRefetchEventTarget(const MouseEventWithHitTestResults& mev) 245 static inline bool shouldRefetchEventTarget(const MouseEventWithHitTestResults& mev)
207 { 246 {
208 Node* targetNode = mev.innerNode(); 247 Node* targetNode = mev.innerNode();
209 if (!targetNode || !targetNode->parentNode()) 248 if (!targetNode || !targetNode->parentNode())
210 return true; 249 return true;
211 return targetNode->isShadowRoot() && isHTMLInputElement(*toShadowRoot(target Node)->host()); 250 return targetNode->isShadowRoot() && isHTMLInputElement(*toShadowRoot(target Node)->host());
212 } 251 }
213 252
214 void recomputeScrollChain(const LocalFrame& frame, const Node& startNode,
215 std::deque<int>& scrollChain)
216 {
217 scrollChain.clear();
218
219 ASSERT(startNode.layoutObject());
220 LayoutBox* curBox = startNode.layoutObject()->enclosingBox();
221
222 // Scrolling propagates along the containing block chain.
223 while (curBox && !curBox->isLayoutView()) {
224 Node* curNode = curBox->node();
225 // FIXME: this should reject more elements, as part of crbug.com/410974.
226 if (curNode && curNode->isElementNode()) {
227 Element* curElement = toElement(curNode);
228 if (curElement == frame.document()->scrollingElement())
229 break;
230 scrollChain.push_front(DOMNodeIds::idForNode(curElement));
231 }
232 curBox = curBox->containingBlock();
233 }
234 // TODO(tdresser): this should sometimes be excluded, as part of crbug.com/4 10974.
235 // We need to ensure that the scrollingElement is always part of
236 // the scroll chain. In quirks mode, when the scrollingElement is
237 // the body, some elements may use the documentElement as their
238 // containingBlock, so we ensure the scrollingElement is added
239 // here.
240 scrollChain.push_front(DOMNodeIds::idForNode(frame.document()->scrollingElem ent()));
241 }
242
243 EventHandler::EventHandler(LocalFrame* frame) 253 EventHandler::EventHandler(LocalFrame* frame)
244 : m_frame(frame) 254 : m_frame(frame)
245 , m_mousePressed(false) 255 , m_mousePressed(false)
246 , m_capturesDragging(false) 256 , m_capturesDragging(false)
247 , m_mouseDownMayStartDrag(false) 257 , m_mouseDownMayStartDrag(false)
248 , m_selectionController(SelectionController::create(*frame)) 258 , m_selectionController(SelectionController::create(*frame))
249 , m_hoverTimer(this, &EventHandler::hoverTimerFired) 259 , m_hoverTimer(this, &EventHandler::hoverTimerFired)
250 , m_cursorUpdateTimer(this, &EventHandler::cursorUpdateTimerFired) 260 , m_cursorUpdateTimer(this, &EventHandler::cursorUpdateTimerFired)
251 , m_mouseDownMayStartAutoscroll(false) 261 , m_mouseDownMayStartAutoscroll(false)
252 , m_fakeMouseMoveEventTimer(this, &EventHandler::fakeMouseMoveEventTimerFire d) 262 , m_fakeMouseMoveEventTimer(this, &EventHandler::fakeMouseMoveEventTimerFire d)
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after
595 605
596 return result; 606 return result;
597 } 607 }
598 608
599 void EventHandler::stopAutoscroll() 609 void EventHandler::stopAutoscroll()
600 { 610 {
601 if (AutoscrollController* controller = autoscrollController()) 611 if (AutoscrollController* controller = autoscrollController())
602 controller->stopAutoscroll(); 612 controller->stopAutoscroll();
603 } 613 }
604 614
605 ScrollResult EventHandler::physicalScroll(ScrollGranularity granularity, const F loatSize& delta, Node* startNode, Node** stopNode, bool* consumed) 615 ScrollResult EventHandler::scrollBox(LayoutBox* box,
616 ScrollGranularity granularity, const FloatSize& delta,
617 const FloatPoint& position, const FloatSize& velocity,
618 bool* wasRootScroller)
619 {
620 ASSERT(box);
621 Node* node = box->node();
622 Document* document = m_frame->document();
623 Element* scrollingElement = document->scrollingElement();
624
625 bool isRootFrame = !document->ownerElement();
626
627 // TODO(bokan): If the applyScroll is installed on the body, we can still
628 // hit the HTML element for scrolling in which case it'll bubble up to the
629 // document node and try to scroll the LayoutView directly. Make sure we
630 // never scroll the LayoutView like this by manually resetting the scroll to
631 // happen on the scrolling element. This can also happen in QuirksMode when
632 // the body is scrollable and scrollingElement == nullptr.
633 if (node && node->isDocumentNode() && isRootFrame) {
634 node = scrollingElement
635 ? scrollingElement
636 : document->documentElement();
637 }
638
639 // If there's no ApplyScroll callback on the element, scroll as usuall in
640 // the non-scroll-customization case.
641 if (!node || !node->isElementNode() || !toElement(node)->getApplyScroll()) {
642 ASSERT(!isRootFrame
643 || node != scrollingElement
644 || (!scrollingElement && node != document->documentElement()));
645 *wasRootScroller = false;
646 return box->scroll(granularity, delta);
647 }
648
649 ASSERT(isRootFrame);
650
651 // If there is an ApplyScroll callback, its because we placed one on the
652 // root scroller to control top controls and overscroll. Invoke a scroll
653 // using parts of the scroll customization framework on just this element.
654 computeScrollChainForOne(*node, m_currentScrollChain);
655
656 OwnPtr<ScrollStateData> scrollStateData = adoptPtr(new ScrollStateData());
657 scrollStateData->delta_x = delta.width();
658 scrollStateData->delta_y = delta.height();
659 // TODO(bokan): This is abusing start_position. How should we store current
bokan 2016/04/04 21:44:38 I obviously shouldn't be doing this but I'd like y
tdresser 2016/04/05 19:31:12 Yeah, add another field.
bokan 2016/04/06 15:21:01 Ok, I'll add another field in a separate CL before
bokan 2016/04/07 01:27:15 On second look, I think start_position has the sem
660 // position?
661 scrollStateData->start_position_x = position.x();
662 scrollStateData->start_position_y = position.y();
663 // TODO(bokan): This also feels wrong.
bokan 2016/04/04 21:44:38 Ditto here. delta_garnularity is a double so I thi
tdresser 2016/04/05 19:31:12 Eventually granularity will be web exposed, so the
bokan 2016/04/06 15:21:01 sgtm, TODO added.
664 scrollStateData->delta_granularity = granularity;
665 scrollStateData->velocity_x = velocity.width();
666 scrollStateData->velocity_y = velocity.height();
667 scrollStateData->should_propagate = false;
668 scrollStateData->is_in_inertial_phase = false;
669 scrollStateData->from_user_input = true;
670 scrollStateData->delta_consumed_for_scroll_sequence = false;
671 ScrollState* scrollState =
672 ScrollState::create(scrollStateData.release());
673
674 customizedScroll(*node, *scrollState);
675
676 ScrollResult result(
677 scrollState->deltaX() != delta.width(),
678 scrollState->deltaY() != delta.height(),
679 scrollState->deltaX(),
680 scrollState->deltaY());
681
682 *wasRootScroller = true;
683 m_currentScrollChain.clear();
684
685 return result;
686 }
687
688 ScrollResult EventHandler::physicalScroll(ScrollGranularity granularity,
689 const FloatSize& delta, const FloatPoint& position,
690 const FloatSize& velocity, Node* startNode, Node** stopNode, bool* consumed)
606 { 691 {
607 if (consumed) 692 if (consumed)
608 *consumed = false; 693 *consumed = false;
609 if (delta.isZero()) 694 if (delta.isZero())
610 return ScrollResult(); 695 return ScrollResult();
611 696
612 Node* node = startNode; 697 Node* node = startNode;
613 ASSERT(node && node->layoutObject()); 698 ASSERT(node && node->layoutObject());
614 699
615 m_frame->document()->updateLayoutIgnorePendingStylesheets(); 700 m_frame->document()->updateLayoutIgnorePendingStylesheets();
616 701
617 ScrollResult result; 702 ScrollResult result;
618 703
619 LayoutBox* curBox = node->layoutObject()->enclosingBox(); 704 LayoutBox* curBox = node->layoutObject()->enclosingBox();
620 while (curBox) { 705 while (curBox) {
621 // If we're at the stopNode, we should try to scroll it but we shouldn't 706 // If we're at the stopNode, we should try to scroll it but we shouldn't
622 // chain past it. 707 // chain past it.
623 bool shouldStopChaining = 708 bool shouldStopChaining =
624 stopNode && *stopNode && curBox->node() == *stopNode; 709 stopNode && *stopNode && curBox->node() == *stopNode;
625 result = curBox->scroll(granularity, delta); 710 bool wasRootScroller = false;
711
712 result = scrollBox(
713 curBox,
714 granularity,
715 delta,
716 position,
717 velocity,
718 &wasRootScroller);
626 719
627 if (result.didScroll() && stopNode) 720 if (result.didScroll() && stopNode)
628 *stopNode = curBox->node(); 721 *stopNode = curBox->node();
629 722
630 if (result.didScroll() || shouldStopChaining) { 723 if (result.didScroll() || shouldStopChaining) {
631 setFrameWasScrolledByUser(); 724 setFrameWasScrolledByUser();
632 if (consumed) 725 if (consumed)
633 *consumed = true; 726 *consumed = true;
634 return result; 727 return result;
728 } else if (wasRootScroller) {
729 // Don't try to chain past the root scroller, even if there's
730 // eligible ancestors.
731 break;
635 } 732 }
636 733
637 curBox = curBox->containingBlock(); 734 curBox = curBox->containingBlock();
638 } 735 }
639 736
640 return result; 737 return result;
641 } 738 }
642 739
643 bool EventHandler::logicalScroll(ScrollDirection direction, ScrollGranularity gr anularity, Node* startNode) 740 bool EventHandler::logicalScroll(ScrollDirection direction, ScrollGranularity gr anularity, Node* startNode)
644 { 741 {
(...skipping 1235 matching lines...) Expand 10 before | Expand all | Expand 10 after
1880 // TODO(bokan): This seems like it belongs in the coalescing logic. 1977 // TODO(bokan): This seems like it belongs in the coalescing logic.
1881 if (granularity == ScrollByPage) { 1978 if (granularity == ScrollByPage) {
1882 if (delta.width()) 1979 if (delta.width())
1883 delta.setWidth(delta.width() > 0 ? 1 : -1); 1980 delta.setWidth(delta.width() > 0 ? 1 : -1);
1884 if (delta.height()) 1981 if (delta.height())
1885 delta.setHeight(delta.height() > 0 ? 1 : -1); 1982 delta.setHeight(delta.height() > 0 ? 1 : -1);
1886 } 1983 }
1887 1984
1888 // FIXME: enable scroll customization in this case. See crbug.com/410974. 1985 // FIXME: enable scroll customization in this case. See crbug.com/410974.
1889 bool consumed = false; 1986 bool consumed = false;
1890 ScrollResult result = physicalScroll(granularity, delta, startNode, &node, & consumed); 1987
1988 // TODO(bokan): Use a negative position to designate wheel scrolling so
1989 // that the handler can check settings()->reportWheelOverscroll. This is
1990 // hacky, there should be a more explicit way to do this.
bokan 2016/04/04 21:44:38 Wheel events shouldn't report overscroll unless th
tdresser 2016/04/05 19:31:12 There have been a bunch of bugs recently with whee
dtapuska 2016/04/05 19:58:58 The setting is kind of useless; my guess is that i
bokan 2016/04/06 15:21:01 Ok, I've removed the setting from Blink in a separ
1991 physicalScroll(
1992 granularity,
1993 delta,
1994 FloatPoint(-1, -1),
1995 FloatSize(),
1996 startNode,
1997 &node,
1998 &consumed);
1891 1999
1892 if (consumed) 2000 if (consumed)
1893 wheelEvent->setDefaultHandled(); 2001 wheelEvent->setDefaultHandled();
1894
1895 if (m_frame->isMainFrame() && m_frame->settings() && m_frame->settings()->re portWheelOverscroll())
1896 handleOverscroll(result);
1897 } 2002 }
1898 2003
1899 WebInputEventResult EventHandler::handleGestureShowPress() 2004 WebInputEventResult EventHandler::handleGestureShowPress()
1900 { 2005 {
1901 m_lastShowPressTimestamp = WTF::monotonicallyIncreasingTime(); 2006 m_lastShowPressTimestamp = WTF::monotonicallyIncreasingTime();
1902 2007
1903 FrameView* view = m_frame->view(); 2008 FrameView* view = m_frame->view();
1904 if (!view) 2009 if (!view)
1905 return WebInputEventResult::NotHandled; 2010 return WebInputEventResult::NotHandled;
1906 if (ScrollAnimatorBase* scrollAnimator = view->existingScrollAnimator()) 2011 if (ScrollAnimatorBase* scrollAnimator = view->existingScrollAnimator())
(...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after
2374 2479
2375 FloatSize unusedDelta(scrollResult.unusedScrollDeltaX, scrollResult.unusedSc rollDeltaY); 2480 FloatSize unusedDelta(scrollResult.unusedScrollDeltaX, scrollResult.unusedSc rollDeltaY);
2376 unusedDelta = adjustOverscroll(unusedDelta); 2481 unusedDelta = adjustOverscroll(unusedDelta);
2377 resetOverscroll(scrollResult.didScrollX, scrollResult.didScrollY); 2482 resetOverscroll(scrollResult.didScrollX, scrollResult.didScrollY);
2378 if (unusedDelta != FloatSize()) { 2483 if (unusedDelta != FloatSize()) {
2379 m_accumulatedRootOverscroll += unusedDelta; 2484 m_accumulatedRootOverscroll += unusedDelta;
2380 m_frame->chromeClient().didOverscroll(unusedDelta, m_accumulatedRootOver scroll, position, velocity); 2485 m_frame->chromeClient().didOverscroll(unusedDelta, m_accumulatedRootOver scroll, position, velocity);
2381 } 2486 }
2382 } 2487 }
2383 2488
2489 bool EventHandler::isRootScroller(const Node& node) const
2490 {
2491 // The root scroller is the one Element on the page designated to perform
2492 // "viewport actions" like top controls movement and overscroll glow.
2493
2494 if (!node.isElementNode() || node.document().ownerElement())
2495 return false;
2496
2497 Element* scrollingElement = node.document().scrollingElement();
2498 return scrollingElement
2499 ? toElement(&node) == node.document().scrollingElement()
2500 : toElement(&node) == node.document().documentElement();
2501 }
2502
2384 WebInputEventResult EventHandler::handleGestureScrollUpdate(const PlatformGestur eEvent& gestureEvent) 2503 WebInputEventResult EventHandler::handleGestureScrollUpdate(const PlatformGestur eEvent& gestureEvent)
2385 { 2504 {
2386 ASSERT(gestureEvent.type() == PlatformEvent::GestureScrollUpdate); 2505 ASSERT(gestureEvent.type() == PlatformEvent::GestureScrollUpdate);
2387 2506
2388 // Negate the deltas since the gesture event stores finger movement and 2507 // Negate the deltas since the gesture event stores finger movement and
2389 // scrolling occurs in the direction opposite the finger's movement 2508 // scrolling occurs in the direction opposite the finger's movement
2390 // direction. e.g. Finger moving up has negative event delta but causes the 2509 // direction. e.g. Finger moving up has negative event delta but causes the
2391 // page to scroll down causing positive scroll delta. 2510 // page to scroll down causing positive scroll delta.
2392 FloatSize delta(-gestureEvent.deltaX(), -gestureEvent.deltaY()); 2511 FloatSize delta(-gestureEvent.deltaX(), -gestureEvent.deltaY());
2393 FloatSize velocity(-gestureEvent.velocityX(), -gestureEvent.velocityY()); 2512 FloatSize velocity(-gestureEvent.velocityX(), -gestureEvent.velocityY());
(...skipping 24 matching lines...) Expand all
2418 // FIXME: we should allow simultaneous scrolling of nested 2537 // FIXME: we should allow simultaneous scrolling of nested
2419 // iframes along perpendicular axes. See crbug.com/466991. 2538 // iframes along perpendicular axes. See crbug.com/466991.
2420 m_deltaConsumedForScrollSequence = true; 2539 m_deltaConsumedForScrollSequence = true;
2421 return result; 2540 return result;
2422 } 2541 }
2423 2542
2424 if (handleScrollCustomization) { 2543 if (handleScrollCustomization) {
2425 OwnPtr<ScrollStateData> scrollStateData = adoptPtr(new ScrollStateDa ta()); 2544 OwnPtr<ScrollStateData> scrollStateData = adoptPtr(new ScrollStateDa ta());
2426 scrollStateData->delta_x = delta.width(); 2545 scrollStateData->delta_x = delta.width();
2427 scrollStateData->delta_y = delta.height(); 2546 scrollStateData->delta_y = delta.height();
2547 scrollStateData->delta_granularity = ScrollByPrecisePixel;
2428 scrollStateData->velocity_x = velocity.width(); 2548 scrollStateData->velocity_x = velocity.width();
2429 scrollStateData->velocity_y = velocity.height(); 2549 scrollStateData->velocity_y = velocity.height();
2430 scrollStateData->should_propagate = !gestureEvent.preventPropagation (); 2550 scrollStateData->should_propagate = !gestureEvent.preventPropagation ();
2431 scrollStateData->is_in_inertial_phase = gestureEvent.inertial(); 2551 scrollStateData->is_in_inertial_phase = gestureEvent.inertial();
2432 scrollStateData->from_user_input = true; 2552 scrollStateData->from_user_input = true;
2433 scrollStateData->delta_consumed_for_scroll_sequence = m_deltaConsume dForScrollSequence; 2553 scrollStateData->delta_consumed_for_scroll_sequence = m_deltaConsume dForScrollSequence;
2434 RawPtr<ScrollState> scrollState = ScrollState::create(scrollStateDat a.release()); 2554 RawPtr<ScrollState> scrollState = ScrollState::create(scrollStateDat a.release());
2435 if (m_previousGestureScrolledNode) { 2555 if (m_previousGestureScrolledNode) {
2436 // The ScrollState needs to know what the current 2556 // The ScrollState needs to know what the current
2437 // native scrolling element is, so that for an 2557 // native scrolling element is, so that for an
2438 // inertial scroll that shouldn't propagate, only the 2558 // inertial scroll that shouldn't propagate, only the
2439 // currently scrolling element responds. 2559 // currently scrolling element responds.
2440 ASSERT(m_previousGestureScrolledNode->isElementNode()); 2560 ASSERT(m_previousGestureScrolledNode->isElementNode());
2441 scrollState->setCurrentNativeScrollingElement(toElement(m_previo usGestureScrolledNode.get())); 2561 scrollState->setCurrentNativeScrollingElement(toElement(m_previo usGestureScrolledNode.get()));
2442 } 2562 }
2443 customizedScroll(*node, *scrollState); 2563 customizedScroll(*node, *scrollState);
2444 m_previousGestureScrolledNode = scrollState->currentNativeScrollingE lement(); 2564 m_previousGestureScrolledNode = scrollState->currentNativeScrollingE lement();
2445 m_deltaConsumedForScrollSequence = scrollState->deltaConsumedForScro llSequence(); 2565 m_deltaConsumedForScrollSequence = scrollState->deltaConsumedForScro llSequence();
2446 if (scrollState->deltaX() != delta.width() 2566 if (scrollState->deltaX() != delta.width()
2447 || scrollState->deltaY() != delta.height()) { 2567 || scrollState->deltaY() != delta.height()) {
2448 setFrameWasScrolledByUser(); 2568 setFrameWasScrolledByUser();
2449 return WebInputEventResult::HandledSystem; 2569 return WebInputEventResult::HandledSystem;
2450 } 2570 }
2451 } else { 2571 } else {
2452 Node* stopNode = nullptr; 2572 Node* stopNode = nullptr;
2453 if (gestureEvent.preventPropagation()) 2573 if (gestureEvent.preventPropagation())
2454 stopNode = m_previousGestureScrolledNode.get(); 2574 stopNode = m_previousGestureScrolledNode.get();
2455 2575
2456 bool consumed = false; 2576 bool consumed = false;
2457 ScrollResult result = physicalScroll(granularity, delta, node, &stop Node, &consumed); 2577 ScrollResult result = physicalScroll(
2578 granularity,
2579 delta,
2580 FloatPoint(gestureEvent.position()),
2581 velocity,
2582 node,
2583 &stopNode,
2584 &consumed);
2458 2585
2459 if (gestureEvent.preventPropagation()) 2586 if (gestureEvent.preventPropagation())
2460 m_previousGestureScrolledNode = stopNode; 2587 m_previousGestureScrolledNode = stopNode;
2461 2588
2462 if (m_frame->isMainFrame() && (!stopNode || stopNode->layoutObject() == m_frame->view()->layoutView())) { 2589 if (!stopNode || !isRootScroller(*stopNode))
2463 FloatPoint position = FloatPoint(gestureEvent.position().x(), ge stureEvent.position().y());
2464 handleOverscroll(result, position, velocity);
2465 } else {
2466 resetOverscroll(result.didScrollX, result.didScrollY); 2590 resetOverscroll(result.didScrollX, result.didScrollY);
2467 }
2468 2591
2469 if (consumed) 2592 if (consumed)
2470 return WebInputEventResult::HandledSystem; 2593 return WebInputEventResult::HandledSystem;
2471 } 2594 }
2472 } 2595 }
2473 2596
2474 return WebInputEventResult::NotHandled; 2597 return WebInputEventResult::NotHandled;
2475 } 2598 }
2476 2599
2477 void EventHandler::clearGestureScrollState() 2600 void EventHandler::clearGestureScrollState()
(...skipping 1514 matching lines...) Expand 10 before | Expand all | Expand 10 after
3992 PlatformEvent::Modifiers EventHandler::accessKeyModifiers() 4115 PlatformEvent::Modifiers EventHandler::accessKeyModifiers()
3993 { 4116 {
3994 #if OS(MACOSX) 4117 #if OS(MACOSX)
3995 return static_cast<PlatformEvent::Modifiers>(PlatformEvent::CtrlKey | Platfo rmEvent::AltKey); 4118 return static_cast<PlatformEvent::Modifiers>(PlatformEvent::CtrlKey | Platfo rmEvent::AltKey);
3996 #else 4119 #else
3997 return PlatformEvent::AltKey; 4120 return PlatformEvent::AltKey;
3998 #endif 4121 #endif
3999 } 4122 }
4000 4123
4001 } // namespace blink 4124 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698