Chromium Code Reviews| 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 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 404 if (!parent) | 404 if (!parent) |
| 405 return WebInputEventResult::NotHandled; | 405 return WebInputEventResult::NotHandled; |
| 406 | 406 |
| 407 layoutObject = parent->layoutObject(); | 407 layoutObject = parent->layoutObject(); |
| 408 if (!layoutObject || !layoutObject->isListBox()) | 408 if (!layoutObject || !layoutObject->isListBox()) |
| 409 return WebInputEventResult::NotHandled; | 409 return WebInputEventResult::NotHandled; |
| 410 } | 410 } |
| 411 | 411 |
| 412 m_mouseDownMayStartDrag = false; | 412 m_mouseDownMayStartDrag = false; |
| 413 | 413 |
| 414 if (m_mouseDownMayStartAutoscroll && !m_scrollManager.panScrollInProgress()) { | 414 if (m_mouseDownMayStartAutoscroll && !m_scrollManager.middleClickAutoscrollI nProgress()) { |
| 415 if (AutoscrollController* controller = m_scrollManager.autoscrollControl ler()) { | 415 if (AutoscrollController* controller = m_scrollManager.autoscrollControl ler()) { |
| 416 controller->startAutoscrollForSelection(layoutObject); | 416 controller->startAutoscrollForSelection(layoutObject); |
| 417 m_mouseDownMayStartAutoscroll = false; | 417 m_mouseDownMayStartAutoscroll = false; |
| 418 } | 418 } |
| 419 } | 419 } |
| 420 | 420 |
| 421 selectionController().handleMouseDraggedEvent(event, m_mouseDownPos, m_dragS tartPos, m_mousePressNode.get(), m_lastKnownMousePosition); | 421 selectionController().handleMouseDraggedEvent(event, m_mouseDownPos, m_dragS tartPos, m_mousePressNode.get(), m_lastKnownMousePosition); |
| 422 return WebInputEventResult::HandledSystem; | 422 return WebInputEventResult::HandledSystem; |
| 423 } | 423 } |
| 424 | 424 |
| 425 void EventHandler::updateSelectionForMouseDrag() | 425 void EventHandler::updateSelectionForMouseDrag() |
| 426 { | 426 { |
| 427 selectionController().updateSelectionForMouseDrag(m_mousePressNode.get(), m_ dragStartPos, m_lastKnownMousePosition); | 427 selectionController().updateSelectionForMouseDrag(m_mousePressNode.get(), m_ dragStartPos, m_lastKnownMousePosition); |
| 428 } | 428 } |
| 429 | 429 |
| 430 WebInputEventResult EventHandler::handleMouseReleaseEvent(const MouseEventWithHi tTestResults& event) | 430 WebInputEventResult EventHandler::handleMouseReleaseEvent(const MouseEventWithHi tTestResults& event) |
| 431 { | 431 { |
| 432 AutoscrollController* controller = m_scrollManager.autoscrollController(); | 432 AutoscrollController* controller = m_scrollManager.autoscrollController(); |
| 433 if (controller && controller->autoscrollInProgress()) | 433 if (controller && controller->autoscrollInProgress()) |
| 434 m_scrollManager.stopAutoscroll(); | 434 m_scrollManager.stopAutoscroll(); |
| 435 | 435 |
| 436 return selectionController().handleMouseReleaseEvent(event, m_dragStartPos) ? WebInputEventResult::HandledSystem : WebInputEventResult::NotHandled; | 436 return selectionController().handleMouseReleaseEvent(event, m_dragStartPos) ? WebInputEventResult::HandledSystem : WebInputEventResult::NotHandled; |
| 437 } | 437 } |
| 438 | 438 |
| 439 #if OS(WIN) | |
| 440 | |
| 441 void EventHandler::startPanScrolling(LayoutObject* layoutObject) | 439 void EventHandler::startPanScrolling(LayoutObject* layoutObject) |
| 442 { | 440 { |
|
bokan
2016/09/07 16:33:46
Add a DCHECK for the new RuntimeEnabledFeature her
| |
| 443 if (!layoutObject->isBox()) | 441 if (!layoutObject->isBox()) |
| 444 return; | 442 return; |
| 445 AutoscrollController* controller = m_scrollManager.autoscrollController(); | 443 AutoscrollController* controller = m_scrollManager.autoscrollController(); |
| 446 if (!controller) | 444 if (!controller) |
| 447 return; | 445 return; |
| 448 controller->startPanScrolling(toLayoutBox(layoutObject), lastKnownMousePosit ion()); | 446 controller->startPanScrolling(toLayoutBox(layoutObject), lastKnownMousePosit ion()); |
| 449 invalidateClick(); | 447 invalidateClick(); |
| 450 } | 448 } |
| 451 | 449 |
| 452 #endif // OS(WIN) | |
| 453 | |
| 454 HitTestResult EventHandler::hitTestResultAtPoint(const LayoutPoint& point, HitTe stRequest::HitTestRequestType hitType, const LayoutSize& padding) | 450 HitTestResult EventHandler::hitTestResultAtPoint(const LayoutPoint& point, HitTe stRequest::HitTestRequestType hitType, const LayoutSize& padding) |
| 455 { | 451 { |
| 456 TRACE_EVENT0("blink", "EventHandler::hitTestResultAtPoint"); | 452 TRACE_EVENT0("blink", "EventHandler::hitTestResultAtPoint"); |
| 457 | 453 |
| 458 ASSERT((hitType & HitTestRequest::ListBased) || padding.isEmpty()); | 454 ASSERT((hitType & HitTestRequest::ListBased) || padding.isEmpty()); |
| 459 | 455 |
| 460 // We always send hitTestResultAtPoint to the main frame if we have one, | 456 // We always send hitTestResultAtPoint to the main frame if we have one, |
| 461 // otherwise we might hit areas that are obscured by higher frames. | 457 // otherwise we might hit areas that are obscured by higher frames. |
| 462 if (m_frame->page()) { | 458 if (m_frame->page()) { |
| 463 LocalFrame* mainFrame = m_frame->localFrameRoot(); | 459 LocalFrame* mainFrame = m_frame->localFrameRoot(); |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 594 } | 590 } |
| 595 | 591 |
| 596 OptionalCursor EventHandler::selectCursor(const HitTestResult& result) | 592 OptionalCursor EventHandler::selectCursor(const HitTestResult& result) |
| 597 { | 593 { |
| 598 if (m_scrollManager.inResizeMode()) | 594 if (m_scrollManager.inResizeMode()) |
| 599 return NoCursorChange; | 595 return NoCursorChange; |
| 600 | 596 |
| 601 Page* page = m_frame->page(); | 597 Page* page = m_frame->page(); |
| 602 if (!page) | 598 if (!page) |
| 603 return NoCursorChange; | 599 return NoCursorChange; |
| 604 if (m_scrollManager.panScrollInProgress()) | 600 if (m_scrollManager.middleClickAutoscrollInProgress()) |
| 605 return NoCursorChange; | 601 return NoCursorChange; |
| 606 | 602 |
| 607 Node* node = result.innerPossiblyPseudoNode(); | 603 Node* node = result.innerPossiblyPseudoNode(); |
| 608 if (!node) | 604 if (!node) |
| 609 return selectAutoCursor(result, node, iBeamCursor()); | 605 return selectAutoCursor(result, node, iBeamCursor()); |
| 610 | 606 |
| 611 LayoutObject* layoutObject = node->layoutObject(); | 607 LayoutObject* layoutObject = node->layoutObject(); |
| 612 const ComputedStyle* style = layoutObject ? layoutObject->style() : nullptr; | 608 const ComputedStyle* style = layoutObject ? layoutObject->style() : nullptr; |
| 613 | 609 |
| 614 if (layoutObject) { | 610 if (layoutObject) { |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 824 // has been handled. See crbug.com/269917 | 820 // has been handled. See crbug.com/269917 |
| 825 m_capturesDragging = subframe->eventHandler().capturesDragging(); | 821 m_capturesDragging = subframe->eventHandler().capturesDragging(); |
| 826 if (m_mousePressed && m_capturesDragging) { | 822 if (m_mousePressed && m_capturesDragging) { |
| 827 m_capturingMouseEventsNode = mev.innerNode(); | 823 m_capturingMouseEventsNode = mev.innerNode(); |
| 828 m_eventHandlerWillResetCapturingMouseEventsNode = true; | 824 m_eventHandlerWillResetCapturingMouseEventsNode = true; |
| 829 } | 825 } |
| 830 invalidateClick(); | 826 invalidateClick(); |
| 831 return result; | 827 return result; |
| 832 } | 828 } |
| 833 | 829 |
| 834 #if OS(WIN) | 830 if (RuntimeEnabledFeatures::middleClickAutoscrollEnabled()) { |
| 835 // We store whether pan scrolling is in progress before calling stopAutoscro ll() | 831 // We store whether pan scrolling is in progress before calling stopAuto scroll() |
| 836 // because it will set m_autoscrollType to NoAutoscroll on return. | 832 // because it will set m_autoscrollType to NoAutoscroll on return. |
| 837 bool isPanScrollInProgress = m_scrollManager.panScrollInProgress(); | 833 bool isPanScrollInProgress = m_scrollManager.middleClickAutoscrollInProg ress(); |
| 838 m_scrollManager.stopAutoscroll(); | 834 m_scrollManager.stopAutoscroll(); |
| 839 if (isPanScrollInProgress) { | 835 if (isPanScrollInProgress) { |
| 840 // We invalidate the click when exiting pan scrolling so that we don't i nadvertently navigate | 836 // We invalidate the click when exiting pan scrolling so that we don 't inadvertently navigate |
| 841 // away from the current page (e.g. the click was on a hyperlink). See < rdar://problem/6095023>. | 837 // away from the current page (e.g. the click was on a hyperlink). S ee <rdar://problem/6095023>. |
| 842 invalidateClick(); | 838 invalidateClick(); |
| 843 return WebInputEventResult::HandledSuppressed; | 839 return WebInputEventResult::HandledSuppressed; |
| 840 } | |
| 844 } | 841 } |
| 845 #endif | |
| 846 | 842 |
| 847 m_clickCount = mouseEvent.clickCount(); | 843 m_clickCount = mouseEvent.clickCount(); |
| 848 m_clickNode = mev.innerNode()->isTextNode() ? FlatTreeTraversal::parent(*me v.innerNode()) : mev.innerNode(); | 844 m_clickNode = mev.innerNode()->isTextNode() ? FlatTreeTraversal::parent(*me v.innerNode()) : mev.innerNode(); |
| 849 | 845 |
| 850 if (!mouseEvent.fromTouch()) | 846 if (!mouseEvent.fromTouch()) |
| 851 m_frame->selection().setCaretBlinkingSuspended(true); | 847 m_frame->selection().setCaretBlinkingSuspended(true); |
| 852 | 848 |
| 853 WebInputEventResult eventResult = updatePointerTargetAndDispatchEvents(Event TypeNames::mousedown, mev.innerNode(), m_clickCount, mev.event()); | 849 WebInputEventResult eventResult = updatePointerTargetAndDispatchEvents(Event TypeNames::mousedown, mev.innerNode(), m_clickCount, mev.event()); |
| 854 | 850 |
| 855 if (eventResult == WebInputEventResult::NotHandled && m_frame->view()) { | 851 if (eventResult == WebInputEventResult::NotHandled && m_frame->view()) { |
| (...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1106 if (!mouseEvent.fromTouch()) | 1102 if (!mouseEvent.fromTouch()) |
| 1107 m_frame->selection().setCaretBlinkingSuspended(false); | 1103 m_frame->selection().setCaretBlinkingSuspended(false); |
| 1108 | 1104 |
| 1109 std::unique_ptr<UserGestureIndicator> gestureIndicator; | 1105 std::unique_ptr<UserGestureIndicator> gestureIndicator; |
| 1110 | 1106 |
| 1111 if (m_frame->localFrameRoot()->eventHandler().m_lastMouseDownUserGestureToke n) | 1107 if (m_frame->localFrameRoot()->eventHandler().m_lastMouseDownUserGestureToke n) |
| 1112 gestureIndicator = wrapUnique(new UserGestureIndicator(m_frame->localFra meRoot()->eventHandler().m_lastMouseDownUserGestureToken.release())); | 1108 gestureIndicator = wrapUnique(new UserGestureIndicator(m_frame->localFra meRoot()->eventHandler().m_lastMouseDownUserGestureToken.release())); |
| 1113 else | 1109 else |
| 1114 gestureIndicator = wrapUnique(new UserGestureIndicator(DefinitelyProcess ingUserGesture)); | 1110 gestureIndicator = wrapUnique(new UserGestureIndicator(DefinitelyProcess ingUserGesture)); |
| 1115 | 1111 |
| 1116 #if OS(WIN) | 1112 if (RuntimeEnabledFeatures::middleClickAutoscrollEnabled()) { |
| 1117 if (Page* page = m_frame->page()) | 1113 if (Page* page = m_frame->page()) |
| 1118 page->autoscrollController().handleMouseReleaseForPanScrolling(m_frame, mouseEvent); | 1114 page->autoscrollController().handleMouseReleaseForPanScrolling(m_fra me, mouseEvent); |
| 1119 #endif | 1115 } |
| 1120 | 1116 |
| 1121 m_mousePressed = false; | 1117 m_mousePressed = false; |
| 1122 setLastKnownMousePosition(mouseEvent); | 1118 setLastKnownMousePosition(mouseEvent); |
| 1123 | 1119 |
| 1124 if (m_svgPan) { | 1120 if (m_svgPan) { |
| 1125 m_svgPan = false; | 1121 m_svgPan = false; |
| 1126 m_frame->document()->accessSVGExtensions().updatePan(m_frame->view()->ro otFrameToContents(m_lastKnownMousePosition)); | 1122 m_frame->document()->accessSVGExtensions().updatePan(m_frame->view()->ro otFrameToContents(m_lastKnownMousePosition)); |
| 1127 return WebInputEventResult::HandledSuppressed; | 1123 return WebInputEventResult::HandledSuppressed; |
| 1128 } | 1124 } |
| 1129 | 1125 |
| (...skipping 1476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2606 | 2602 |
| 2607 FrameHost* EventHandler::frameHost() const | 2603 FrameHost* EventHandler::frameHost() const |
| 2608 { | 2604 { |
| 2609 if (!m_frame->page()) | 2605 if (!m_frame->page()) |
| 2610 return nullptr; | 2606 return nullptr; |
| 2611 | 2607 |
| 2612 return &m_frame->page()->frameHost(); | 2608 return &m_frame->page()->frameHost(); |
| 2613 } | 2609 } |
| 2614 | 2610 |
| 2615 } // namespace blink | 2611 } // namespace blink |
| OLD | NEW |