| 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 697 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 708 | 708 |
| 709 if (m_mouseDownMayStartAutoscroll && !panScrollInProgress()) { | 709 if (m_mouseDownMayStartAutoscroll && !panScrollInProgress()) { |
| 710 if (AutoscrollController* controller = autoscrollController()) { | 710 if (AutoscrollController* controller = autoscrollController()) { |
| 711 controller->startAutoscrollForSelection(renderer); | 711 controller->startAutoscrollForSelection(renderer); |
| 712 m_mouseDownMayStartAutoscroll = false; | 712 m_mouseDownMayStartAutoscroll = false; |
| 713 } | 713 } |
| 714 } | 714 } |
| 715 | 715 |
| 716 if (m_selectionInitiationState != ExtendedSelection) { | 716 if (m_selectionInitiationState != ExtendedSelection) { |
| 717 HitTestRequest request(HitTestRequest::ReadOnly | HitTestRequest::Active
); | 717 HitTestRequest request(HitTestRequest::ReadOnly | HitTestRequest::Active
); |
| 718 HitTestResult result(m_mouseDownPos); | 718 HitTestResult result(request, m_mouseDownPos); |
| 719 m_frame->document()->layoutView()->hitTest(request, result); | 719 m_frame->document()->layoutView()->hitTest(result); |
| 720 | 720 |
| 721 updateSelectionForMouseDrag(result); | 721 updateSelectionForMouseDrag(result); |
| 722 } | 722 } |
| 723 updateSelectionForMouseDrag(event.hitTestResult()); | 723 updateSelectionForMouseDrag(event.hitTestResult()); |
| 724 return true; | 724 return true; |
| 725 } | 725 } |
| 726 | 726 |
| 727 void EventHandler::updateSelectionForMouseDrag() | 727 void EventHandler::updateSelectionForMouseDrag() |
| 728 { | 728 { |
| 729 FrameView* view = m_frame->view(); | 729 FrameView* view = m_frame->view(); |
| 730 if (!view) | 730 if (!view) |
| 731 return; | 731 return; |
| 732 LayoutView* renderer = m_frame->contentRenderer(); | 732 LayoutView* renderer = m_frame->contentRenderer(); |
| 733 if (!renderer) | 733 if (!renderer) |
| 734 return; | 734 return; |
| 735 | 735 |
| 736 HitTestRequest request(HitTestRequest::ReadOnly | HitTestRequest::Active | H
itTestRequest::Move); | 736 HitTestRequest request(HitTestRequest::ReadOnly | HitTestRequest::Active | H
itTestRequest::Move); |
| 737 HitTestResult result(view->rootFrameToContents(m_lastKnownMousePosition)); | 737 HitTestResult result(request, view->rootFrameToContents(m_lastKnownMousePosi
tion)); |
| 738 renderer->hitTest(request, result); | 738 renderer->hitTest(result); |
| 739 updateSelectionForMouseDrag(result); | 739 updateSelectionForMouseDrag(result); |
| 740 } | 740 } |
| 741 | 741 |
| 742 void EventHandler::updateSelectionForMouseDrag(const HitTestResult& hitTestResul
t) | 742 void EventHandler::updateSelectionForMouseDrag(const HitTestResult& hitTestResul
t) |
| 743 { | 743 { |
| 744 if (!m_mouseDownMayStartSelect) | 744 if (!m_mouseDownMayStartSelect) |
| 745 return; | 745 return; |
| 746 | 746 |
| 747 Node* target = hitTestResult.innerNode(); | 747 Node* target = hitTestResult.innerNode(); |
| 748 if (!target) | 748 if (!target) |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 892 if (mainFrame && m_frame != mainFrame) { | 892 if (mainFrame && m_frame != mainFrame) { |
| 893 FrameView* frameView = m_frame->view(); | 893 FrameView* frameView = m_frame->view(); |
| 894 FrameView* mainView = mainFrame->view(); | 894 FrameView* mainView = mainFrame->view(); |
| 895 if (frameView && mainView) { | 895 if (frameView && mainView) { |
| 896 IntPoint mainFramePoint = mainView->rootFrameToContents(frameVie
w->contentsToRootFrame(roundedIntPoint(point))); | 896 IntPoint mainFramePoint = mainView->rootFrameToContents(frameVie
w->contentsToRootFrame(roundedIntPoint(point))); |
| 897 return mainFrame->eventHandler().hitTestResultAtPoint(mainFrameP
oint, hitType, padding); | 897 return mainFrame->eventHandler().hitTestResultAtPoint(mainFrameP
oint, hitType, padding); |
| 898 } | 898 } |
| 899 } | 899 } |
| 900 } | 900 } |
| 901 | 901 |
| 902 HitTestResult result(point, padding.height(), padding.width(), padding.heigh
t(), padding.width()); | 902 // hitTestResultAtPoint is specifically used to hitTest into all frames, thu
s it always allows child frame content. |
| 903 HitTestRequest request(hitType | HitTestRequest::AllowChildFrameContent); |
| 904 HitTestResult result(request, point, padding.height(), padding.width(), padd
ing.height(), padding.width()); |
| 903 | 905 |
| 904 // LayoutView::hitTest causes a layout, and we don't want to hit that until
the first | 906 // LayoutView::hitTest causes a layout, and we don't want to hit that until
the first |
| 905 // layout because until then, there is nothing shown on the screen - the use
r can't | 907 // layout because until then, there is nothing shown on the screen - the use
r can't |
| 906 // have intentionally clicked on something belonging to this page. Furthermo
re, | 908 // have intentionally clicked on something belonging to this page. Furthermo
re, |
| 907 // mousemove events before the first layout should not lead to a premature l
ayout() | 909 // mousemove events before the first layout should not lead to a premature l
ayout() |
| 908 // happening, which could show a flash of white. | 910 // happening, which could show a flash of white. |
| 909 // See also the similar code in Document::prepareMouseEvent. | 911 // See also the similar code in Document::prepareMouseEvent. |
| 910 if (!m_frame->contentRenderer() || !m_frame->view() || !m_frame->view()->did
FirstLayout()) | 912 if (!m_frame->contentRenderer() || !m_frame->view() || !m_frame->view()->did
FirstLayout()) |
| 911 return result; | 913 return result; |
| 912 | 914 |
| 913 // hitTestResultAtPoint is specifically used to hitTest into all frames, thu
s it always allows child frame content. | 915 m_frame->contentRenderer()->hitTest(result); |
| 914 HitTestRequest request(hitType | HitTestRequest::AllowChildFrameContent); | |
| 915 m_frame->contentRenderer()->hitTest(request, result); | |
| 916 if (!request.readOnly()) | 916 if (!request.readOnly()) |
| 917 m_frame->document()->updateHoverActiveState(request, result.innerElement
()); | 917 m_frame->document()->updateHoverActiveState(request, result.innerElement
()); |
| 918 | 918 |
| 919 return result; | 919 return result; |
| 920 } | 920 } |
| 921 | 921 |
| 922 void EventHandler::stopAutoscroll() | 922 void EventHandler::stopAutoscroll() |
| 923 { | 923 { |
| 924 if (AutoscrollController* controller = autoscrollController()) | 924 if (AutoscrollController* controller = autoscrollController()) |
| 925 controller->stopAutoscroll(); | 925 controller->stopAutoscroll(); |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1053 if (!view || !view->shouldSetCursor()) | 1053 if (!view || !view->shouldSetCursor()) |
| 1054 return; | 1054 return; |
| 1055 | 1055 |
| 1056 LayoutView* layoutView = view->layoutView(); | 1056 LayoutView* layoutView = view->layoutView(); |
| 1057 if (!layoutView) | 1057 if (!layoutView) |
| 1058 return; | 1058 return; |
| 1059 | 1059 |
| 1060 m_frame->document()->updateLayout(); | 1060 m_frame->document()->updateLayout(); |
| 1061 | 1061 |
| 1062 HitTestRequest request(HitTestRequest::ReadOnly); | 1062 HitTestRequest request(HitTestRequest::ReadOnly); |
| 1063 HitTestResult result(view->rootFrameToContents(m_lastKnownMousePosition)); | 1063 HitTestResult result(request, view->rootFrameToContents(m_lastKnownMousePosi
tion)); |
| 1064 layoutView->hitTest(request, result); | 1064 layoutView->hitTest(result); |
| 1065 | 1065 |
| 1066 OptionalCursor optionalCursor = selectCursor(result); | 1066 OptionalCursor optionalCursor = selectCursor(result); |
| 1067 if (optionalCursor.isCursorChange()) { | 1067 if (optionalCursor.isCursorChange()) { |
| 1068 m_currentMouseCursor = optionalCursor.cursor(); | 1068 m_currentMouseCursor = optionalCursor.cursor(); |
| 1069 view->setCursor(m_currentMouseCursor); | 1069 view->setCursor(m_currentMouseCursor); |
| 1070 } | 1070 } |
| 1071 } | 1071 } |
| 1072 | 1072 |
| 1073 OptionalCursor EventHandler::selectCursor(const HitTestResult& result) | 1073 OptionalCursor EventHandler::selectCursor(const HitTestResult& result) |
| 1074 { | 1074 { |
| (...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1390 return nullptr; | 1390 return nullptr; |
| 1391 } | 1391 } |
| 1392 | 1392 |
| 1393 bool EventHandler::handleMouseMoveEvent(const PlatformMouseEvent& event) | 1393 bool EventHandler::handleMouseMoveEvent(const PlatformMouseEvent& event) |
| 1394 { | 1394 { |
| 1395 TRACE_EVENT0("blink", "EventHandler::handleMouseMoveEvent"); | 1395 TRACE_EVENT0("blink", "EventHandler::handleMouseMoveEvent"); |
| 1396 | 1396 |
| 1397 RefPtrWillBeRawPtr<FrameView> protector(m_frame->view()); | 1397 RefPtrWillBeRawPtr<FrameView> protector(m_frame->view()); |
| 1398 MaximumDurationTracker maxDurationTracker(&m_maxMouseMovedDuration); | 1398 MaximumDurationTracker maxDurationTracker(&m_maxMouseMovedDuration); |
| 1399 | 1399 |
| 1400 HitTestResult hoveredNode = HitTestResult(LayoutPoint()); | 1400 HitTestResult hoveredNode = HitTestResult(); |
| 1401 bool result = handleMouseMoveOrLeaveEvent(event, &hoveredNode); | 1401 bool result = handleMouseMoveOrLeaveEvent(event, &hoveredNode); |
| 1402 | 1402 |
| 1403 Page* page = m_frame->page(); | 1403 Page* page = m_frame->page(); |
| 1404 if (!page) | 1404 if (!page) |
| 1405 return result; | 1405 return result; |
| 1406 | 1406 |
| 1407 if (DeprecatedPaintLayer* layer = layerForNode(hoveredNode.innerNode())) { | 1407 if (DeprecatedPaintLayer* layer = layerForNode(hoveredNode.innerNode())) { |
| 1408 if (ScrollableArea* layerScrollableArea = associatedScrollableArea(layer
)) | 1408 if (ScrollableArea* layerScrollableArea = associatedScrollableArea(layer
)) |
| 1409 layerScrollableArea->mouseMovedInContentArea(); | 1409 layerScrollableArea->mouseMovedInContentArea(); |
| 1410 } | 1410 } |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1466 // means that :hover and :active freeze in the state they were in, rathe
r than updating | 1466 // means that :hover and :active freeze in the state they were in, rathe
r than updating |
| 1467 // for nodes the mouse moves while the window is not key (which will be
the case if | 1467 // for nodes the mouse moves while the window is not key (which will be
the case if |
| 1468 // onlyUpdateScrollbars is true). | 1468 // onlyUpdateScrollbars is true). |
| 1469 hitType |= HitTestRequest::ReadOnly; | 1469 hitType |= HitTestRequest::ReadOnly; |
| 1470 } | 1470 } |
| 1471 | 1471 |
| 1472 // Treat any mouse move events as readonly if the user is currently touching
the screen. | 1472 // Treat any mouse move events as readonly if the user is currently touching
the screen. |
| 1473 if (m_touchPressed) | 1473 if (m_touchPressed) |
| 1474 hitType |= HitTestRequest::Active | HitTestRequest::ReadOnly; | 1474 hitType |= HitTestRequest::Active | HitTestRequest::ReadOnly; |
| 1475 HitTestRequest request(hitType); | 1475 HitTestRequest request(hitType); |
| 1476 MouseEventWithHitTestResults mev = MouseEventWithHitTestResults(mouseEvent,
HitTestResult(LayoutPoint())); | 1476 MouseEventWithHitTestResults mev = MouseEventWithHitTestResults(mouseEvent,
HitTestResult(request, LayoutPoint())); |
| 1477 | 1477 |
| 1478 // 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. | 1478 // 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. |
| 1479 // So we must force the hit-test to fail, while still clearing hover/active
state. | 1479 // So we must force the hit-test to fail, while still clearing hover/active
state. |
| 1480 if (forceLeave) | 1480 if (forceLeave) |
| 1481 m_frame->document()->updateHoverActiveState(request, 0, &mouseEvent); | 1481 m_frame->document()->updateHoverActiveState(request, 0, &mouseEvent); |
| 1482 else | 1482 else |
| 1483 mev = prepareMouseEvent(request, mouseEvent); | 1483 mev = prepareMouseEvent(request, mouseEvent); |
| 1484 | 1484 |
| 1485 if (hoveredNode) | 1485 if (hoveredNode) |
| 1486 *hoveredNode = mev.hitTestResult(); | 1486 *hoveredNode = mev.hitTestResult(); |
| (...skipping 549 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2036 | 2036 |
| 2037 RefPtrWillBeRawPtr<FrameView> protector(m_frame->view()); | 2037 RefPtrWillBeRawPtr<FrameView> protector(m_frame->view()); |
| 2038 | 2038 |
| 2039 FrameView* view = m_frame->view(); | 2039 FrameView* view = m_frame->view(); |
| 2040 if (!view) | 2040 if (!view) |
| 2041 return false; | 2041 return false; |
| 2042 | 2042 |
| 2043 LayoutPoint vPoint = view->rootFrameToContents(event.position()); | 2043 LayoutPoint vPoint = view->rootFrameToContents(event.position()); |
| 2044 | 2044 |
| 2045 HitTestRequest request(HitTestRequest::ReadOnly); | 2045 HitTestRequest request(HitTestRequest::ReadOnly); |
| 2046 HitTestResult result(vPoint); | 2046 HitTestResult result(request, vPoint); |
| 2047 doc->layoutView()->hitTest(request, result); | 2047 doc->layoutView()->hitTest(result); |
| 2048 | 2048 |
| 2049 Node* node = result.innerNode(); | 2049 Node* node = result.innerNode(); |
| 2050 // Wheel events should not dispatch to text nodes. | 2050 // Wheel events should not dispatch to text nodes. |
| 2051 if (node && node->isTextNode()) | 2051 if (node && node->isTextNode()) |
| 2052 node = NodeRenderingTraversal::parent(*node); | 2052 node = NodeRenderingTraversal::parent(*node); |
| 2053 | 2053 |
| 2054 bool isOverWidget; | 2054 bool isOverWidget; |
| 2055 if (event.useLatchedEventNode()) { | 2055 if (event.useLatchedEventNode()) { |
| 2056 if (!m_latchedWheelEventNode) { | 2056 if (!m_latchedWheelEventNode) { |
| 2057 m_latchedWheelEventNode = node; | 2057 m_latchedWheelEventNode = node; |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2244 } | 2244 } |
| 2245 | 2245 |
| 2246 if (!eventTarget) { | 2246 if (!eventTarget) { |
| 2247 Document* document = m_frame->document(); | 2247 Document* document = m_frame->document(); |
| 2248 if (!document->layoutView()) | 2248 if (!document->layoutView()) |
| 2249 return false; | 2249 return false; |
| 2250 | 2250 |
| 2251 FrameView* view = m_frame->view(); | 2251 FrameView* view = m_frame->view(); |
| 2252 LayoutPoint viewPoint = view->rootFrameToContents(gestureEvent.position(
)); | 2252 LayoutPoint viewPoint = view->rootFrameToContents(gestureEvent.position(
)); |
| 2253 HitTestRequest request(HitTestRequest::ReadOnly); | 2253 HitTestRequest request(HitTestRequest::ReadOnly); |
| 2254 HitTestResult result(viewPoint); | 2254 HitTestResult result(request, viewPoint); |
| 2255 document->layoutView()->hitTest(request, result); | 2255 document->layoutView()->hitTest(result); |
| 2256 | 2256 |
| 2257 eventTarget = result.innerNode(); | 2257 eventTarget = result.innerNode(); |
| 2258 | 2258 |
| 2259 m_lastGestureScrollOverWidget = result.isOverWidget(); | 2259 m_lastGestureScrollOverWidget = result.isOverWidget(); |
| 2260 m_scrollGestureHandlingNode = eventTarget; | 2260 m_scrollGestureHandlingNode = eventTarget; |
| 2261 m_previousGestureScrolledNode = nullptr; | 2261 m_previousGestureScrolledNode = nullptr; |
| 2262 | 2262 |
| 2263 if (!scrollbar) | 2263 if (!scrollbar) |
| 2264 scrollbar = result.scrollbar(); | 2264 scrollbar = result.scrollbar(); |
| 2265 } | 2265 } |
| (...skipping 675 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2941 | 2941 |
| 2942 m_frame->view()->setCursor(pointerCursor()); | 2942 m_frame->view()->setCursor(pointerCursor()); |
| 2943 IntPoint locationInViewport = pinchViewport.rootFrameToViewport(locationInRo
otFrame); | 2943 IntPoint locationInViewport = pinchViewport.rootFrameToViewport(locationInRo
otFrame); |
| 2944 IntPoint globalPosition = view->hostWindow()->viewportToScreen(IntRect(locat
ionInViewport, IntSize())).location(); | 2944 IntPoint globalPosition = view->hostWindow()->viewportToScreen(IntRect(locat
ionInViewport, IntSize())).location(); |
| 2945 | 2945 |
| 2946 Node* targetNode = doc->focusedElement(); | 2946 Node* targetNode = doc->focusedElement(); |
| 2947 if (!targetNode) | 2947 if (!targetNode) |
| 2948 targetNode = doc; | 2948 targetNode = doc; |
| 2949 | 2949 |
| 2950 // Use the focused node as the target for hover and active. | 2950 // Use the focused node as the target for hover and active. |
| 2951 HitTestResult result(locationInRootFrame); | 2951 HitTestRequest request(HitTestRequest::Active); |
| 2952 HitTestResult result(request, locationInRootFrame); |
| 2952 result.setInnerNode(targetNode); | 2953 result.setInnerNode(targetNode); |
| 2953 doc->updateHoverActiveState(HitTestRequest::Active, result.innerElement()); | 2954 doc->updateHoverActiveState(request, result.innerElement()); |
| 2954 | 2955 |
| 2955 // The contextmenu event is a mouse event even when invoked using the keyboa
rd. | 2956 // The contextmenu event is a mouse event even when invoked using the keyboa
rd. |
| 2956 // This is required for web compatibility. | 2957 // This is required for web compatibility. |
| 2957 PlatformEvent::Type eventType = PlatformEvent::MousePressed; | 2958 PlatformEvent::Type eventType = PlatformEvent::MousePressed; |
| 2958 if (m_frame->settings()->showContextMenuOnMouseUp()) | 2959 if (m_frame->settings()->showContextMenuOnMouseUp()) |
| 2959 eventType = PlatformEvent::MouseReleased; | 2960 eventType = PlatformEvent::MouseReleased; |
| 2960 | 2961 |
| 2961 PlatformMouseEvent mouseEvent(locationInRootFrame, globalPosition, RightButt
on, eventType, 1, false, false, false, false, PlatformMouseEvent::RealOrIndistin
guishable, WTF::currentTime()); | 2962 PlatformMouseEvent mouseEvent(locationInRootFrame, globalPosition, RightButt
on, eventType, 1, false, false, false, false, PlatformMouseEvent::RealOrIndistin
guishable, WTF::currentTime()); |
| 2962 | 2963 |
| 2963 handleMousePressEvent(mouseEvent); | 2964 handleMousePressEvent(mouseEvent); |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3089 void EventHandler::hoverTimerFired(Timer<EventHandler>*) | 3090 void EventHandler::hoverTimerFired(Timer<EventHandler>*) |
| 3090 { | 3091 { |
| 3091 m_hoverTimer.stop(); | 3092 m_hoverTimer.stop(); |
| 3092 | 3093 |
| 3093 ASSERT(m_frame); | 3094 ASSERT(m_frame); |
| 3094 ASSERT(m_frame->document()); | 3095 ASSERT(m_frame->document()); |
| 3095 | 3096 |
| 3096 if (LayoutView* renderer = m_frame->contentRenderer()) { | 3097 if (LayoutView* renderer = m_frame->contentRenderer()) { |
| 3097 if (FrameView* view = m_frame->view()) { | 3098 if (FrameView* view = m_frame->view()) { |
| 3098 HitTestRequest request(HitTestRequest::Move); | 3099 HitTestRequest request(HitTestRequest::Move); |
| 3099 HitTestResult result(view->rootFrameToContents(m_lastKnownMousePosit
ion)); | 3100 HitTestResult result(request, view->rootFrameToContents(m_lastKnownM
ousePosition)); |
| 3100 renderer->hitTest(request, result); | 3101 renderer->hitTest(result); |
| 3101 m_frame->document()->updateHoverActiveState(request, result.innerEle
ment()); | 3102 m_frame->document()->updateHoverActiveState(request, result.innerEle
ment()); |
| 3102 } | 3103 } |
| 3103 } | 3104 } |
| 3104 } | 3105 } |
| 3105 | 3106 |
| 3106 void EventHandler::activeIntervalTimerFired(Timer<EventHandler>*) | 3107 void EventHandler::activeIntervalTimerFired(Timer<EventHandler>*) |
| 3107 { | 3108 { |
| 3108 m_activeIntervalTimer.stop(); | 3109 m_activeIntervalTimer.stop(); |
| 3109 | 3110 |
| 3110 if (m_frame | 3111 if (m_frame |
| (...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3348 ASSERT(event.event().type() == PlatformEvent::MouseMoved); | 3349 ASSERT(event.event().type() == PlatformEvent::MouseMoved); |
| 3349 // Callers must protect the reference to FrameView, since this function may
dispatch DOM | 3350 // Callers must protect the reference to FrameView, since this function may
dispatch DOM |
| 3350 // events, causing page/FrameView to go away. | 3351 // events, causing page/FrameView to go away. |
| 3351 ASSERT(m_frame); | 3352 ASSERT(m_frame); |
| 3352 ASSERT(m_frame->view()); | 3353 ASSERT(m_frame->view()); |
| 3353 if (!m_frame->page()) | 3354 if (!m_frame->page()) |
| 3354 return false; | 3355 return false; |
| 3355 | 3356 |
| 3356 if (m_mouseDownMayStartDrag) { | 3357 if (m_mouseDownMayStartDrag) { |
| 3357 HitTestRequest request(HitTestRequest::ReadOnly); | 3358 HitTestRequest request(HitTestRequest::ReadOnly); |
| 3358 HitTestResult result(m_mouseDownPos); | 3359 HitTestResult result(request, m_mouseDownPos); |
| 3359 m_frame->contentRenderer()->hitTest(request, result); | 3360 m_frame->contentRenderer()->hitTest(result); |
| 3360 Node* node = result.innerNode(); | 3361 Node* node = result.innerNode(); |
| 3361 if (node) { | 3362 if (node) { |
| 3362 DragController::SelectionDragPolicy selectionDragPolicy = event.even
t().timestamp() - m_mouseDownTimestamp < TextDragDelay | 3363 DragController::SelectionDragPolicy selectionDragPolicy = event.even
t().timestamp() - m_mouseDownTimestamp < TextDragDelay |
| 3363 ? DragController::DelayedSelectionDragResolution | 3364 ? DragController::DelayedSelectionDragResolution |
| 3364 : DragController::ImmediateSelectionDragResolution; | 3365 : DragController::ImmediateSelectionDragResolution; |
| 3365 dragState().m_dragSrc = m_frame->page()->dragController().draggableN
ode(m_frame, node, m_mouseDownPos, selectionDragPolicy, dragState().m_dragType); | 3366 dragState().m_dragSrc = m_frame->page()->dragController().draggableN
ode(m_frame, node, m_mouseDownPos, selectionDragPolicy, dragState().m_dragType); |
| 3366 } else { | 3367 } else { |
| 3367 dragState().m_dragSrc = nullptr; | 3368 dragState().m_dragSrc = nullptr; |
| 3368 } | 3369 } |
| 3369 | 3370 |
| (...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3630 case PlatformTouchPoint::TouchStationary: | 3631 case PlatformTouchPoint::TouchStationary: |
| 3631 // TouchStationary state is not converted to touch events, so fall throu
gh to assert. | 3632 // TouchStationary state is not converted to touch events, so fall throu
gh to assert. |
| 3632 default: | 3633 default: |
| 3633 ASSERT_NOT_REACHED(); | 3634 ASSERT_NOT_REACHED(); |
| 3634 return emptyAtom; | 3635 return emptyAtom; |
| 3635 } | 3636 } |
| 3636 } | 3637 } |
| 3637 | 3638 |
| 3638 HitTestResult EventHandler::hitTestResultInFrame(LocalFrame* frame, const Layout
Point& point, HitTestRequest::HitTestRequestType hitType) | 3639 HitTestResult EventHandler::hitTestResultInFrame(LocalFrame* frame, const Layout
Point& point, HitTestRequest::HitTestRequestType hitType) |
| 3639 { | 3640 { |
| 3640 HitTestResult result(point); | 3641 HitTestResult result(HitTestRequest(hitType), point); |
| 3641 | 3642 |
| 3642 if (!frame || !frame->contentRenderer()) | 3643 if (!frame || !frame->contentRenderer()) |
| 3643 return result; | 3644 return result; |
| 3644 if (frame->view()) { | 3645 if (frame->view()) { |
| 3645 IntRect rect = frame->view()->visibleContentRect(IncludeScrollbars); | 3646 IntRect rect = frame->view()->visibleContentRect(IncludeScrollbars); |
| 3646 if (!rect.contains(roundedIntPoint(point))) | 3647 if (!rect.contains(roundedIntPoint(point))) |
| 3647 return result; | 3648 return result; |
| 3648 } | 3649 } |
| 3649 frame->contentRenderer()->hitTest(HitTestRequest(hitType), result); | 3650 frame->contentRenderer()->hitTest(result); |
| 3650 return result; | 3651 return result; |
| 3651 } | 3652 } |
| 3652 | 3653 |
| 3653 bool EventHandler::handleTouchEvent(const PlatformTouchEvent& event) | 3654 bool EventHandler::handleTouchEvent(const PlatformTouchEvent& event) |
| 3654 { | 3655 { |
| 3655 TRACE_EVENT0("blink", "EventHandler::handleTouchEvent"); | 3656 TRACE_EVENT0("blink", "EventHandler::handleTouchEvent"); |
| 3656 | 3657 |
| 3657 const Vector<PlatformTouchPoint>& points = event.touchPoints(); | 3658 const Vector<PlatformTouchPoint>& points = event.touchPoints(); |
| 3658 | 3659 |
| 3659 unsigned i; | 3660 unsigned i; |
| (...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3994 unsigned EventHandler::accessKeyModifiers() | 3995 unsigned EventHandler::accessKeyModifiers() |
| 3995 { | 3996 { |
| 3996 #if OS(MACOSX) | 3997 #if OS(MACOSX) |
| 3997 return PlatformEvent::CtrlKey | PlatformEvent::AltKey; | 3998 return PlatformEvent::CtrlKey | PlatformEvent::AltKey; |
| 3998 #else | 3999 #else |
| 3999 return PlatformEvent::AltKey; | 4000 return PlatformEvent::AltKey; |
| 4000 #endif | 4001 #endif |
| 4001 } | 4002 } |
| 4002 | 4003 |
| 4003 } // namespace blink | 4004 } // namespace blink |
| OLD | NEW |