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

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: Disabled track-word-breaking.html on release too and remove position in defaultWheelEventHandler 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 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 // we'd like to EventHandler::handleMousePressEvent to pass the event to the wid get and thus the 157 // we'd like to EventHandler::handleMousePressEvent to pass the event to the wid get and thus the
158 // event target node can't still be the shadow node. 158 // event target node can't still be the shadow node.
159 bool shouldRefetchEventTarget(const MouseEventWithHitTestResults& mev) 159 bool shouldRefetchEventTarget(const MouseEventWithHitTestResults& mev)
160 { 160 {
161 Node* targetNode = mev.innerNode(); 161 Node* targetNode = mev.innerNode();
162 if (!targetNode || !targetNode->parentNode()) 162 if (!targetNode || !targetNode->parentNode())
163 return true; 163 return true;
164 return targetNode->isShadowRoot() && isHTMLInputElement(*toShadowRoot(target Node)->host()); 164 return targetNode->isShadowRoot() && isHTMLInputElement(*toShadowRoot(target Node)->host());
165 } 165 }
166 166
167 // TODO(bokan): This method can go away once all scrolls happen through the
168 // scroll customization path.
169 void computeScrollChainForSingleNode(Node& node, std::deque<int>& scrollChain)
170 {
171 scrollChain.clear();
172
173 ASSERT(node.layoutObject());
174 Element* element = toElement(&node);
175
176 scrollChain.push_front(DOMNodeIds::idForNode(element));
177 }
178
179 void recomputeScrollChain(const LocalFrame& frame, const Node& startNode,
180 std::deque<int>& scrollChain)
181 {
182 scrollChain.clear();
183
184 ASSERT(startNode.layoutObject());
185 LayoutBox* curBox = startNode.layoutObject()->enclosingBox();
186
187 // Scrolling propagates along the containing block chain.
188 while (curBox && !curBox->isLayoutView()) {
189 Node* curNode = curBox->node();
190 // FIXME: this should reject more elements, as part of crbug.com/410974.
191 if (curNode && curNode->isElementNode()) {
192 Element* curElement = toElement(curNode);
193 if (curElement == frame.document()->scrollingElement())
194 break;
195 scrollChain.push_front(DOMNodeIds::idForNode(curElement));
196 }
197 curBox = curBox->containingBlock();
198 }
199 // TODO(tdresser): this should sometimes be excluded, as part of crbug.com/4 10974.
200 // We need to ensure that the scrollingElement is always part of
201 // the scroll chain. In quirks mode, when the scrollingElement is
202 // the body, some elements may use the documentElement as their
203 // containingBlock, so we ensure the scrollingElement is added
204 // here.
205 scrollChain.push_front(DOMNodeIds::idForNode(frame.document()->scrollingElem ent()));
206 }
207
167 } // namespace 208 } // namespace
168 209
169 using namespace HTMLNames; 210 using namespace HTMLNames;
170 211
171 // The link drag hysteresis is much larger than the others because there 212 // The link drag hysteresis is much larger than the others because there
172 // needs to be enough space to cancel the link press without starting a link dra g, 213 // needs to be enough space to cancel the link press without starting a link dra g,
173 // and because dragging links is rare. 214 // and because dragging links is rare.
174 static const int LinkDragHysteresis = 40; 215 static const int LinkDragHysteresis = 40;
175 static const int ImageDragHysteresis = 5; 216 static const int ImageDragHysteresis = 5;
176 static const int TextDragHysteresis = 3; 217 static const int TextDragHysteresis = 3;
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 OptionalCursor(const Cursor& cursor) : m_isCursorChange(true), m_cursor(curs or) { } 256 OptionalCursor(const Cursor& cursor) : m_isCursorChange(true), m_cursor(curs or) { }
216 257
217 bool isCursorChange() const { return m_isCursorChange; } 258 bool isCursorChange() const { return m_isCursorChange; }
218 const Cursor& cursor() const { ASSERT(m_isCursorChange); return m_cursor; } 259 const Cursor& cursor() const { ASSERT(m_isCursorChange); return m_cursor; }
219 260
220 private: 261 private:
221 bool m_isCursorChange; 262 bool m_isCursorChange;
222 Cursor m_cursor; 263 Cursor m_cursor;
223 }; 264 };
224 265
225 void recomputeScrollChain(const LocalFrame& frame, const Node& startNode,
226 std::deque<int>& scrollChain)
227 {
228 scrollChain.clear();
229
230 ASSERT(startNode.layoutObject());
231 LayoutBox* curBox = startNode.layoutObject()->enclosingBox();
232
233 // Scrolling propagates along the containing block chain.
234 while (curBox && !curBox->isLayoutView()) {
235 Node* curNode = curBox->node();
236 // FIXME: this should reject more elements, as part of crbug.com/410974.
237 if (curNode && curNode->isElementNode()) {
238 Element* curElement = toElement(curNode);
239 if (curElement == frame.document()->scrollingElement())
240 break;
241 scrollChain.push_front(DOMNodeIds::idForNode(curElement));
242 }
243 curBox = curBox->containingBlock();
244 }
245 // TODO(tdresser): this should sometimes be excluded, as part of crbug.com/4 10974.
246 // We need to ensure that the scrollingElement is always part of
247 // the scroll chain. In quirks mode, when the scrollingElement is
248 // the body, some elements may use the documentElement as their
249 // containingBlock, so we ensure the scrollingElement is added
250 // here.
251 scrollChain.push_front(DOMNodeIds::idForNode(frame.document()->scrollingElem ent()));
252 }
253
254 EventHandler::EventHandler(LocalFrame* frame) 266 EventHandler::EventHandler(LocalFrame* frame)
255 : m_frame(frame) 267 : m_frame(frame)
256 , m_mousePressed(false) 268 , m_mousePressed(false)
257 , m_capturesDragging(false) 269 , m_capturesDragging(false)
258 , m_mouseDownMayStartDrag(false) 270 , m_mouseDownMayStartDrag(false)
259 , m_selectionController(SelectionController::create(*frame)) 271 , m_selectionController(SelectionController::create(*frame))
260 , m_hoverTimer(this, &EventHandler::hoverTimerFired) 272 , m_hoverTimer(this, &EventHandler::hoverTimerFired)
261 , m_cursorUpdateTimer(this, &EventHandler::cursorUpdateTimerFired) 273 , m_cursorUpdateTimer(this, &EventHandler::cursorUpdateTimerFired)
262 , m_mouseDownMayStartAutoscroll(false) 274 , m_mouseDownMayStartAutoscroll(false)
263 , m_fakeMouseMoveEventTimer(this, &EventHandler::fakeMouseMoveEventTimerFire d) 275 , m_fakeMouseMoveEventTimer(this, &EventHandler::fakeMouseMoveEventTimerFire d)
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after
604 616
605 return result; 617 return result;
606 } 618 }
607 619
608 void EventHandler::stopAutoscroll() 620 void EventHandler::stopAutoscroll()
609 { 621 {
610 if (AutoscrollController* controller = autoscrollController()) 622 if (AutoscrollController* controller = autoscrollController())
611 controller->stopAutoscroll(); 623 controller->stopAutoscroll();
612 } 624 }
613 625
614 ScrollResult EventHandler::physicalScroll(ScrollGranularity granularity, const F loatSize& delta, Node* startNode, Node** stopNode, bool* consumed) 626 ScrollResult EventHandler::scrollBox(LayoutBox* box,
627 ScrollGranularity granularity, const FloatSize& delta,
628 const FloatPoint& position, const FloatSize& velocity,
629 bool* wasRootScroller)
630 {
631 ASSERT(box);
632 Node* node = box->node();
633 Document* document = m_frame->document();
634 Element* scrollingElement = document->scrollingElement();
635
636 bool isRootFrame = !document->ownerElement();
637
638 // TODO(bokan): If the applyScroll is installed on the body, we can still
tdresser 2016/04/12 13:59:15 "the applyScroll" doesn't necessarily refer to a u
bokan 2016/04/12 15:13:53 Changed "applyScroll" to "ViewportScrollCallback"
639 // hit the HTML element for scrolling in which case it'll bubble up to the
640 // document node and try to scroll the LayoutView directly. Make sure we
641 // never scroll the LayoutView like this by manually resetting the scroll to
642 // happen on the scrolling element. This can also happen in QuirksMode when
643 // the body is scrollable and scrollingElement == nullptr.
644 if (node && node->isDocumentNode() && isRootFrame) {
645 node = scrollingElement
646 ? scrollingElement
647 : document->documentElement();
648 }
649
650 // If there's no ApplyScroll callback on the element, scroll as usuall in
651 // the non-scroll-customization case.
652 if (!node || !node->isElementNode() || !toElement(node)->getApplyScroll()) {
653 ASSERT(!isRootFrame
654 || node != scrollingElement
655 || (!scrollingElement && node != document->documentElement()));
656 *wasRootScroller = false;
657 return box->scroll(granularity, delta);
658 }
659
660 ASSERT(isRootFrame);
661
662 // If there is an ApplyScroll callback, its because we placed one on the
663 // root scroller to control top controls and overscroll. Invoke a scroll
664 // using parts of the scroll customization framework on just this element.
665 computeScrollChainForSingleNode(*node, m_currentScrollChain);
666
667 OwnPtr<ScrollStateData> scrollStateData = adoptPtr(new ScrollStateData());
668 scrollStateData->delta_x = delta.width();
669 scrollStateData->delta_y = delta.height();
670 scrollStateData->start_position_x = position.x();
671 scrollStateData->start_position_y = position.y();
672 // TODO(bokan): delta_granularity is meant to be the number of pixels per
673 // unit of delta but we can't determine that until we get to the area we'll
674 // scroll. This is a hack, we stuff the enum into the double value for
675 // now.
676 scrollStateData->delta_granularity = static_cast<double>(granularity);
677 scrollStateData->velocity_x = velocity.width();
678 scrollStateData->velocity_y = velocity.height();
679 scrollStateData->should_propagate = false;
680 scrollStateData->is_in_inertial_phase = false;
681 scrollStateData->from_user_input = true;
682 scrollStateData->delta_consumed_for_scroll_sequence = false;
683 ScrollState* scrollState =
684 ScrollState::create(scrollStateData.release());
685
686 customizedScroll(*node, *scrollState);
687
688 ScrollResult result(
689 scrollState->deltaX() != delta.width(),
690 scrollState->deltaY() != delta.height(),
691 scrollState->deltaX(),
692 scrollState->deltaY());
693
694 *wasRootScroller = true;
695 m_currentScrollChain.clear();
696
697 return result;
698 }
699
700 ScrollResult EventHandler::physicalScroll(ScrollGranularity granularity,
701 const FloatSize& delta, const FloatPoint& position,
702 const FloatSize& velocity, Node* startNode, Node** stopNode, bool* consumed)
615 { 703 {
616 if (consumed) 704 if (consumed)
617 *consumed = false; 705 *consumed = false;
618 if (delta.isZero()) 706 if (delta.isZero())
619 return ScrollResult(); 707 return ScrollResult();
620 708
621 Node* node = startNode; 709 Node* node = startNode;
622 ASSERT(node && node->layoutObject()); 710 ASSERT(node && node->layoutObject());
623 711
624 m_frame->document()->updateLayoutIgnorePendingStylesheets(); 712 m_frame->document()->updateLayoutIgnorePendingStylesheets();
625 713
626 ScrollResult result; 714 ScrollResult result;
627 715
628 LayoutBox* curBox = node->layoutObject()->enclosingBox(); 716 LayoutBox* curBox = node->layoutObject()->enclosingBox();
629 while (curBox) { 717 while (curBox) {
630 // If we're at the stopNode, we should try to scroll it but we shouldn't 718 // If we're at the stopNode, we should try to scroll it but we shouldn't
631 // chain past it. 719 // chain past it.
632 bool shouldStopChaining = 720 bool shouldStopChaining =
633 stopNode && *stopNode && curBox->node() == *stopNode; 721 stopNode && *stopNode && curBox->node() == *stopNode;
634 result = curBox->scroll(granularity, delta); 722 bool wasRootScroller = false;
723
724 result = scrollBox(
725 curBox,
726 granularity,
727 delta,
728 position,
729 velocity,
730 &wasRootScroller);
635 731
636 if (result.didScroll() && stopNode) 732 if (result.didScroll() && stopNode)
637 *stopNode = curBox->node(); 733 *stopNode = curBox->node();
638 734
639 if (result.didScroll() || shouldStopChaining) { 735 if (result.didScroll() || shouldStopChaining) {
640 setFrameWasScrolledByUser(); 736 setFrameWasScrolledByUser();
641 if (consumed) 737 if (consumed)
642 *consumed = true; 738 *consumed = true;
643 return result; 739 return result;
740 } else if (wasRootScroller) {
741 // Don't try to chain past the root scroller, even if there's
742 // eligible ancestors.
743 break;
644 } 744 }
645 745
646 curBox = curBox->containingBlock(); 746 curBox = curBox->containingBlock();
647 } 747 }
648 748
649 return result; 749 return result;
650 } 750 }
651 751
652 bool EventHandler::logicalScroll(ScrollDirection direction, ScrollGranularity gr anularity, Node* startNode) 752 bool EventHandler::logicalScroll(ScrollDirection direction, ScrollGranularity gr anularity, Node* startNode)
653 { 753 {
(...skipping 1233 matching lines...) Expand 10 before | Expand all | Expand 10 after
1887 // TODO(bokan): This seems like it belongs in the coalescing logic. 1987 // TODO(bokan): This seems like it belongs in the coalescing logic.
1888 if (granularity == ScrollByPage) { 1988 if (granularity == ScrollByPage) {
1889 if (delta.width()) 1989 if (delta.width())
1890 delta.setWidth(delta.width() > 0 ? 1 : -1); 1990 delta.setWidth(delta.width() > 0 ? 1 : -1);
1891 if (delta.height()) 1991 if (delta.height())
1892 delta.setHeight(delta.height() > 0 ? 1 : -1); 1992 delta.setHeight(delta.height() > 0 ? 1 : -1);
1893 } 1993 }
1894 1994
1895 // FIXME: enable scroll customization in this case. See crbug.com/410974. 1995 // FIXME: enable scroll customization in this case. See crbug.com/410974.
1896 bool consumed = false; 1996 bool consumed = false;
1897 ScrollResult result = physicalScroll(granularity, delta, startNode, &node, & consumed); 1997
1998 physicalScroll(
1999 granularity,
2000 delta,
2001 FloatPoint(),
2002 FloatSize(),
2003 startNode,
2004 &node,
2005 &consumed);
1898 2006
1899 if (consumed) 2007 if (consumed)
1900 wheelEvent->setDefaultHandled(); 2008 wheelEvent->setDefaultHandled();
1901
1902 if (m_frame->isMainFrame())
1903 handleOverscroll(result);
1904 } 2009 }
1905 2010
1906 WebInputEventResult EventHandler::handleGestureShowPress() 2011 WebInputEventResult EventHandler::handleGestureShowPress()
1907 { 2012 {
1908 m_lastShowPressTimestamp = WTF::monotonicallyIncreasingTime(); 2013 m_lastShowPressTimestamp = WTF::monotonicallyIncreasingTime();
1909 2014
1910 FrameView* view = m_frame->view(); 2015 FrameView* view = m_frame->view();
1911 if (!view) 2016 if (!view)
1912 return WebInputEventResult::NotHandled; 2017 return WebInputEventResult::NotHandled;
1913 if (ScrollAnimatorBase* scrollAnimator = view->existingScrollAnimator()) 2018 if (ScrollAnimatorBase* scrollAnimator = view->existingScrollAnimator())
(...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after
2379 2484
2380 FloatSize unusedDelta(scrollResult.unusedScrollDeltaX, scrollResult.unusedSc rollDeltaY); 2485 FloatSize unusedDelta(scrollResult.unusedScrollDeltaX, scrollResult.unusedSc rollDeltaY);
2381 unusedDelta = adjustOverscroll(unusedDelta); 2486 unusedDelta = adjustOverscroll(unusedDelta);
2382 resetOverscroll(scrollResult.didScrollX, scrollResult.didScrollY); 2487 resetOverscroll(scrollResult.didScrollX, scrollResult.didScrollY);
2383 if (unusedDelta != FloatSize()) { 2488 if (unusedDelta != FloatSize()) {
2384 m_accumulatedRootOverscroll += unusedDelta; 2489 m_accumulatedRootOverscroll += unusedDelta;
2385 m_frame->chromeClient().didOverscroll(unusedDelta, m_accumulatedRootOver scroll, position, velocity); 2490 m_frame->chromeClient().didOverscroll(unusedDelta, m_accumulatedRootOver scroll, position, velocity);
2386 } 2491 }
2387 } 2492 }
2388 2493
2494 bool EventHandler::isRootScroller(const Node& node) const
2495 {
2496 // The root scroller is the one Element on the page designated to perform
2497 // "viewport actions" like top controls movement and overscroll glow.
2498
2499 if (!node.isElementNode() || node.document().ownerElement())
2500 return false;
2501
2502 Element* scrollingElement = node.document().scrollingElement();
2503 return scrollingElement
2504 ? toElement(&node) == node.document().scrollingElement()
2505 : toElement(&node) == node.document().documentElement();
2506 }
2507
2389 WebInputEventResult EventHandler::handleGestureScrollUpdate(const PlatformGestur eEvent& gestureEvent) 2508 WebInputEventResult EventHandler::handleGestureScrollUpdate(const PlatformGestur eEvent& gestureEvent)
2390 { 2509 {
2391 ASSERT(gestureEvent.type() == PlatformEvent::GestureScrollUpdate); 2510 ASSERT(gestureEvent.type() == PlatformEvent::GestureScrollUpdate);
2392 2511
2393 // Negate the deltas since the gesture event stores finger movement and 2512 // Negate the deltas since the gesture event stores finger movement and
2394 // scrolling occurs in the direction opposite the finger's movement 2513 // scrolling occurs in the direction opposite the finger's movement
2395 // direction. e.g. Finger moving up has negative event delta but causes the 2514 // direction. e.g. Finger moving up has negative event delta but causes the
2396 // page to scroll down causing positive scroll delta. 2515 // page to scroll down causing positive scroll delta.
2397 FloatSize delta(-gestureEvent.deltaX(), -gestureEvent.deltaY()); 2516 FloatSize delta(-gestureEvent.deltaX(), -gestureEvent.deltaY());
2398 FloatSize velocity(-gestureEvent.velocityX(), -gestureEvent.velocityY()); 2517 FloatSize velocity(-gestureEvent.velocityX(), -gestureEvent.velocityY());
(...skipping 22 matching lines...) Expand all
2421 // FIXME: we should allow simultaneous scrolling of nested 2540 // FIXME: we should allow simultaneous scrolling of nested
2422 // iframes along perpendicular axes. See crbug.com/466991. 2541 // iframes along perpendicular axes. See crbug.com/466991.
2423 m_deltaConsumedForScrollSequence = true; 2542 m_deltaConsumedForScrollSequence = true;
2424 return result; 2543 return result;
2425 } 2544 }
2426 2545
2427 if (handleScrollCustomization) { 2546 if (handleScrollCustomization) {
2428 OwnPtr<ScrollStateData> scrollStateData = adoptPtr(new ScrollStateDa ta()); 2547 OwnPtr<ScrollStateData> scrollStateData = adoptPtr(new ScrollStateDa ta());
2429 scrollStateData->delta_x = delta.width(); 2548 scrollStateData->delta_x = delta.width();
2430 scrollStateData->delta_y = delta.height(); 2549 scrollStateData->delta_y = delta.height();
2550 scrollStateData->delta_granularity = ScrollByPrecisePixel;
2431 scrollStateData->velocity_x = velocity.width(); 2551 scrollStateData->velocity_x = velocity.width();
2432 scrollStateData->velocity_y = velocity.height(); 2552 scrollStateData->velocity_y = velocity.height();
2433 scrollStateData->should_propagate = !gestureEvent.preventPropagation (); 2553 scrollStateData->should_propagate = !gestureEvent.preventPropagation ();
2434 scrollStateData->is_in_inertial_phase = gestureEvent.inertial(); 2554 scrollStateData->is_in_inertial_phase = gestureEvent.inertial();
2435 scrollStateData->from_user_input = true; 2555 scrollStateData->from_user_input = true;
2436 scrollStateData->delta_consumed_for_scroll_sequence = m_deltaConsume dForScrollSequence; 2556 scrollStateData->delta_consumed_for_scroll_sequence = m_deltaConsume dForScrollSequence;
2437 ScrollState* scrollState = ScrollState::create(scrollStateData.relea se()); 2557 ScrollState* scrollState = ScrollState::create(scrollStateData.relea se());
2438 if (m_previousGestureScrolledNode) { 2558 if (m_previousGestureScrolledNode) {
2439 // The ScrollState needs to know what the current 2559 // The ScrollState needs to know what the current
2440 // native scrolling element is, so that for an 2560 // native scrolling element is, so that for an
2441 // inertial scroll that shouldn't propagate, only the 2561 // inertial scroll that shouldn't propagate, only the
2442 // currently scrolling element responds. 2562 // currently scrolling element responds.
2443 ASSERT(m_previousGestureScrolledNode->isElementNode()); 2563 ASSERT(m_previousGestureScrolledNode->isElementNode());
2444 scrollState->setCurrentNativeScrollingElement(toElement(m_previo usGestureScrolledNode.get())); 2564 scrollState->setCurrentNativeScrollingElement(toElement(m_previo usGestureScrolledNode.get()));
2445 } 2565 }
2446 customizedScroll(*node, *scrollState); 2566 customizedScroll(*node, *scrollState);
2447 m_previousGestureScrolledNode = scrollState->currentNativeScrollingE lement(); 2567 m_previousGestureScrolledNode = scrollState->currentNativeScrollingE lement();
2448 m_deltaConsumedForScrollSequence = scrollState->deltaConsumedForScro llSequence(); 2568 m_deltaConsumedForScrollSequence = scrollState->deltaConsumedForScro llSequence();
2449 if (scrollState->deltaX() != delta.width() 2569 if (scrollState->deltaX() != delta.width()
2450 || scrollState->deltaY() != delta.height()) { 2570 || scrollState->deltaY() != delta.height()) {
2451 setFrameWasScrolledByUser(); 2571 setFrameWasScrolledByUser();
2452 return WebInputEventResult::HandledSystem; 2572 return WebInputEventResult::HandledSystem;
2453 } 2573 }
2454 } else { 2574 } else {
2455 Node* stopNode = nullptr; 2575 Node* stopNode = nullptr;
2456 if (gestureEvent.preventPropagation()) 2576 if (gestureEvent.preventPropagation())
2457 stopNode = m_previousGestureScrolledNode.get(); 2577 stopNode = m_previousGestureScrolledNode.get();
2458 2578
2459 bool consumed = false; 2579 bool consumed = false;
2460 ScrollResult result = physicalScroll(granularity, delta, node, &stop Node, &consumed); 2580 ScrollResult result = physicalScroll(
2581 granularity,
2582 delta,
2583 FloatPoint(gestureEvent.position()),
2584 velocity,
2585 node,
2586 &stopNode,
2587 &consumed);
2461 2588
2462 if (gestureEvent.preventPropagation()) 2589 if (gestureEvent.preventPropagation())
2463 m_previousGestureScrolledNode = stopNode; 2590 m_previousGestureScrolledNode = stopNode;
2464 2591
2465 if (m_frame->isMainFrame() && (!stopNode || stopNode->layoutObject() == m_frame->view()->layoutView())) { 2592 if (!stopNode || !isRootScroller(*stopNode))
2466 FloatPoint position = FloatPoint(gestureEvent.position().x(), ge stureEvent.position().y());
2467 handleOverscroll(result, position, velocity);
2468 } else {
2469 resetOverscroll(result.didScrollX, result.didScrollY); 2593 resetOverscroll(result.didScrollX, result.didScrollY);
2470 }
2471 2594
2472 if (consumed) 2595 if (consumed)
2473 return WebInputEventResult::HandledSystem; 2596 return WebInputEventResult::HandledSystem;
2474 } 2597 }
2475 } 2598 }
2476 2599
2477 return WebInputEventResult::NotHandled; 2600 return WebInputEventResult::NotHandled;
2478 } 2601 }
2479 2602
2480 void EventHandler::clearGestureScrollState() 2603 void EventHandler::clearGestureScrollState()
(...skipping 1532 matching lines...) Expand 10 before | Expand all | Expand 10 after
4013 PlatformEvent::Modifiers EventHandler::accessKeyModifiers() 4136 PlatformEvent::Modifiers EventHandler::accessKeyModifiers()
4014 { 4137 {
4015 #if OS(MACOSX) 4138 #if OS(MACOSX)
4016 return static_cast<PlatformEvent::Modifiers>(PlatformEvent::CtrlKey | Platfo rmEvent::AltKey); 4139 return static_cast<PlatformEvent::Modifiers>(PlatformEvent::CtrlKey | Platfo rmEvent::AltKey);
4017 #else 4140 #else
4018 return PlatformEvent::AltKey; 4141 return PlatformEvent::AltKey;
4019 #endif 4142 #endif
4020 } 4143 }
4021 4144
4022 } // namespace blink 4145 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698