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

Side by Side Diff: sky/engine/core/page/EventHandler.cpp

Issue 684063002: Remove more frame-level scrolling machinery. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years, 1 month 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
« no previous file with comments | « sky/engine/core/page/EventHandler.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 766 matching lines...) Expand 10 before | Expand all | Expand 10 after
777 RenderBox* curBox = node->renderer()->enclosingBox(); 777 RenderBox* curBox = node->renderer()->enclosingBox();
778 while (curBox && !curBox->isRenderView()) { 778 while (curBox && !curBox->isRenderView()) {
779 // If we're at the stopNode, we should try to scroll it but we shouldn't bubble past it 779 // If we're at the stopNode, we should try to scroll it but we shouldn't bubble past it
780 bool shouldStopBubbling = stopNode && *stopNode && curBox->node() == *st opNode; 780 bool shouldStopBubbling = stopNode && *stopNode && curBox->node() == *st opNode;
781 bool didScroll = curBox->scroll(direction, granularity, delta); 781 bool didScroll = curBox->scroll(direction, granularity, delta);
782 782
783 if (didScroll && stopNode) 783 if (didScroll && stopNode)
784 *stopNode = curBox->node(); 784 *stopNode = curBox->node();
785 785
786 if (didScroll || shouldStopBubbling) { 786 if (didScroll || shouldStopBubbling) {
787 setFrameWasScrolledByUser();
788 return true; 787 return true;
789 } 788 }
790 789
791 curBox = curBox->containingBlock(); 790 curBox = curBox->containingBlock();
792 } 791 }
793 792
794 return false; 793 return false;
795 } 794 }
796 795
797 bool EventHandler::bubblingScroll(ScrollDirection direction, ScrollGranularity g ranularity, Node* startingNode) 796 bool EventHandler::bubblingScroll(ScrollDirection direction, ScrollGranularity g ranularity, Node* startingNode)
(...skipping 676 matching lines...) Expand 10 before | Expand all | Expand 10 after
1474 HitTestResult result(windowPoint); 1473 HitTestResult result(windowPoint);
1475 renderView->hitTest(request, result); 1474 renderView->hitTest(request, result);
1476 return result.scrollbar(); 1475 return result.scrollbar();
1477 } 1476 }
1478 1477
1479 return false; 1478 return false;
1480 } 1479 }
1481 1480
1482 bool EventHandler::handleWheelEvent(const PlatformWheelEvent& event) 1481 bool EventHandler::handleWheelEvent(const PlatformWheelEvent& event)
1483 { 1482 {
1484 #define RETURN_WHEEL_EVENT_HANDLED() \ 1483 #define RETURN_WHEEL_EVENT_HANDLED() \
esprehn 2014/10/29 03:06:48 you should remove the macro, all it did was call t
1485 { \ 1484 { \
1486 setFrameWasScrolledByUser(); \
1487 return true; \ 1485 return true; \
1488 } 1486 }
1489 1487
1490 Document* doc = m_frame->document(); 1488 Document* doc = m_frame->document();
1491 1489
1492 if (!doc->renderView()) 1490 if (!doc->renderView())
1493 return false; 1491 return false;
1494 1492
1495 RefPtr<FrameView> protector(m_frame->view()); 1493 RefPtr<FrameView> protector(m_frame->view());
1496 1494
(...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after
1929 1927
1930 // First try to scroll the closest scrollable RenderBox ancestor of |node|. 1928 // First try to scroll the closest scrollable RenderBox ancestor of |node|.
1931 ScrollGranularity granularity = ScrollByPixel; 1929 ScrollGranularity granularity = ScrollByPixel;
1932 bool horizontalScroll = scroll(ScrollLeft, granularity, node, &stopNode, del ta.width()); 1930 bool horizontalScroll = scroll(ScrollLeft, granularity, node, &stopNode, del ta.width());
1933 bool verticalScroll = scroll(ScrollUp, granularity, node, &stopNode, delta.h eight()); 1931 bool verticalScroll = scroll(ScrollUp, granularity, node, &stopNode, delta.h eight());
1934 1932
1935 if (scrollShouldNotPropagate) 1933 if (scrollShouldNotPropagate)
1936 m_previousGestureScrolledNode = stopNode; 1934 m_previousGestureScrolledNode = stopNode;
1937 1935
1938 if (horizontalScroll || verticalScroll) { 1936 if (horizontalScroll || verticalScroll) {
1939 setFrameWasScrolledByUser();
1940 return true; 1937 return true;
1941 } 1938 }
1942 1939
1943 // Otherwise try to scroll the view. 1940 // Otherwise try to scroll the view.
1944 return sendScrollEventToView(gestureEvent, delta); 1941 return sendScrollEventToView(gestureEvent, delta);
1945 } 1942 }
1946 1943
1947 bool EventHandler::sendScrollEventToView(const PlatformGestureEvent& gestureEven t, const FloatSize& scaledDelta) 1944 bool EventHandler::sendScrollEventToView(const PlatformGestureEvent& gestureEven t, const FloatSize& scaledDelta)
1948 { 1945 {
1949 FrameView* view = m_frame->view(); 1946 FrameView* view = m_frame->view();
1950 if (!view) 1947 if (!view)
1951 return false; 1948 return false;
1952 1949
1953 const float tickDivisor = static_cast<float>(WheelEvent::TickMultiplier); 1950 const float tickDivisor = static_cast<float>(WheelEvent::TickMultiplier);
1954 IntPoint point(gestureEvent.position().x(), gestureEvent.position().y()); 1951 IntPoint point(gestureEvent.position().x(), gestureEvent.position().y());
1955 IntPoint globalPoint(gestureEvent.globalPosition().x(), gestureEvent.globalP osition().y()); 1952 IntPoint globalPoint(gestureEvent.globalPosition().x(), gestureEvent.globalP osition().y());
1956 PlatformWheelEvent syntheticWheelEvent(point, globalPoint, 1953 PlatformWheelEvent syntheticWheelEvent(point, globalPoint,
1957 scaledDelta.width(), scaledDelta.height(), 1954 scaledDelta.width(), scaledDelta.height(),
1958 scaledDelta.width() / tickDivisor, scaledDelta.height() / tickDivisor, 1955 scaledDelta.width() / tickDivisor, scaledDelta.height() / tickDivisor,
1959 ScrollByPixelWheelEvent, 1956 ScrollByPixelWheelEvent,
1960 gestureEvent.shiftKey(), gestureEvent.ctrlKey(), gestureEvent.altKey(), gestureEvent.metaKey()); 1957 gestureEvent.shiftKey(), gestureEvent.ctrlKey(), gestureEvent.altKey(), gestureEvent.metaKey());
1961 syntheticWheelEvent.setHasPreciseScrollingDeltas(true); 1958 syntheticWheelEvent.setHasPreciseScrollingDeltas(true);
1962 1959
1963 bool scrolledFrame = view->wheelEvent(syntheticWheelEvent); 1960 bool scrolledFrame = view->wheelEvent(syntheticWheelEvent);
1964 if (scrolledFrame)
1965 setFrameWasScrolledByUser();
1966
1967 return scrolledFrame; 1961 return scrolledFrame;
1968 } 1962 }
1969 1963
1970 void EventHandler::clearGestureScrollNodes() 1964 void EventHandler::clearGestureScrollNodes()
1971 { 1965 {
1972 m_scrollGestureHandlingNode = nullptr; 1966 m_scrollGestureHandlingNode = nullptr;
1973 m_previousGestureScrolledNode = nullptr; 1967 m_previousGestureScrolledNode = nullptr;
1974 } 1968 }
1975 1969
1976 bool EventHandler::isScrollbarHandlingGestures() const 1970 bool EventHandler::isScrollbarHandlingGestures() const
(...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after
2443 FocusType focusType = event->shiftKey() ? FocusTypeBackward : FocusTypeForwa rd; 2437 FocusType focusType = event->shiftKey() ? FocusTypeBackward : FocusTypeForwa rd;
2444 2438
2445 if (page->focusController().advanceFocus(focusType)) 2439 if (page->focusController().advanceFocus(focusType))
2446 event->setDefaultHandled(); 2440 event->setDefaultHandled();
2447 } 2441 }
2448 2442
2449 void EventHandler::capsLockStateMayHaveChanged() 2443 void EventHandler::capsLockStateMayHaveChanged()
2450 { 2444 {
2451 } 2445 }
2452 2446
2453 void EventHandler::setFrameWasScrolledByUser()
2454 {
2455 if (FrameView* view = m_frame->view())
2456 view->setWasScrolledByUser(true);
2457 }
2458
2459 bool EventHandler::passMousePressEventToScrollbar(MouseEventWithHitTestResults& mev) 2447 bool EventHandler::passMousePressEventToScrollbar(MouseEventWithHitTestResults& mev)
2460 { 2448 {
2461 // FIXME(sky): Remove 2449 // FIXME(sky): Remove
2462 return false; 2450 return false;
2463 } 2451 }
2464 2452
2465 // If scrollbar (under mouse) is different from last, send a mouse exited. Set 2453 // If scrollbar (under mouse) is different from last, send a mouse exited. Set
2466 // last to scrollbar if setLast is true; else set last to 0. 2454 // last to scrollbar if setLast is true; else set last to 0.
2467 void EventHandler::updateLastScrollbarUnderMouse(Scrollbar* scrollbar, bool setL ast) 2455 void EventHandler::updateLastScrollbarUnderMouse(Scrollbar* scrollbar, bool setL ast)
2468 { 2456 {
(...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after
2832 unsigned EventHandler::accessKeyModifiers() 2820 unsigned EventHandler::accessKeyModifiers()
2833 { 2821 {
2834 #if OS(MACOSX) 2822 #if OS(MACOSX)
2835 return PlatformEvent::CtrlKey | PlatformEvent::AltKey; 2823 return PlatformEvent::CtrlKey | PlatformEvent::AltKey;
2836 #else 2824 #else
2837 return PlatformEvent::AltKey; 2825 return PlatformEvent::AltKey;
2838 #endif 2826 #endif
2839 } 2827 }
2840 2828
2841 } // namespace blink 2829 } // namespace blink
OLDNEW
« no previous file with comments | « sky/engine/core/page/EventHandler.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698