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