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 632 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 643 m_mouseDownMayStartAutoscroll = m_mouseDownMayStartSelect | 643 m_mouseDownMayStartAutoscroll = m_mouseDownMayStartSelect |
| 644 || (m_mousePressNode && m_mousePressNode->renderBox() && m_mousePressNod e->renderBox()->canBeProgramaticallyScrolled()); | 644 || (m_mousePressNode && m_mousePressNode->renderBox() && m_mousePressNod e->renderBox()->canBeProgramaticallyScrolled()); |
| 645 | 645 |
| 646 return swallowEvent; | 646 return swallowEvent; |
| 647 } | 647 } |
| 648 | 648 |
| 649 bool EventHandler::handleMouseDraggedEvent(const MouseEventWithHitTestResults& e vent) | 649 bool EventHandler::handleMouseDraggedEvent(const MouseEventWithHitTestResults& e vent) |
| 650 { | 650 { |
| 651 TRACE_EVENT0("blink", "EventHandler::handleMouseDraggedEvent"); | 651 TRACE_EVENT0("blink", "EventHandler::handleMouseDraggedEvent"); |
| 652 | 652 |
| 653 if (!m_mousePressed) | 653 if (!m_mousePressed || event.event().button() != LeftButton) |
|
Rick Byers
2014/11/14 18:29:28
You said this case is "probably dead". Should we
dcheng
2014/11/14 18:41:26
The thing is, we always bailed out anyway if it wa
| |
| 654 return false; | 654 return false; |
| 655 | 655 |
| 656 if (handleDrag(event, DragInitiator::Mouse)) | 656 if (handleDrag(event, DragInitiator::Mouse)) |
| 657 return true; | 657 return true; |
| 658 | 658 |
| 659 Node* targetNode = event.innerNode(); | 659 Node* targetNode = event.innerNode(); |
| 660 if (event.event().button() != LeftButton || !targetNode) | 660 if (!targetNode) |
| 661 return false; | 661 return false; |
| 662 | 662 |
| 663 RenderObject* renderer = targetNode->renderer(); | 663 RenderObject* renderer = targetNode->renderer(); |
| 664 if (!renderer) { | 664 if (!renderer) { |
| 665 Node* parent = NodeRenderingTraversal::parent(targetNode); | 665 Node* parent = NodeRenderingTraversal::parent(targetNode); |
| 666 if (!parent) | 666 if (!parent) |
| 667 return false; | 667 return false; |
| 668 | 668 |
| 669 renderer = parent->renderer(); | 669 renderer = parent->renderer(); |
| 670 if (!renderer || !renderer->isListBox()) | 670 if (!renderer || !renderer->isListBox()) |
| (...skipping 2531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3202 bool EventHandler::handleDrag(const MouseEventWithHitTestResults& event, DragIni tiator initiator) | 3202 bool EventHandler::handleDrag(const MouseEventWithHitTestResults& event, DragIni tiator initiator) |
| 3203 { | 3203 { |
| 3204 ASSERT(event.event().type() == PlatformEvent::MouseMoved); | 3204 ASSERT(event.event().type() == PlatformEvent::MouseMoved); |
| 3205 // Callers must protect the reference to FrameView, since this function may dispatch DOM | 3205 // Callers must protect the reference to FrameView, since this function may dispatch DOM |
| 3206 // events, causing page/FrameView to go away. | 3206 // events, causing page/FrameView to go away. |
| 3207 ASSERT(m_frame); | 3207 ASSERT(m_frame); |
| 3208 ASSERT(m_frame->view()); | 3208 ASSERT(m_frame->view()); |
| 3209 if (!m_frame->page()) | 3209 if (!m_frame->page()) |
| 3210 return false; | 3210 return false; |
| 3211 | 3211 |
| 3212 // FIXME: Does this ever get hit?? | |
| 3213 if (event.event().button() != LeftButton || event.event().type() != Platform Event::MouseMoved) { | |
| 3214 // If we allowed the other side of the bridge to handle a drag | |
| 3215 // last time, then m_mousePressed might still be set. So we | |
| 3216 // clear it now to make sure the next move after a drag | |
| 3217 // doesn't look like a drag. | |
| 3218 m_mousePressed = false; | |
| 3219 return false; | |
| 3220 } | |
| 3221 | |
| 3222 if (m_mouseDownMayStartDrag) { | 3212 if (m_mouseDownMayStartDrag) { |
| 3223 HitTestRequest request(HitTestRequest::ReadOnly); | 3213 HitTestRequest request(HitTestRequest::ReadOnly); |
| 3224 HitTestResult result(m_mouseDownPos); | 3214 HitTestResult result(m_mouseDownPos); |
| 3225 m_frame->contentRenderer()->hitTest(request, result); | 3215 m_frame->contentRenderer()->hitTest(request, result); |
| 3226 Node* node = result.innerNode(); | 3216 Node* node = result.innerNode(); |
| 3227 if (node) { | 3217 if (node) { |
| 3228 DragController::SelectionDragPolicy selectionDragPolicy = event.even t().timestamp() - m_mouseDownTimestamp < TextDragDelay | 3218 DragController::SelectionDragPolicy selectionDragPolicy = event.even t().timestamp() - m_mouseDownTimestamp < TextDragDelay |
| 3229 ? DragController::DelayedSelectionDragResolution | 3219 ? DragController::DelayedSelectionDragResolution |
| 3230 : DragController::ImmediateSelectionDragResolution; | 3220 : DragController::ImmediateSelectionDragResolution; |
| 3231 dragState().m_dragSrc = m_frame->page()->dragController().draggableN ode(m_frame, node, m_mouseDownPos, selectionDragPolicy, dragState().m_dragType); | 3221 dragState().m_dragSrc = m_frame->page()->dragController().draggableN ode(m_frame, node, m_mouseDownPos, selectionDragPolicy, dragState().m_dragType); |
| (...skipping 634 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3866 unsigned EventHandler::accessKeyModifiers() | 3856 unsigned EventHandler::accessKeyModifiers() |
| 3867 { | 3857 { |
| 3868 #if OS(MACOSX) | 3858 #if OS(MACOSX) |
| 3869 return PlatformEvent::CtrlKey | PlatformEvent::AltKey; | 3859 return PlatformEvent::CtrlKey | PlatformEvent::AltKey; |
| 3870 #else | 3860 #else |
| 3871 return PlatformEvent::AltKey; | 3861 return PlatformEvent::AltKey; |
| 3872 #endif | 3862 #endif |
| 3873 } | 3863 } |
| 3874 | 3864 |
| 3875 } // namespace blink | 3865 } // namespace blink |
| OLD | NEW |