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

Side by Side Diff: Source/core/page/EventHandler.cpp

Issue 926193003: Move rendering/RenderBox to layout/LayoutBox. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/page/AutoscrollController.cpp ('k') | Source/core/page/SpatialNavigation.cpp » ('j') | 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 620 matching lines...) Expand 10 before | Expand all | Expand 10 after
631 m_mousePressed = true; 631 m_mousePressed = true;
632 632
633 if (event.event().clickCount() == 2) 633 if (event.event().clickCount() == 2)
634 swallowEvent = handleMousePressEventDoubleClick(event); 634 swallowEvent = handleMousePressEventDoubleClick(event);
635 else if (event.event().clickCount() >= 3) 635 else if (event.event().clickCount() >= 3)
636 swallowEvent = handleMousePressEventTripleClick(event); 636 swallowEvent = handleMousePressEventTripleClick(event);
637 else 637 else
638 swallowEvent = handleMousePressEventSingleClick(event); 638 swallowEvent = handleMousePressEventSingleClick(event);
639 639
640 m_mouseDownMayStartAutoscroll = m_mouseDownMayStartSelect 640 m_mouseDownMayStartAutoscroll = m_mouseDownMayStartSelect
641 || (m_mousePressNode && m_mousePressNode->renderBox() && m_mousePressNod e->renderBox()->canBeProgramaticallyScrolled()); 641 || (m_mousePressNode && m_mousePressNode->layoutBox() && m_mousePressNod e->layoutBox()->canBeProgramaticallyScrolled());
642 642
643 return swallowEvent; 643 return swallowEvent;
644 } 644 }
645 645
646 bool EventHandler::handleMouseDraggedEvent(const MouseEventWithHitTestResults& e vent) 646 bool EventHandler::handleMouseDraggedEvent(const MouseEventWithHitTestResults& e vent)
647 { 647 {
648 TRACE_EVENT0("blink", "EventHandler::handleMouseDraggedEvent"); 648 TRACE_EVENT0("blink", "EventHandler::handleMouseDraggedEvent");
649 649
650 // While resetting m_mousePressed here may seem out of place, it turns out 650 // While resetting m_mousePressed here may seem out of place, it turns out
651 // to be needed to handle some bugs^Wfeatures in Blink mouse event handling: 651 // to be needed to handle some bugs^Wfeatures in Blink mouse event handling:
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
835 835
836 #if OS(WIN) 836 #if OS(WIN)
837 837
838 void EventHandler::startPanScrolling(LayoutObject* renderer) 838 void EventHandler::startPanScrolling(LayoutObject* renderer)
839 { 839 {
840 if (!renderer->isBox()) 840 if (!renderer->isBox())
841 return; 841 return;
842 AutoscrollController* controller = autoscrollController(); 842 AutoscrollController* controller = autoscrollController();
843 if (!controller) 843 if (!controller)
844 return; 844 return;
845 controller->startPanScrolling(toRenderBox(renderer), lastKnownMousePosition( )); 845 controller->startPanScrolling(toLayoutBox(renderer), lastKnownMousePosition( ));
846 invalidateClick(); 846 invalidateClick();
847 } 847 }
848 848
849 #endif // OS(WIN) 849 #endif // OS(WIN)
850 850
851 AutoscrollController* EventHandler::autoscrollController() const 851 AutoscrollController* EventHandler::autoscrollController() const
852 { 852 {
853 if (Page* page = m_frame->page()) 853 if (Page* page = m_frame->page())
854 return &page->autoscrollController(); 854 return &page->autoscrollController();
855 return nullptr; 855 return nullptr;
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
916 if (!node) 916 if (!node)
917 node = m_frame->document()->focusedElement(); 917 node = m_frame->document()->focusedElement();
918 918
919 if (!node) 919 if (!node)
920 node = m_mousePressNode.get(); 920 node = m_mousePressNode.get();
921 921
922 if (!node || !node->renderer()) 922 if (!node || !node->renderer())
923 return false; 923 return false;
924 924
925 bool rootLayerScrolls = m_frame->settings() && m_frame->settings()->rootLaye rScrolls(); 925 bool rootLayerScrolls = m_frame->settings() && m_frame->settings()->rootLaye rScrolls();
926 RenderBox* curBox = node->renderer()->enclosingBox(); 926 LayoutBox* curBox = node->renderer()->enclosingBox();
927 while (curBox && (rootLayerScrolls || !curBox->isRenderView())) { 927 while (curBox && (rootLayerScrolls || !curBox->isRenderView())) {
928 ScrollDirection physicalDirection = toPhysicalDirection( 928 ScrollDirection physicalDirection = toPhysicalDirection(
929 direction, curBox->isHorizontalWritingMode(), curBox->style()->isFli ppedBlocksWritingMode()); 929 direction, curBox->isHorizontalWritingMode(), curBox->style()->isFli ppedBlocksWritingMode());
930 930
931 // If we're at the stopNode, we should try to scroll it but we shouldn't bubble past it 931 // If we're at the stopNode, we should try to scroll it but we shouldn't bubble past it
932 bool shouldStopBubbling = stopNode && *stopNode && curBox->node() == *st opNode; 932 bool shouldStopBubbling = stopNode && *stopNode && curBox->node() == *st opNode;
933 bool didScroll = curBox->scroll(physicalDirection, granularity, delta); 933 bool didScroll = curBox->scroll(physicalDirection, granularity, delta);
934 934
935 if (didScroll && stopNode) 935 if (didScroll && stopNode)
936 *stopNode = curBox->node(); 936 *stopNode = curBox->node();
(...skipping 1580 matching lines...) Expand 10 before | Expand all | Expand 10 after
2517 if (gestureEvent.preventPropagation()) 2517 if (gestureEvent.preventPropagation())
2518 m_previousGestureScrolledNode = m_scrollGestureHandlingNode; 2518 m_previousGestureScrolledNode = m_scrollGestureHandlingNode;
2519 2519
2520 return true; 2520 return true;
2521 } 2521 }
2522 2522
2523 2523
2524 if (gestureEvent.preventPropagation()) 2524 if (gestureEvent.preventPropagation())
2525 stopNode = m_previousGestureScrolledNode.get(); 2525 stopNode = m_previousGestureScrolledNode.get();
2526 2526
2527 // First try to scroll the closest scrollable RenderBox ancestor of |nod e|. 2527 // First try to scroll the closest scrollable LayoutBox ancestor of |nod e|.
2528 ScrollGranularity granularity = ScrollByPixel; 2528 ScrollGranularity granularity = ScrollByPixel;
2529 bool horizontalScroll = scroll(ScrollLeft, granularity, node, &stopNode, delta.width()); 2529 bool horizontalScroll = scroll(ScrollLeft, granularity, node, &stopNode, delta.width());
2530 bool verticalScroll = scroll(ScrollUp, granularity, node, &stopNode, del ta.height()); 2530 bool verticalScroll = scroll(ScrollUp, granularity, node, &stopNode, del ta.height());
2531 2531
2532 if (gestureEvent.preventPropagation()) 2532 if (gestureEvent.preventPropagation())
2533 m_previousGestureScrolledNode = stopNode; 2533 m_previousGestureScrolledNode = stopNode;
2534 2534
2535 if (horizontalScroll || verticalScroll) { 2535 if (horizontalScroll || verticalScroll) {
2536 setFrameWasScrolledByUser(); 2536 setFrameWasScrolledByUser();
2537 return true; 2537 return true;
(...skipping 1299 matching lines...) Expand 10 before | Expand all | Expand 10 after
3837 for (const Node* curNode = &node; curNode; curNode = NodeRenderingTraversal: :parent(*curNode)) { 3837 for (const Node* curNode = &node; curNode; curNode = NodeRenderingTraversal: :parent(*curNode)) {
3838 if (LayoutObject* renderer = curNode->renderer()) { 3838 if (LayoutObject* renderer = curNode->renderer()) {
3839 if (renderer->supportsTouchAction()) { 3839 if (renderer->supportsTouchAction()) {
3840 TouchAction action = renderer->style()->touchAction(); 3840 TouchAction action = renderer->style()->touchAction();
3841 effectiveTouchAction = intersectTouchAction(action, effectiveTou chAction); 3841 effectiveTouchAction = intersectTouchAction(action, effectiveTou chAction);
3842 if (effectiveTouchAction == TouchActionNone) 3842 if (effectiveTouchAction == TouchActionNone)
3843 break; 3843 break;
3844 } 3844 }
3845 3845
3846 // If we've reached an ancestor that supports a touch action, search no further. 3846 // If we've reached an ancestor that supports a touch action, search no further.
3847 if (renderer->isBox() && toRenderBox(renderer)->scrollsOverflow()) 3847 if (renderer->isBox() && toLayoutBox(renderer)->scrollsOverflow())
3848 break; 3848 break;
3849 } 3849 }
3850 } 3850 }
3851 return effectiveTouchAction; 3851 return effectiveTouchAction;
3852 } 3852 }
3853 3853
3854 void EventHandler::setLastKnownMousePosition(const PlatformMouseEvent& event) 3854 void EventHandler::setLastKnownMousePosition(const PlatformMouseEvent& event)
3855 { 3855 {
3856 m_mousePositionIsUnknown = false; 3856 m_mousePositionIsUnknown = false;
3857 m_lastKnownMousePosition = event.position(); 3857 m_lastKnownMousePosition = event.position();
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
3938 3938
3939 // If it's in the direction to hide the top controls, only consume when the frame can also scroll. 3939 // If it's in the direction to hide the top controls, only consume when the frame can also scroll.
3940 if (m_frame->view()->scrollPosition().y() < m_frame->view()->maximumScrollPo sition().y()) 3940 if (m_frame->view()->scrollPosition().y() < m_frame->view()->maximumScrollPo sition().y())
3941 return true; 3941 return true;
3942 3942
3943 return false; 3943 return false;
3944 } 3944 }
3945 3945
3946 3946
3947 } // namespace blink 3947 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/page/AutoscrollController.cpp ('k') | Source/core/page/SpatialNavigation.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698