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

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

Issue 1032823003: Refactor HitTestResult to store the HitTestRequest (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 9 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
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 677 matching lines...) Expand 10 before | Expand all | Expand 10 after
688 688
689 if (m_mouseDownMayStartAutoscroll && !panScrollInProgress()) { 689 if (m_mouseDownMayStartAutoscroll && !panScrollInProgress()) {
690 if (AutoscrollController* controller = autoscrollController()) { 690 if (AutoscrollController* controller = autoscrollController()) {
691 controller->startAutoscrollForSelection(renderer); 691 controller->startAutoscrollForSelection(renderer);
692 m_mouseDownMayStartAutoscroll = false; 692 m_mouseDownMayStartAutoscroll = false;
693 } 693 }
694 } 694 }
695 695
696 if (m_selectionInitiationState != ExtendedSelection) { 696 if (m_selectionInitiationState != ExtendedSelection) {
697 HitTestRequest request(HitTestRequest::ReadOnly | HitTestRequest::Active ); 697 HitTestRequest request(HitTestRequest::ReadOnly | HitTestRequest::Active );
698 HitTestResult result(m_mouseDownPos); 698 HitTestResult result(request, m_mouseDownPos);
699 m_frame->document()->layoutView()->hitTest(request, result); 699 m_frame->document()->layoutView()->hitTest(result);
700 700
701 updateSelectionForMouseDrag(result); 701 updateSelectionForMouseDrag(result);
702 } 702 }
703 updateSelectionForMouseDrag(event.hitTestResult()); 703 updateSelectionForMouseDrag(event.hitTestResult());
704 return true; 704 return true;
705 } 705 }
706 706
707 void EventHandler::updateSelectionForMouseDrag() 707 void EventHandler::updateSelectionForMouseDrag()
708 { 708 {
709 FrameView* view = m_frame->view(); 709 FrameView* view = m_frame->view();
710 if (!view) 710 if (!view)
711 return; 711 return;
712 LayoutView* renderer = m_frame->contentRenderer(); 712 LayoutView* renderer = m_frame->contentRenderer();
713 if (!renderer) 713 if (!renderer)
714 return; 714 return;
715 715
716 HitTestRequest request(HitTestRequest::ReadOnly | HitTestRequest::Active | H itTestRequest::Move); 716 HitTestRequest request(HitTestRequest::ReadOnly | HitTestRequest::Active | H itTestRequest::Move);
717 HitTestResult result(view->rootFrameToContents(m_lastKnownMousePosition)); 717 HitTestResult result(request, view->rootFrameToContents(m_lastKnownMousePosi tion));
718 renderer->hitTest(request, result); 718 renderer->hitTest(result);
719 updateSelectionForMouseDrag(result); 719 updateSelectionForMouseDrag(result);
720 } 720 }
721 721
722 void EventHandler::updateSelectionForMouseDrag(const HitTestResult& hitTestResul t) 722 void EventHandler::updateSelectionForMouseDrag(const HitTestResult& hitTestResul t)
723 { 723 {
724 if (!m_mouseDownMayStartSelect) 724 if (!m_mouseDownMayStartSelect)
725 return; 725 return;
726 726
727 Node* target = hitTestResult.innerNode(); 727 Node* target = hitTestResult.innerNode();
728 if (!target) 728 if (!target)
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
872 if (mainFrame && m_frame != mainFrame) { 872 if (mainFrame && m_frame != mainFrame) {
873 FrameView* frameView = m_frame->view(); 873 FrameView* frameView = m_frame->view();
874 FrameView* mainView = mainFrame->view(); 874 FrameView* mainView = mainFrame->view();
875 if (frameView && mainView) { 875 if (frameView && mainView) {
876 IntPoint mainFramePoint = mainView->rootFrameToContents(frameVie w->contentsToRootFrame(roundedIntPoint(point))); 876 IntPoint mainFramePoint = mainView->rootFrameToContents(frameVie w->contentsToRootFrame(roundedIntPoint(point)));
877 return mainFrame->eventHandler().hitTestResultAtPoint(mainFrameP oint, hitType, padding); 877 return mainFrame->eventHandler().hitTestResultAtPoint(mainFrameP oint, hitType, padding);
878 } 878 }
879 } 879 }
880 } 880 }
881 881
882 HitTestResult result(point, padding.height(), padding.width(), padding.heigh t(), padding.width()); 882 // hitTestResultAtPoint is specifically used to hitTest into all frames, thu s it always allows child frame content.
883 HitTestRequest request(hitType | HitTestRequest::AllowChildFrameContent);
884 HitTestResult result(request, point, padding.height(), padding.width(), padd ing.height(), padding.width());
883 885
884 // LayoutView::hitTest causes a layout, and we don't want to hit that until the first 886 // LayoutView::hitTest causes a layout, and we don't want to hit that until the first
885 // layout because until then, there is nothing shown on the screen - the use r can't 887 // layout because until then, there is nothing shown on the screen - the use r can't
886 // have intentionally clicked on something belonging to this page. Furthermo re, 888 // have intentionally clicked on something belonging to this page. Furthermo re,
887 // mousemove events before the first layout should not lead to a premature l ayout() 889 // mousemove events before the first layout should not lead to a premature l ayout()
888 // happening, which could show a flash of white. 890 // happening, which could show a flash of white.
889 // See also the similar code in Document::prepareMouseEvent. 891 // See also the similar code in Document::prepareMouseEvent.
890 if (!m_frame->contentRenderer() || !m_frame->view() || !m_frame->view()->did FirstLayout()) 892 if (!m_frame->contentRenderer() || !m_frame->view() || !m_frame->view()->did FirstLayout())
891 return result; 893 return result;
892 894
893 // hitTestResultAtPoint is specifically used to hitTest into all frames, thu s it always allows child frame content. 895 m_frame->contentRenderer()->hitTest(result);
894 HitTestRequest request(hitType | HitTestRequest::AllowChildFrameContent);
895 m_frame->contentRenderer()->hitTest(request, result);
896 if (!request.readOnly()) 896 if (!request.readOnly())
897 m_frame->document()->updateHoverActiveState(request, result.innerElement ()); 897 m_frame->document()->updateHoverActiveState(request, result.innerElement ());
898 898
899 return result; 899 return result;
900 } 900 }
901 901
902 void EventHandler::stopAutoscroll() 902 void EventHandler::stopAutoscroll()
903 { 903 {
904 if (AutoscrollController* controller = autoscrollController()) 904 if (AutoscrollController* controller = autoscrollController())
905 controller->stopAutoscroll(); 905 controller->stopAutoscroll();
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
1021 if (!view || !view->shouldSetCursor()) 1021 if (!view || !view->shouldSetCursor())
1022 return; 1022 return;
1023 1023
1024 LayoutView* layoutView = view->layoutView(); 1024 LayoutView* layoutView = view->layoutView();
1025 if (!layoutView) 1025 if (!layoutView)
1026 return; 1026 return;
1027 1027
1028 m_frame->document()->updateLayout(); 1028 m_frame->document()->updateLayout();
1029 1029
1030 HitTestRequest request(HitTestRequest::ReadOnly); 1030 HitTestRequest request(HitTestRequest::ReadOnly);
1031 HitTestResult result(view->rootFrameToContents(m_lastKnownMousePosition)); 1031 HitTestResult result(request, view->rootFrameToContents(m_lastKnownMousePosi tion));
1032 layoutView->hitTest(request, result); 1032 layoutView->hitTest(result);
1033 1033
1034 OptionalCursor optionalCursor = selectCursor(result); 1034 OptionalCursor optionalCursor = selectCursor(result);
1035 if (optionalCursor.isCursorChange()) { 1035 if (optionalCursor.isCursorChange()) {
1036 m_currentMouseCursor = optionalCursor.cursor(); 1036 m_currentMouseCursor = optionalCursor.cursor();
1037 view->setCursor(m_currentMouseCursor); 1037 view->setCursor(m_currentMouseCursor);
1038 } 1038 }
1039 } 1039 }
1040 1040
1041 OptionalCursor EventHandler::selectCursor(const HitTestResult& result) 1041 OptionalCursor EventHandler::selectCursor(const HitTestResult& result)
1042 { 1042 {
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after
1358 return nullptr; 1358 return nullptr;
1359 } 1359 }
1360 1360
1361 bool EventHandler::handleMouseMoveEvent(const PlatformMouseEvent& event) 1361 bool EventHandler::handleMouseMoveEvent(const PlatformMouseEvent& event)
1362 { 1362 {
1363 TRACE_EVENT0("blink", "EventHandler::handleMouseMoveEvent"); 1363 TRACE_EVENT0("blink", "EventHandler::handleMouseMoveEvent");
1364 1364
1365 RefPtrWillBeRawPtr<FrameView> protector(m_frame->view()); 1365 RefPtrWillBeRawPtr<FrameView> protector(m_frame->view());
1366 MaximumDurationTracker maxDurationTracker(&m_maxMouseMovedDuration); 1366 MaximumDurationTracker maxDurationTracker(&m_maxMouseMovedDuration);
1367 1367
1368 HitTestResult hoveredNode = HitTestResult(LayoutPoint()); 1368 HitTestRequest request(HitTestRequest::ReadOnly | HitTestRequest::Active);
1369 HitTestResult hoveredNode = HitTestResult(request, LayoutPoint());
Rick Byers 2015/03/31 00:51:00 can't we just use the default ctor here instead of
ramya.v 2015/03/31 09:41:36 Done.
1369 bool result = handleMouseMoveOrLeaveEvent(event, &hoveredNode); 1370 bool result = handleMouseMoveOrLeaveEvent(event, &hoveredNode);
1370 1371
1371 Page* page = m_frame->page(); 1372 Page* page = m_frame->page();
1372 if (!page) 1373 if (!page)
1373 return result; 1374 return result;
1374 1375
1375 if (DeprecatedPaintLayer* layer = layerForNode(hoveredNode.innerNode())) { 1376 if (DeprecatedPaintLayer* layer = layerForNode(hoveredNode.innerNode())) {
1376 if (ScrollableArea* layerScrollableArea = associatedScrollableArea(layer )) 1377 if (ScrollableArea* layerScrollableArea = associatedScrollableArea(layer ))
1377 layerScrollableArea->mouseMovedInContentArea(); 1378 layerScrollableArea->mouseMovedInContentArea();
1378 } 1379 }
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
1434 // means that :hover and :active freeze in the state they were in, rathe r than updating 1435 // means that :hover and :active freeze in the state they were in, rathe r than updating
1435 // for nodes the mouse moves while the window is not key (which will be the case if 1436 // for nodes the mouse moves while the window is not key (which will be the case if
1436 // onlyUpdateScrollbars is true). 1437 // onlyUpdateScrollbars is true).
1437 hitType |= HitTestRequest::ReadOnly; 1438 hitType |= HitTestRequest::ReadOnly;
1438 } 1439 }
1439 1440
1440 // Treat any mouse move events as readonly if the user is currently touching the screen. 1441 // Treat any mouse move events as readonly if the user is currently touching the screen.
1441 if (m_touchPressed) 1442 if (m_touchPressed)
1442 hitType |= HitTestRequest::Active | HitTestRequest::ReadOnly; 1443 hitType |= HitTestRequest::Active | HitTestRequest::ReadOnly;
1443 HitTestRequest request(hitType); 1444 HitTestRequest request(hitType);
1444 MouseEventWithHitTestResults mev = MouseEventWithHitTestResults(mouseEvent, HitTestResult(LayoutPoint())); 1445 MouseEventWithHitTestResults mev = MouseEventWithHitTestResults(mouseEvent, HitTestResult(request, LayoutPoint()));
1445 1446
1446 // We don't want to do a hit-test in forceLeave scenarios because there migh t actually be some other frame above this one at the specified co-ordinate. 1447 // We don't want to do a hit-test in forceLeave scenarios because there migh t actually be some other frame above this one at the specified co-ordinate.
1447 // So we must force the hit-test to fail, while still clearing hover/active state. 1448 // So we must force the hit-test to fail, while still clearing hover/active state.
1448 if (forceLeave) 1449 if (forceLeave)
1449 m_frame->document()->updateHoverActiveState(request, 0, &mouseEvent); 1450 m_frame->document()->updateHoverActiveState(request, 0, &mouseEvent);
1450 else 1451 else
1451 mev = prepareMouseEvent(request, mouseEvent); 1452 mev = prepareMouseEvent(request, mouseEvent);
1452 1453
1453 if (hoveredNode) 1454 if (hoveredNode)
1454 *hoveredNode = mev.hitTestResult(); 1455 *hoveredNode = mev.hitTestResult();
(...skipping 549 matching lines...) Expand 10 before | Expand all | Expand 10 after
2004 2005
2005 RefPtrWillBeRawPtr<FrameView> protector(m_frame->view()); 2006 RefPtrWillBeRawPtr<FrameView> protector(m_frame->view());
2006 2007
2007 FrameView* view = m_frame->view(); 2008 FrameView* view = m_frame->view();
2008 if (!view) 2009 if (!view)
2009 return false; 2010 return false;
2010 2011
2011 LayoutPoint vPoint = view->rootFrameToContents(event.position()); 2012 LayoutPoint vPoint = view->rootFrameToContents(event.position());
2012 2013
2013 HitTestRequest request(HitTestRequest::ReadOnly); 2014 HitTestRequest request(HitTestRequest::ReadOnly);
2014 HitTestResult result(vPoint); 2015 HitTestResult result(request, vPoint);
2015 doc->layoutView()->hitTest(request, result); 2016 doc->layoutView()->hitTest(result);
2016 2017
2017 Node* node = result.innerNode(); 2018 Node* node = result.innerNode();
2018 // Wheel events should not dispatch to text nodes. 2019 // Wheel events should not dispatch to text nodes.
2019 if (node && node->isTextNode()) 2020 if (node && node->isTextNode())
2020 node = NodeRenderingTraversal::parent(*node); 2021 node = NodeRenderingTraversal::parent(*node);
2021 2022
2022 bool isOverWidget; 2023 bool isOverWidget;
2023 if (event.useLatchedEventNode()) { 2024 if (event.useLatchedEventNode()) {
2024 if (!m_latchedWheelEventNode) { 2025 if (!m_latchedWheelEventNode) {
2025 m_latchedWheelEventNode = node; 2026 m_latchedWheelEventNode = node;
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
2207 } 2208 }
2208 2209
2209 if (!eventTarget) { 2210 if (!eventTarget) {
2210 Document* document = m_frame->document(); 2211 Document* document = m_frame->document();
2211 if (!document->layoutView()) 2212 if (!document->layoutView())
2212 return false; 2213 return false;
2213 2214
2214 FrameView* view = m_frame->view(); 2215 FrameView* view = m_frame->view();
2215 LayoutPoint viewPoint = view->rootFrameToContents(gestureEvent.position( )); 2216 LayoutPoint viewPoint = view->rootFrameToContents(gestureEvent.position( ));
2216 HitTestRequest request(HitTestRequest::ReadOnly); 2217 HitTestRequest request(HitTestRequest::ReadOnly);
2217 HitTestResult result(viewPoint); 2218 HitTestResult result(request, viewPoint);
2218 document->layoutView()->hitTest(request, result); 2219 document->layoutView()->hitTest(result);
2219 2220
2220 eventTarget = result.innerNode(); 2221 eventTarget = result.innerNode();
2221 2222
2222 m_lastGestureScrollOverWidget = result.isOverWidget(); 2223 m_lastGestureScrollOverWidget = result.isOverWidget();
2223 m_scrollGestureHandlingNode = eventTarget; 2224 m_scrollGestureHandlingNode = eventTarget;
2224 m_previousGestureScrolledNode = nullptr; 2225 m_previousGestureScrolledNode = nullptr;
2225 2226
2226 if (!scrollbar) 2227 if (!scrollbar)
2227 scrollbar = result.scrollbar(); 2228 scrollbar = result.scrollbar();
2228 } 2229 }
(...skipping 654 matching lines...) Expand 10 before | Expand all | Expand 10 after
2883 2884
2884 m_frame->view()->setCursor(pointerCursor()); 2885 m_frame->view()->setCursor(pointerCursor());
2885 IntPoint locationInViewport = pinchViewport.rootFrameToViewport(locationInRo otFrame); 2886 IntPoint locationInViewport = pinchViewport.rootFrameToViewport(locationInRo otFrame);
2886 IntPoint globalPosition = view->hostWindow()->viewportToScreen(IntRect(locat ionInViewport, IntSize())).location(); 2887 IntPoint globalPosition = view->hostWindow()->viewportToScreen(IntRect(locat ionInViewport, IntSize())).location();
2887 2888
2888 Node* targetNode = doc->focusedElement(); 2889 Node* targetNode = doc->focusedElement();
2889 if (!targetNode) 2890 if (!targetNode)
2890 targetNode = doc; 2891 targetNode = doc;
2891 2892
2892 // Use the focused node as the target for hover and active. 2893 // Use the focused node as the target for hover and active.
2893 HitTestResult result(locationInRootFrame); 2894 HitTestRequest request(HitTestRequest::Active);
2895 HitTestResult result(request, locationInRootFrame);
2894 result.setInnerNode(targetNode); 2896 result.setInnerNode(targetNode);
2895 doc->updateHoverActiveState(HitTestRequest::Active, result.innerElement()); 2897 doc->updateHoverActiveState(request, result.innerElement());
2896 2898
2897 // The contextmenu event is a mouse event even when invoked using the keyboa rd. 2899 // The contextmenu event is a mouse event even when invoked using the keyboa rd.
2898 // This is required for web compatibility. 2900 // This is required for web compatibility.
2899 PlatformEvent::Type eventType = PlatformEvent::MousePressed; 2901 PlatformEvent::Type eventType = PlatformEvent::MousePressed;
2900 if (m_frame->settings()->showContextMenuOnMouseUp()) 2902 if (m_frame->settings()->showContextMenuOnMouseUp())
2901 eventType = PlatformEvent::MouseReleased; 2903 eventType = PlatformEvent::MouseReleased;
2902 2904
2903 PlatformMouseEvent mouseEvent(locationInRootFrame, globalPosition, RightButt on, eventType, 1, false, false, false, false, PlatformMouseEvent::RealOrIndistin guishable, WTF::currentTime()); 2905 PlatformMouseEvent mouseEvent(locationInRootFrame, globalPosition, RightButt on, eventType, 1, false, false, false, false, PlatformMouseEvent::RealOrIndistin guishable, WTF::currentTime());
2904 2906
2905 handleMousePressEvent(mouseEvent); 2907 handleMousePressEvent(mouseEvent);
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
3031 void EventHandler::hoverTimerFired(Timer<EventHandler>*) 3033 void EventHandler::hoverTimerFired(Timer<EventHandler>*)
3032 { 3034 {
3033 m_hoverTimer.stop(); 3035 m_hoverTimer.stop();
3034 3036
3035 ASSERT(m_frame); 3037 ASSERT(m_frame);
3036 ASSERT(m_frame->document()); 3038 ASSERT(m_frame->document());
3037 3039
3038 if (LayoutView* renderer = m_frame->contentRenderer()) { 3040 if (LayoutView* renderer = m_frame->contentRenderer()) {
3039 if (FrameView* view = m_frame->view()) { 3041 if (FrameView* view = m_frame->view()) {
3040 HitTestRequest request(HitTestRequest::Move); 3042 HitTestRequest request(HitTestRequest::Move);
3041 HitTestResult result(view->rootFrameToContents(m_lastKnownMousePosit ion)); 3043 HitTestResult result(request, view->rootFrameToContents(m_lastKnownM ousePosition));
3042 renderer->hitTest(request, result); 3044 renderer->hitTest(result);
3043 m_frame->document()->updateHoverActiveState(request, result.innerEle ment()); 3045 m_frame->document()->updateHoverActiveState(request, result.innerEle ment());
3044 } 3046 }
3045 } 3047 }
3046 } 3048 }
3047 3049
3048 void EventHandler::activeIntervalTimerFired(Timer<EventHandler>*) 3050 void EventHandler::activeIntervalTimerFired(Timer<EventHandler>*)
3049 { 3051 {
3050 m_activeIntervalTimer.stop(); 3052 m_activeIntervalTimer.stop();
3051 3053
3052 if (m_frame 3054 if (m_frame
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
3290 ASSERT(event.event().type() == PlatformEvent::MouseMoved); 3292 ASSERT(event.event().type() == PlatformEvent::MouseMoved);
3291 // Callers must protect the reference to FrameView, since this function may dispatch DOM 3293 // Callers must protect the reference to FrameView, since this function may dispatch DOM
3292 // events, causing page/FrameView to go away. 3294 // events, causing page/FrameView to go away.
3293 ASSERT(m_frame); 3295 ASSERT(m_frame);
3294 ASSERT(m_frame->view()); 3296 ASSERT(m_frame->view());
3295 if (!m_frame->page()) 3297 if (!m_frame->page())
3296 return false; 3298 return false;
3297 3299
3298 if (m_mouseDownMayStartDrag) { 3300 if (m_mouseDownMayStartDrag) {
3299 HitTestRequest request(HitTestRequest::ReadOnly); 3301 HitTestRequest request(HitTestRequest::ReadOnly);
3300 HitTestResult result(m_mouseDownPos); 3302 HitTestResult result(request, m_mouseDownPos);
3301 m_frame->contentRenderer()->hitTest(request, result); 3303 m_frame->contentRenderer()->hitTest(result);
3302 Node* node = result.innerNode(); 3304 Node* node = result.innerNode();
3303 if (node) { 3305 if (node) {
3304 DragController::SelectionDragPolicy selectionDragPolicy = event.even t().timestamp() - m_mouseDownTimestamp < TextDragDelay 3306 DragController::SelectionDragPolicy selectionDragPolicy = event.even t().timestamp() - m_mouseDownTimestamp < TextDragDelay
3305 ? DragController::DelayedSelectionDragResolution 3307 ? DragController::DelayedSelectionDragResolution
3306 : DragController::ImmediateSelectionDragResolution; 3308 : DragController::ImmediateSelectionDragResolution;
3307 dragState().m_dragSrc = m_frame->page()->dragController().draggableN ode(m_frame, node, m_mouseDownPos, selectionDragPolicy, dragState().m_dragType); 3309 dragState().m_dragSrc = m_frame->page()->dragController().draggableN ode(m_frame, node, m_mouseDownPos, selectionDragPolicy, dragState().m_dragType);
3308 } else { 3310 } else {
3309 dragState().m_dragSrc = nullptr; 3311 dragState().m_dragSrc = nullptr;
3310 } 3312 }
3311 3313
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
3571 case PlatformTouchPoint::TouchStationary: 3573 case PlatformTouchPoint::TouchStationary:
3572 // TouchStationary state is not converted to touch events, so fall throu gh to assert. 3574 // TouchStationary state is not converted to touch events, so fall throu gh to assert.
3573 default: 3575 default:
3574 ASSERT_NOT_REACHED(); 3576 ASSERT_NOT_REACHED();
3575 return emptyAtom; 3577 return emptyAtom;
3576 } 3578 }
3577 } 3579 }
3578 3580
3579 HitTestResult EventHandler::hitTestResultInFrame(LocalFrame* frame, const Layout Point& point, HitTestRequest::HitTestRequestType hitType) 3581 HitTestResult EventHandler::hitTestResultInFrame(LocalFrame* frame, const Layout Point& point, HitTestRequest::HitTestRequestType hitType)
3580 { 3582 {
3581 HitTestResult result(point); 3583 HitTestResult result(HitTestRequest(hitType), point);
3582 3584
3583 if (!frame || !frame->contentRenderer()) 3585 if (!frame || !frame->contentRenderer())
3584 return result; 3586 return result;
3585 if (frame->view()) { 3587 if (frame->view()) {
3586 IntRect rect = frame->view()->visibleContentRect(IncludeScrollbars); 3588 IntRect rect = frame->view()->visibleContentRect(IncludeScrollbars);
3587 if (!rect.contains(roundedIntPoint(point))) 3589 if (!rect.contains(roundedIntPoint(point)))
3588 return result; 3590 return result;
3589 } 3591 }
3590 frame->contentRenderer()->hitTest(HitTestRequest(hitType), result); 3592 frame->contentRenderer()->hitTest(result);
3591 return result; 3593 return result;
3592 } 3594 }
3593 3595
3594 bool EventHandler::handleTouchEvent(const PlatformTouchEvent& event) 3596 bool EventHandler::handleTouchEvent(const PlatformTouchEvent& event)
3595 { 3597 {
3596 TRACE_EVENT0("blink", "EventHandler::handleTouchEvent"); 3598 TRACE_EVENT0("blink", "EventHandler::handleTouchEvent");
3597 3599
3598 const Vector<PlatformTouchPoint>& points = event.touchPoints(); 3600 const Vector<PlatformTouchPoint>& points = event.touchPoints();
3599 3601
3600 unsigned i; 3602 unsigned i;
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after
3949 3951
3950 // If it's in the direction to hide the top controls, only consume when the frame can also scroll. 3952 // If it's in the direction to hide the top controls, only consume when the frame can also scroll.
3951 if (m_frame->view()->scrollPosition().y() < m_frame->view()->maximumScrollPo sition().y()) 3953 if (m_frame->view()->scrollPosition().y() < m_frame->view()->maximumScrollPo sition().y())
3952 return true; 3954 return true;
3953 3955
3954 return false; 3956 return false;
3955 } 3957 }
3956 3958
3957 3959
3958 } // namespace blink 3960 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698