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 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 Loading... |
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 Loading... |
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 ViewportScrollCallback is installed on the body, we |
| 639 // can still hit the HTML element for scrolling in which case it'll bubble |
| 640 // up to the document node and try to scroll the LayoutView directly. Make |
| 641 // sure we never scroll the LayoutView like this by manually resetting the |
| 642 // scroll to happen on the scrolling element. This can also happen in |
| 643 // QuirksMode when 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->position_x = position.x(); |
| 671 scrollStateData->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 Loading... |
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 472 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2386 FloatPoint positionInViewport = | 2491 FloatPoint positionInViewport = |
2387 visualViewport.rootFrameToViewport(positionInRootFrame); | 2492 visualViewport.rootFrameToViewport(positionInRootFrame); |
2388 | 2493 |
2389 resetOverscroll(scrollResult.didScrollX, scrollResult.didScrollY); | 2494 resetOverscroll(scrollResult.didScrollX, scrollResult.didScrollY); |
2390 if (deltaInViewport != FloatSize()) { | 2495 if (deltaInViewport != FloatSize()) { |
2391 m_accumulatedRootOverscroll += deltaInViewport; | 2496 m_accumulatedRootOverscroll += deltaInViewport; |
2392 m_frame->chromeClient().didOverscroll(deltaInViewport, m_accumulatedRoot
Overscroll, positionInViewport, velocityInViewport); | 2497 m_frame->chromeClient().didOverscroll(deltaInViewport, m_accumulatedRoot
Overscroll, positionInViewport, velocityInViewport); |
2393 } | 2498 } |
2394 } | 2499 } |
2395 | 2500 |
| 2501 bool EventHandler::isRootScroller(const Node& node) const |
| 2502 { |
| 2503 // The root scroller is the one Element on the page designated to perform |
| 2504 // "viewport actions" like top controls movement and overscroll glow. |
| 2505 |
| 2506 if (!node.isElementNode() || node.document().ownerElement()) |
| 2507 return false; |
| 2508 |
| 2509 Element* scrollingElement = node.document().scrollingElement(); |
| 2510 return scrollingElement |
| 2511 ? toElement(&node) == node.document().scrollingElement() |
| 2512 : toElement(&node) == node.document().documentElement(); |
| 2513 } |
| 2514 |
2396 WebInputEventResult EventHandler::handleGestureScrollUpdate(const PlatformGestur
eEvent& gestureEvent) | 2515 WebInputEventResult EventHandler::handleGestureScrollUpdate(const PlatformGestur
eEvent& gestureEvent) |
2397 { | 2516 { |
2398 ASSERT(gestureEvent.type() == PlatformEvent::GestureScrollUpdate); | 2517 ASSERT(gestureEvent.type() == PlatformEvent::GestureScrollUpdate); |
2399 | 2518 |
2400 // Negate the deltas since the gesture event stores finger movement and | 2519 // Negate the deltas since the gesture event stores finger movement and |
2401 // scrolling occurs in the direction opposite the finger's movement | 2520 // scrolling occurs in the direction opposite the finger's movement |
2402 // direction. e.g. Finger moving up has negative event delta but causes the | 2521 // direction. e.g. Finger moving up has negative event delta but causes the |
2403 // page to scroll down causing positive scroll delta. | 2522 // page to scroll down causing positive scroll delta. |
2404 FloatSize delta(-gestureEvent.deltaX(), -gestureEvent.deltaY()); | 2523 FloatSize delta(-gestureEvent.deltaX(), -gestureEvent.deltaY()); |
2405 FloatSize velocity(-gestureEvent.velocityX(), -gestureEvent.velocityY()); | 2524 FloatSize velocity(-gestureEvent.velocityX(), -gestureEvent.velocityY()); |
(...skipping 22 matching lines...) Expand all Loading... |
2428 // FIXME: we should allow simultaneous scrolling of nested | 2547 // FIXME: we should allow simultaneous scrolling of nested |
2429 // iframes along perpendicular axes. See crbug.com/466991. | 2548 // iframes along perpendicular axes. See crbug.com/466991. |
2430 m_deltaConsumedForScrollSequence = true; | 2549 m_deltaConsumedForScrollSequence = true; |
2431 return result; | 2550 return result; |
2432 } | 2551 } |
2433 | 2552 |
2434 if (handleScrollCustomization) { | 2553 if (handleScrollCustomization) { |
2435 OwnPtr<ScrollStateData> scrollStateData = adoptPtr(new ScrollStateDa
ta()); | 2554 OwnPtr<ScrollStateData> scrollStateData = adoptPtr(new ScrollStateDa
ta()); |
2436 scrollStateData->delta_x = delta.width(); | 2555 scrollStateData->delta_x = delta.width(); |
2437 scrollStateData->delta_y = delta.height(); | 2556 scrollStateData->delta_y = delta.height(); |
| 2557 scrollStateData->delta_granularity = ScrollByPrecisePixel; |
2438 scrollStateData->velocity_x = velocity.width(); | 2558 scrollStateData->velocity_x = velocity.width(); |
2439 scrollStateData->velocity_y = velocity.height(); | 2559 scrollStateData->velocity_y = velocity.height(); |
2440 scrollStateData->should_propagate = !gestureEvent.preventPropagation
(); | 2560 scrollStateData->should_propagate = !gestureEvent.preventPropagation
(); |
2441 scrollStateData->is_in_inertial_phase = gestureEvent.inertial(); | 2561 scrollStateData->is_in_inertial_phase = gestureEvent.inertial(); |
2442 scrollStateData->from_user_input = true; | 2562 scrollStateData->from_user_input = true; |
2443 scrollStateData->delta_consumed_for_scroll_sequence = m_deltaConsume
dForScrollSequence; | 2563 scrollStateData->delta_consumed_for_scroll_sequence = m_deltaConsume
dForScrollSequence; |
2444 ScrollState* scrollState = ScrollState::create(scrollStateData.relea
se()); | 2564 ScrollState* scrollState = ScrollState::create(scrollStateData.relea
se()); |
2445 if (m_previousGestureScrolledNode) { | 2565 if (m_previousGestureScrolledNode) { |
2446 // The ScrollState needs to know what the current | 2566 // The ScrollState needs to know what the current |
2447 // native scrolling element is, so that for an | 2567 // native scrolling element is, so that for an |
2448 // inertial scroll that shouldn't propagate, only the | 2568 // inertial scroll that shouldn't propagate, only the |
2449 // currently scrolling element responds. | 2569 // currently scrolling element responds. |
2450 ASSERT(m_previousGestureScrolledNode->isElementNode()); | 2570 ASSERT(m_previousGestureScrolledNode->isElementNode()); |
2451 scrollState->setCurrentNativeScrollingElement(toElement(m_previo
usGestureScrolledNode.get())); | 2571 scrollState->setCurrentNativeScrollingElement(toElement(m_previo
usGestureScrolledNode.get())); |
2452 } | 2572 } |
2453 customizedScroll(*node, *scrollState); | 2573 customizedScroll(*node, *scrollState); |
2454 m_previousGestureScrolledNode = scrollState->currentNativeScrollingE
lement(); | 2574 m_previousGestureScrolledNode = scrollState->currentNativeScrollingE
lement(); |
2455 m_deltaConsumedForScrollSequence = scrollState->deltaConsumedForScro
llSequence(); | 2575 m_deltaConsumedForScrollSequence = scrollState->deltaConsumedForScro
llSequence(); |
2456 if (scrollState->deltaX() != delta.width() | 2576 if (scrollState->deltaX() != delta.width() |
2457 || scrollState->deltaY() != delta.height()) { | 2577 || scrollState->deltaY() != delta.height()) { |
2458 setFrameWasScrolledByUser(); | 2578 setFrameWasScrolledByUser(); |
2459 return WebInputEventResult::HandledSystem; | 2579 return WebInputEventResult::HandledSystem; |
2460 } | 2580 } |
2461 } else { | 2581 } else { |
2462 Node* stopNode = nullptr; | 2582 Node* stopNode = nullptr; |
2463 if (gestureEvent.preventPropagation()) | 2583 if (gestureEvent.preventPropagation()) |
2464 stopNode = m_previousGestureScrolledNode.get(); | 2584 stopNode = m_previousGestureScrolledNode.get(); |
2465 | 2585 |
2466 bool consumed = false; | 2586 bool consumed = false; |
2467 ScrollResult result = physicalScroll(granularity, delta, node, &stop
Node, &consumed); | 2587 ScrollResult result = physicalScroll( |
| 2588 granularity, |
| 2589 delta, |
| 2590 FloatPoint(gestureEvent.position()), |
| 2591 velocity, |
| 2592 node, |
| 2593 &stopNode, |
| 2594 &consumed); |
2468 | 2595 |
2469 if (gestureEvent.preventPropagation()) | 2596 if (gestureEvent.preventPropagation()) |
2470 m_previousGestureScrolledNode = stopNode; | 2597 m_previousGestureScrolledNode = stopNode; |
2471 | 2598 |
2472 if (m_frame->isMainFrame() && (!stopNode || stopNode->layoutObject()
== m_frame->view()->layoutView())) { | 2599 if (!stopNode || !isRootScroller(*stopNode)) |
2473 FloatPoint positionInRootFrame = FloatPoint(gestureEvent.positio
n().x(), gestureEvent.position().y()); | |
2474 handleOverscroll(result, positionInRootFrame, velocity); | |
2475 } else { | |
2476 resetOverscroll(result.didScrollX, result.didScrollY); | 2600 resetOverscroll(result.didScrollX, result.didScrollY); |
2477 } | |
2478 | 2601 |
2479 if (consumed) | 2602 if (consumed) |
2480 return WebInputEventResult::HandledSystem; | 2603 return WebInputEventResult::HandledSystem; |
2481 } | 2604 } |
2482 } | 2605 } |
2483 | 2606 |
2484 return WebInputEventResult::NotHandled; | 2607 return WebInputEventResult::NotHandled; |
2485 } | 2608 } |
2486 | 2609 |
2487 void EventHandler::clearGestureScrollState() | 2610 void EventHandler::clearGestureScrollState() |
(...skipping 1535 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4023 PlatformEvent::Modifiers EventHandler::accessKeyModifiers() | 4146 PlatformEvent::Modifiers EventHandler::accessKeyModifiers() |
4024 { | 4147 { |
4025 #if OS(MACOSX) | 4148 #if OS(MACOSX) |
4026 return static_cast<PlatformEvent::Modifiers>(PlatformEvent::CtrlKey | Platfo
rmEvent::AltKey); | 4149 return static_cast<PlatformEvent::Modifiers>(PlatformEvent::CtrlKey | Platfo
rmEvent::AltKey); |
4027 #else | 4150 #else |
4028 return PlatformEvent::AltKey; | 4151 return PlatformEvent::AltKey; |
4029 #endif | 4152 #endif |
4030 } | 4153 } |
4031 | 4154 |
4032 } // namespace blink | 4155 } // namespace blink |
OLD | NEW |