Chromium Code Reviews| 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 584 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 595 | 595 |
| 596 return result; | 596 return result; |
| 597 } | 597 } |
| 598 | 598 |
| 599 void EventHandler::stopAutoscroll() | 599 void EventHandler::stopAutoscroll() |
| 600 { | 600 { |
| 601 if (AutoscrollController* controller = autoscrollController()) | 601 if (AutoscrollController* controller = autoscrollController()) |
| 602 controller->stopAutoscroll(); | 602 controller->stopAutoscroll(); |
| 603 } | 603 } |
| 604 | 604 |
| 605 ScrollResultOneDimensional EventHandler::scroll(ScrollDirection direction, Scrol lGranularity granularity, Node* startNode, Node** stopNode, float delta) | 605 ScrollResult EventHandler::physicalScroll(ScrollGranularity granularity, const F loatSize& delta, Node* startNode, Node** stopNode) |
| 606 { | 606 { |
| 607 if (!delta) | 607 if (delta.isZero()) |
| 608 return ScrollResultOneDimensional(false); | 608 return ScrollResult(); |
| 609 | 609 |
| 610 Node* node = startNode; | 610 Node* node = startNode; |
| 611 ASSERT(node && node->layoutObject()); | |
| 612 | |
| 613 m_frame->document()->updateLayoutIgnorePendingStylesheets(); | |
|
tdresser
2016/02/29 14:53:43
Why was this not needed before, but needed now?
bokan
2016/03/01 05:56:24
It was there before too, just before we enter the
| |
| 614 | |
| 615 ScrollResult result; | |
| 616 | |
| 617 LayoutBox* curBox = node->layoutObject()->enclosingBox(); | |
| 618 while (curBox && !curBox->isLayoutView()) { | |
| 619 // If we're at the stopNode, we should try to scroll it but we shouldn't bubble past it | |
|
tdresser
2016/02/29 14:53:43
Missing period.
bokan
2016/03/01 05:56:24
Done.
| |
| 620 bool shouldStopBubbling = stopNode && *stopNode && curBox->node() == *st opNode; | |
| 621 result = curBox->scroll(granularity, delta); | |
| 622 | |
| 623 if (result.didScroll() && stopNode) | |
| 624 *stopNode = curBox->node(); | |
| 625 | |
| 626 if (result.didScroll() || shouldStopBubbling) { | |
| 627 setFrameWasScrolledByUser(); | |
| 628 if (!result.didScroll()) { | |
| 629 // TODO(bokan): We should probably add a "shouldPropagate" bit | |
| 630 // on the result instead rather than lying to the caller. | |
|
tdresser
2016/02/29 14:53:43
instead rather -> rather
bokan
2016/03/01 05:56:24
Done.
| |
| 631 result.didScrollX = true; | |
| 632 result.didScrollY = true; | |
| 633 } | |
| 634 return result; | |
| 635 } | |
| 636 | |
| 637 curBox = curBox->containingBlock(); | |
| 638 } | |
| 639 | |
| 640 return result; | |
| 641 } | |
| 642 | |
| 643 bool EventHandler::logicalScroll(ScrollDirection direction, ScrollGranularity gr anularity, Node* startNode) | |
| 644 { | |
| 645 Node* node = startNode; | |
| 611 | 646 |
| 612 if (!node) | 647 if (!node) |
| 613 node = m_frame->document()->focusedElement(); | 648 node = m_frame->document()->focusedElement(); |
| 614 | 649 |
| 615 if (!node) | 650 if (!node) |
| 616 node = m_mousePressNode.get(); | 651 node = m_mousePressNode.get(); |
| 617 | 652 |
| 618 if (!node || !node->layoutObject()) | 653 if (!node || !node->layoutObject()) |
| 619 return ScrollResultOneDimensional(false, delta); | 654 return false; |
| 620 | 655 |
| 621 m_frame->document()->updateLayoutIgnorePendingStylesheets(); | 656 m_frame->document()->updateLayoutIgnorePendingStylesheets(); |
| 622 | 657 |
| 623 LayoutBox* curBox = node->layoutObject()->enclosingBox(); | 658 LayoutBox* curBox = node->layoutObject()->enclosingBox(); |
| 624 while (curBox && !curBox->isLayoutView()) { | 659 while (curBox && !curBox->isLayoutView()) { |
| 625 ScrollDirectionPhysical physicalDirection = toPhysicalDirection( | 660 ScrollDirectionPhysical physicalDirection = toPhysicalDirection( |
| 626 direction, curBox->isHorizontalWritingMode(), curBox->style()->isFli ppedBlocksWritingMode()); | 661 direction, curBox->isHorizontalWritingMode(), curBox->style()->isFli ppedBlocksWritingMode()); |
| 627 | 662 |
| 628 // If we're at the stopNode, we should try to scroll it but we shouldn't bubble past it | 663 ScrollResult result = curBox->scroll(granularity, toScrollDelta(physical Direction, 1)); |
| 629 bool shouldStopBubbling = stopNode && *stopNode && curBox->node() == *st opNode; | |
| 630 ScrollResultOneDimensional result = curBox->scroll(physicalDirection, gr anularity, delta); | |
| 631 | 664 |
| 632 if (result.didScroll && stopNode) | 665 if (result.didScroll()) { |
| 633 *stopNode = curBox->node(); | |
| 634 | |
| 635 if (result.didScroll || shouldStopBubbling) { | |
| 636 setFrameWasScrolledByUser(); | 666 setFrameWasScrolledByUser(); |
| 637 result.didScroll = true; | 667 return true; |
| 638 return result; | |
| 639 } | 668 } |
| 640 | 669 |
| 641 curBox = curBox->containingBlock(); | 670 curBox = curBox->containingBlock(); |
| 642 } | 671 } |
| 643 | 672 |
| 644 return ScrollResultOneDimensional(false, delta); | 673 return false; |
| 645 } | 674 } |
| 646 | 675 |
| 647 void EventHandler::customizedScroll(const Node& startNode, ScrollState& scrollSt ate) | 676 void EventHandler::customizedScroll(const Node& startNode, ScrollState& scrollSt ate) |
| 648 { | 677 { |
| 649 if (scrollState.fullyConsumed()) | 678 if (scrollState.fullyConsumed()) |
| 650 return; | 679 return; |
| 651 | 680 |
| 652 if (scrollState.deltaX() || scrollState.deltaY()) | 681 if (scrollState.deltaX() || scrollState.deltaY()) |
| 653 m_frame->document()->updateLayoutIgnorePendingStylesheets(); | 682 m_frame->document()->updateLayoutIgnorePendingStylesheets(); |
| 654 | 683 |
| 655 if (m_currentScrollChain.empty()) | 684 if (m_currentScrollChain.empty()) |
| 656 recomputeScrollChain(*m_frame, startNode, m_currentScrollChain); | 685 recomputeScrollChain(*m_frame, startNode, m_currentScrollChain); |
| 657 scrollState.setScrollChain(m_currentScrollChain); | 686 scrollState.setScrollChain(m_currentScrollChain); |
| 658 | 687 |
| 659 scrollState.distributeToScrollChainDescendant(); | 688 scrollState.distributeToScrollChainDescendant(); |
| 660 } | 689 } |
| 661 | 690 |
| 691 // TODO(bokan): This should be merged with logicalScroll assuming | |
| 692 // defaultSpaceEventHandler's bubbling scroll can be done crossing frames. | |
| 662 bool EventHandler::bubblingScroll(ScrollDirection direction, ScrollGranularity g ranularity, Node* startingNode) | 693 bool EventHandler::bubblingScroll(ScrollDirection direction, ScrollGranularity g ranularity, Node* startingNode) |
| 663 { | 694 { |
| 664 // The layout needs to be up to date to determine if we can scroll. We may b e | 695 // The layout needs to be up to date to determine if we can scroll. We may b e |
| 665 // here because of an onLoad event, in which case the final layout hasn't be en performed yet. | 696 // here because of an onLoad event, in which case the final layout hasn't be en performed yet. |
| 666 m_frame->document()->updateLayoutIgnorePendingStylesheets(); | 697 m_frame->document()->updateLayoutIgnorePendingStylesheets(); |
| 667 // FIXME: enable scroll customization in this case. See crbug.com/410974. | 698 // FIXME: enable scroll customization in this case. See crbug.com/410974. |
| 668 if (scroll(direction, granularity, startingNode).didScroll) | 699 if (logicalScroll(direction, granularity, startingNode)) |
| 669 return true; | 700 return true; |
| 670 LocalFrame* frame = m_frame; | 701 LocalFrame* frame = m_frame; |
| 671 FrameView* view = frame->view(); | 702 FrameView* view = frame->view(); |
| 672 if (view) { | 703 if (view) { |
| 673 ScrollDirectionPhysical physicalDirection = | 704 ScrollDirectionPhysical physicalDirection = |
| 674 toPhysicalDirection(direction, view->isVerticalDocument(), view->isF lippedDocument()); | 705 toPhysicalDirection(direction, view->isVerticalDocument(), view->isF lippedDocument()); |
| 675 if (view->scrollableArea()->userScroll(physicalDirection, granularity).d idScroll) { | 706 if (view->scrollableArea()->userScroll(granularity, toScrollDelta(physic alDirection, 1)).didScroll()) { |
| 676 setFrameWasScrolledByUser(); | 707 setFrameWasScrolledByUser(); |
| 677 return true; | 708 return true; |
| 678 } | 709 } |
| 679 } | 710 } |
| 680 | 711 |
| 681 Frame* parentFrame = frame->tree().parent(); | 712 Frame* parentFrame = frame->tree().parent(); |
| 682 if (!parentFrame || !parentFrame->isLocalFrame()) | 713 if (!parentFrame || !parentFrame->isLocalFrame()) |
| 683 return false; | 714 return false; |
| 684 // FIXME: Broken for OOPI. | 715 // FIXME: Broken for OOPI. |
| 685 return toLocalFrame(parentFrame)->eventHandler().bubblingScroll(direction, g ranularity, m_frame->deprecatedLocalOwner()); | 716 return toLocalFrame(parentFrame)->eventHandler().bubblingScroll(direction, g ranularity, m_frame->deprecatedLocalOwner()); |
| (...skipping 1061 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1747 | 1778 |
| 1748 // If the event is a "PageWheelEvent" we should disregard the delta and | 1779 // If the event is a "PageWheelEvent" we should disregard the delta and |
| 1749 // scroll by *one* page length per event. | 1780 // scroll by *one* page length per event. |
| 1750 if (event.granularity() == ScrollByPageWheelEvent) { | 1781 if (event.granularity() == ScrollByPageWheelEvent) { |
| 1751 if (deltaX) | 1782 if (deltaX) |
| 1752 deltaX = deltaX > 0 ? 1 : -1; | 1783 deltaX = deltaX > 0 ? 1 : -1; |
| 1753 if (deltaY) | 1784 if (deltaY) |
| 1754 deltaY = deltaY > 0 ? 1 : -1; | 1785 deltaY = deltaY > 0 ? 1 : -1; |
| 1755 } | 1786 } |
| 1756 | 1787 |
| 1757 // Positive delta is up and left. | 1788 // On a wheel event, positive delta is meant to scroll up and left, which |
| 1758 ScrollResultOneDimensional resultY = scrollableArea.userScroll(ScrollUp, gra nularity, deltaY); | 1789 // is the opposite of deltas in the scrolling system. |
| 1759 ScrollResultOneDimensional resultX = scrollableArea.userScroll(ScrollLeft, g ranularity, deltaX); | 1790 return scrollableArea.userScroll(granularity, FloatSize(-deltaX, -deltaY)); |
| 1760 | |
| 1761 ScrollResult result; | |
| 1762 result.didScrollY = resultY.didScroll; | |
| 1763 result.didScrollX = resultX.didScroll; | |
| 1764 result.unusedScrollDeltaY = resultY.unusedScrollDelta; | |
| 1765 result.unusedScrollDeltaX = resultX.unusedScrollDelta; | |
| 1766 return result; | |
| 1767 } | 1791 } |
| 1768 | 1792 |
| 1769 } // namespace | 1793 } // namespace |
| 1770 | 1794 |
| 1771 WebInputEventResult EventHandler::handleWheelEvent(const PlatformWheelEvent& eve nt) | 1795 WebInputEventResult EventHandler::handleWheelEvent(const PlatformWheelEvent& eve nt) |
| 1772 { | 1796 { |
| 1773 Document* doc = m_frame->document(); | 1797 Document* doc = m_frame->document(); |
| 1774 | 1798 |
| 1775 if (!doc->layoutView()) | 1799 if (!doc->layoutView()) |
| 1776 return WebInputEventResult::NotHandled; | 1800 return WebInputEventResult::NotHandled; |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1845 if (!startNode || !wheelEvent) | 1869 if (!startNode || !wheelEvent) |
| 1846 return; | 1870 return; |
| 1847 | 1871 |
| 1848 // When the wheelEvent do not scroll, we trigger zoom in/out instead. | 1872 // When the wheelEvent do not scroll, we trigger zoom in/out instead. |
| 1849 if (!wheelEvent->canScroll()) | 1873 if (!wheelEvent->canScroll()) |
| 1850 return; | 1874 return; |
| 1851 | 1875 |
| 1852 Node* stopNode = m_previousWheelScrolledNode.get(); | 1876 Node* stopNode = m_previousWheelScrolledNode.get(); |
| 1853 ScrollGranularity granularity = wheelGranularityToScrollGranularity(wheelEve nt); | 1877 ScrollGranularity granularity = wheelGranularityToScrollGranularity(wheelEve nt); |
| 1854 | 1878 |
| 1855 // Break up into two scrolls if we need to. Diagonal movement on | 1879 // Diagonal movement on a MacBook pro is an example of a 2-dimensional |
| 1856 // a MacBook pro is an example of a 2-dimensional mouse wheel event (where b oth deltaX and deltaY can be set). | 1880 // mouse wheel event (where both deltaX and deltaY can be set). |
| 1881 FloatSize delta; | |
| 1882 | |
| 1883 if (wheelEvent->getRailsMode() != Event::RailsModeVertical) | |
| 1884 delta.setWidth(wheelEvent->deltaX()); | |
| 1885 | |
| 1886 if (wheelEvent->getRailsMode() != Event::RailsModeHorizontal) | |
| 1887 delta.setHeight(wheelEvent->deltaY()); | |
| 1857 | 1888 |
| 1858 // FIXME: enable scroll customization in this case. See crbug.com/410974. | 1889 // FIXME: enable scroll customization in this case. See crbug.com/410974. |
| 1859 if (wheelEvent->getRailsMode() != Event::RailsModeVertical | 1890 ScrollResult result = physicalScroll(granularity, delta, startNode, &stopNod e); |
| 1860 && scroll(ScrollRightIgnoringWritingMode, granularity, startNode, &stopN ode, wheelEvent->deltaX()).didScroll) | |
| 1861 wheelEvent->setDefaultHandled(); | |
| 1862 | 1891 |
| 1863 if (wheelEvent->getRailsMode() != Event::RailsModeHorizontal | 1892 if (result.didScroll()) |
| 1864 && scroll(ScrollDownIgnoringWritingMode, granularity, startNode, &stopNo de, wheelEvent->deltaY()).didScroll) | |
| 1865 wheelEvent->setDefaultHandled(); | 1893 wheelEvent->setDefaultHandled(); |
| 1866 | 1894 |
| 1867 m_previousWheelScrolledNode = stopNode; | 1895 m_previousWheelScrolledNode = stopNode; |
| 1868 } | 1896 } |
| 1869 | 1897 |
| 1870 WebInputEventResult EventHandler::handleGestureShowPress() | 1898 WebInputEventResult EventHandler::handleGestureShowPress() |
| 1871 { | 1899 { |
| 1872 m_lastShowPressTimestamp = WTF::monotonicallyIncreasingTime(); | 1900 m_lastShowPressTimestamp = WTF::monotonicallyIncreasingTime(); |
| 1873 | 1901 |
| 1874 FrameView* view = m_frame->view(); | 1902 FrameView* view = m_frame->view(); |
| (...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2349 if (unusedDelta != FloatSize()) { | 2377 if (unusedDelta != FloatSize()) { |
| 2350 m_accumulatedRootOverscroll += unusedDelta; | 2378 m_accumulatedRootOverscroll += unusedDelta; |
| 2351 m_frame->chromeClient().didOverscroll(unusedDelta, m_accumulatedRootOver scroll, position, velocity); | 2379 m_frame->chromeClient().didOverscroll(unusedDelta, m_accumulatedRootOver scroll, position, velocity); |
| 2352 } | 2380 } |
| 2353 } | 2381 } |
| 2354 | 2382 |
| 2355 WebInputEventResult EventHandler::handleGestureScrollUpdate(const PlatformGestur eEvent& gestureEvent) | 2383 WebInputEventResult EventHandler::handleGestureScrollUpdate(const PlatformGestur eEvent& gestureEvent) |
| 2356 { | 2384 { |
| 2357 ASSERT(gestureEvent.type() == PlatformEvent::GestureScrollUpdate); | 2385 ASSERT(gestureEvent.type() == PlatformEvent::GestureScrollUpdate); |
| 2358 | 2386 |
| 2387 // TODO(bokan): This delta is specific to the event which is positive up and | |
| 2388 // to the left. Since we're passing it into a bunch of scrolling code below, | |
| 2389 // it should probably be inverted here. | |
| 2359 FloatSize delta(gestureEvent.deltaX(), gestureEvent.deltaY()); | 2390 FloatSize delta(gestureEvent.deltaX(), gestureEvent.deltaY()); |
| 2360 if (delta.isZero()) | 2391 if (delta.isZero()) |
| 2361 return WebInputEventResult::NotHandled; | 2392 return WebInputEventResult::NotHandled; |
| 2362 | 2393 |
| 2363 ScrollGranularity granularity = gestureEvent.deltaUnits(); | 2394 ScrollGranularity granularity = gestureEvent.deltaUnits(); |
| 2364 Node* node = m_scrollGestureHandlingNode.get(); | 2395 Node* node = m_scrollGestureHandlingNode.get(); |
| 2365 | 2396 |
| 2366 // Scroll customization is only available for touch. | 2397 // Scroll customization is only available for touch. |
| 2367 bool handleScrollCustomization = RuntimeEnabledFeatures::scrollCustomization Enabled() && gestureEvent.source() == PlatformGestureSourceTouchscreen; | 2398 bool handleScrollCustomization = RuntimeEnabledFeatures::scrollCustomization Enabled() && gestureEvent.source() == PlatformGestureSourceTouchscreen; |
| 2368 if (node) { | 2399 if (node) { |
| 2369 LayoutObject* layoutObject = node->layoutObject(); | 2400 LayoutObject* layoutObject = node->layoutObject(); |
| 2370 if (!layoutObject) | 2401 if (!layoutObject) |
| 2371 return WebInputEventResult::NotHandled; | 2402 return WebInputEventResult::NotHandled; |
| 2372 | 2403 |
| 2373 RefPtrWillBeRawPtr<FrameView> protector(m_frame->view()); | 2404 RefPtrWillBeRawPtr<FrameView> protector(m_frame->view()); |
| 2374 | 2405 |
| 2375 Node* stopNode = nullptr; | |
| 2376 | |
| 2377 // Try to send the event to the correct view. | 2406 // Try to send the event to the correct view. |
| 2378 WebInputEventResult result = passScrollGestureEventToWidget(gestureEvent , layoutObject); | 2407 WebInputEventResult result = passScrollGestureEventToWidget(gestureEvent , layoutObject); |
| 2379 if (result != WebInputEventResult::NotHandled) { | 2408 if (result != WebInputEventResult::NotHandled) { |
| 2380 if (gestureEvent.preventPropagation() | 2409 if (gestureEvent.preventPropagation() |
| 2381 && !RuntimeEnabledFeatures::scrollCustomizationEnabled()) { | 2410 && !RuntimeEnabledFeatures::scrollCustomizationEnabled()) { |
| 2382 // This is an optimization which doesn't apply with | 2411 // This is an optimization which doesn't apply with |
| 2383 // scroll customization enabled. | 2412 // scroll customization enabled. |
| 2384 m_previousGestureScrolledNode = m_scrollGestureHandlingNode; | 2413 m_previousGestureScrolledNode = m_scrollGestureHandlingNode; |
| 2385 } | 2414 } |
| 2386 // FIXME: we should allow simultaneous scrolling of nested | 2415 // FIXME: we should allow simultaneous scrolling of nested |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 2408 // currently scrolling element responds. | 2437 // currently scrolling element responds. |
| 2409 ASSERT(m_previousGestureScrolledNode->isElementNode()); | 2438 ASSERT(m_previousGestureScrolledNode->isElementNode()); |
| 2410 scrollState->setCurrentNativeScrollingElement(toElement(m_previo usGestureScrolledNode.get())); | 2439 scrollState->setCurrentNativeScrollingElement(toElement(m_previo usGestureScrolledNode.get())); |
| 2411 } | 2440 } |
| 2412 customizedScroll(*node, *scrollState); | 2441 customizedScroll(*node, *scrollState); |
| 2413 m_previousGestureScrolledNode = scrollState->currentNativeScrollingE lement(); | 2442 m_previousGestureScrolledNode = scrollState->currentNativeScrollingE lement(); |
| 2414 m_deltaConsumedForScrollSequence = scrollState->deltaConsumedForScro llSequence(); | 2443 m_deltaConsumedForScrollSequence = scrollState->deltaConsumedForScro llSequence(); |
| 2415 scrolled = scrollState->deltaX() != gestureEvent.deltaX() | 2444 scrolled = scrollState->deltaX() != gestureEvent.deltaX() |
| 2416 || scrollState->deltaY() != gestureEvent.deltaY(); | 2445 || scrollState->deltaY() != gestureEvent.deltaY(); |
| 2417 } else { | 2446 } else { |
| 2447 Node* stopNode = nullptr; | |
| 2418 if (gestureEvent.preventPropagation()) | 2448 if (gestureEvent.preventPropagation()) |
| 2419 stopNode = m_previousGestureScrolledNode.get(); | 2449 stopNode = m_previousGestureScrolledNode.get(); |
| 2420 | 2450 |
| 2421 // First try to scroll the closest scrollable LayoutBox ancestor of |node|. | 2451 // Scale by -1 because the delta is the GestureEvent delta (see TODO at top of function). |
| 2422 ScrollResultOneDimensional result = scroll(ScrollLeftIgnoringWriting Mode, granularity, node, &stopNode, delta.width()); | 2452 ScrollResult result = physicalScroll(granularity, delta.scaledBy(-1) , node, &stopNode); |
| 2423 bool horizontalScroll = result.didScroll; | 2453 |
| 2424 if (!gestureEvent.preventPropagation()) | 2454 scrolled = result.didScroll(); |
| 2425 stopNode = nullptr; | |
| 2426 result = scroll(ScrollUpIgnoringWritingMode, granularity, node, &sto pNode, delta.height()); | |
| 2427 bool verticalScroll = result.didScroll; | |
| 2428 scrolled = horizontalScroll || verticalScroll; | |
| 2429 | 2455 |
| 2430 if (gestureEvent.preventPropagation()) | 2456 if (gestureEvent.preventPropagation()) |
| 2431 m_previousGestureScrolledNode = stopNode; | 2457 m_previousGestureScrolledNode = stopNode; |
| 2432 | 2458 |
| 2433 resetOverscroll(horizontalScroll, verticalScroll); | 2459 resetOverscroll(result.didScrollX, result.didScrollY); |
| 2434 } | 2460 } |
| 2435 if (scrolled) { | 2461 if (scrolled) { |
| 2436 setFrameWasScrolledByUser(); | 2462 setFrameWasScrolledByUser(); |
| 2437 return WebInputEventResult::HandledSystem; | 2463 return WebInputEventResult::HandledSystem; |
| 2438 } | 2464 } |
| 2439 } | 2465 } |
| 2440 | 2466 |
| 2441 if (handleScrollCustomization) | 2467 if (handleScrollCustomization) |
| 2442 return WebInputEventResult::NotHandled; | 2468 return WebInputEventResult::NotHandled; |
| 2443 | 2469 |
| (...skipping 957 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3401 void EventHandler::defaultSpaceEventHandler(KeyboardEvent* event) | 3427 void EventHandler::defaultSpaceEventHandler(KeyboardEvent* event) |
| 3402 { | 3428 { |
| 3403 ASSERT(event->type() == EventTypeNames::keypress); | 3429 ASSERT(event->type() == EventTypeNames::keypress); |
| 3404 | 3430 |
| 3405 if (event->ctrlKey() || event->metaKey() || event->altKey()) | 3431 if (event->ctrlKey() || event->metaKey() || event->altKey()) |
| 3406 return; | 3432 return; |
| 3407 | 3433 |
| 3408 ScrollDirection direction = event->shiftKey() ? ScrollBlockDirectionBackward : ScrollBlockDirectionForward; | 3434 ScrollDirection direction = event->shiftKey() ? ScrollBlockDirectionBackward : ScrollBlockDirectionForward; |
| 3409 | 3435 |
| 3410 // FIXME: enable scroll customization in this case. See crbug.com/410974. | 3436 // FIXME: enable scroll customization in this case. See crbug.com/410974. |
| 3411 if (scroll(direction, ScrollByPage).didScroll) { | 3437 if (logicalScroll(direction, ScrollByPage)) { |
| 3412 event->setDefaultHandled(); | 3438 event->setDefaultHandled(); |
| 3413 return; | 3439 return; |
| 3414 } | 3440 } |
| 3415 | 3441 |
| 3416 FrameView* view = m_frame->view(); | 3442 FrameView* view = m_frame->view(); |
| 3417 if (!view) | 3443 if (!view) |
| 3418 return; | 3444 return; |
| 3419 | 3445 |
| 3420 ScrollDirectionPhysical physicalDirection = | 3446 ScrollDirectionPhysical physicalDirection = |
| 3421 toPhysicalDirection(direction, view->isVerticalDocument(), view->isFlipp edDocument()); | 3447 toPhysicalDirection(direction, view->isVerticalDocument(), view->isFlipp edDocument()); |
| 3422 | 3448 |
| 3423 if (view->scrollableArea()->userScroll(physicalDirection, ScrollByPage).didS croll) | 3449 if (view->scrollableArea()->userScroll(ScrollByPage, toScrollDelta(physicalD irection, 1)).didScroll()) |
| 3424 event->setDefaultHandled(); | 3450 event->setDefaultHandled(); |
| 3425 } | 3451 } |
| 3426 | 3452 |
| 3427 void EventHandler::defaultBackspaceEventHandler(KeyboardEvent* event) | 3453 void EventHandler::defaultBackspaceEventHandler(KeyboardEvent* event) |
| 3428 { | 3454 { |
| 3429 ASSERT(event->type() == EventTypeNames::keydown); | 3455 ASSERT(event->type() == EventTypeNames::keydown); |
| 3430 | 3456 |
| 3431 if (event->ctrlKey() || event->metaKey() || event->altKey()) | 3457 if (event->ctrlKey() || event->metaKey() || event->altKey()) |
| 3432 return; | 3458 return; |
| 3433 | 3459 |
| (...skipping 548 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3982 PlatformEvent::Modifiers EventHandler::accessKeyModifiers() | 4008 PlatformEvent::Modifiers EventHandler::accessKeyModifiers() |
| 3983 { | 4009 { |
| 3984 #if OS(MACOSX) | 4010 #if OS(MACOSX) |
| 3985 return static_cast<PlatformEvent::Modifiers>(PlatformEvent::CtrlKey | Platfo rmEvent::AltKey); | 4011 return static_cast<PlatformEvent::Modifiers>(PlatformEvent::CtrlKey | Platfo rmEvent::AltKey); |
| 3986 #else | 4012 #else |
| 3987 return PlatformEvent::AltKey; | 4013 return PlatformEvent::AltKey; |
| 3988 #endif | 4014 #endif |
| 3989 } | 4015 } |
| 3990 | 4016 |
| 3991 } // namespace blink | 4017 } // namespace blink |
| OLD | NEW |