| 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 656 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 667 bool swallowEvent = false; | 667 bool swallowEvent = false; |
| 668 m_mousePressed = true; | 668 m_mousePressed = true; |
| 669 m_selectionInitiationState = HaveNotStartedSelection; | 669 m_selectionInitiationState = HaveNotStartedSelection; |
| 670 | 670 |
| 671 if (event.event().clickCount() == 2) | 671 if (event.event().clickCount() == 2) |
| 672 swallowEvent = handleMousePressEventDoubleClick(event); | 672 swallowEvent = handleMousePressEventDoubleClick(event); |
| 673 else if (event.event().clickCount() >= 3) | 673 else if (event.event().clickCount() >= 3) |
| 674 swallowEvent = handleMousePressEventTripleClick(event); | 674 swallowEvent = handleMousePressEventTripleClick(event); |
| 675 else | 675 else |
| 676 swallowEvent = handleMousePressEventSingleClick(event); | 676 swallowEvent = handleMousePressEventSingleClick(event); |
| 677 | 677 |
| 678 m_mouseDownMayStartAutoscroll = m_mouseDownMayStartSelect | 678 m_mouseDownMayStartAutoscroll = m_mouseDownMayStartSelect |
| 679 || (m_mousePressNode && m_mousePressNode->renderBox() && m_mousePressNod
e->renderBox()->canBeProgramaticallyScrolled()); | 679 || (m_mousePressNode && m_mousePressNode->renderBox() && m_mousePressNod
e->renderBox()->canBeProgramaticallyScrolled()); |
| 680 | 680 |
| 681 return swallowEvent; | 681 return swallowEvent; |
| 682 } | 682 } |
| 683 | 683 |
| 684 bool EventHandler::handleMouseDraggedEvent(const MouseEventWithHitTestResults& e
vent) | 684 bool EventHandler::handleMouseDraggedEvent(const MouseEventWithHitTestResults& e
vent) |
| 685 { | 685 { |
| 686 if (!m_mousePressed) | 686 if (!m_mousePressed) |
| 687 return false; | 687 return false; |
| 688 | 688 |
| 689 if (handleDrag(event, ShouldCheckDragHysteresis)) | 689 if (handleDrag(event, ShouldCheckDragHysteresis)) |
| 690 return true; | 690 return true; |
| 691 | 691 |
| 692 Node* targetNode = event.targetNode(); | 692 Node* targetNode = event.targetNode(); |
| 693 if (event.event().button() != LeftButton || !targetNode) | 693 if (event.event().button() != LeftButton || !targetNode) |
| 694 return false; | 694 return false; |
| 695 | 695 |
| 696 RenderObject* renderer = targetNode->renderer(); | |
| 697 if (!renderer) { | |
| 698 Node* parent = EventPathWalker::parent(targetNode); | |
| 699 if (!parent) | |
| 700 return false; | |
| 701 | |
| 702 renderer = parent->renderer(); | |
| 703 if (!renderer || !renderer->isListBox()) | |
| 704 return false; | |
| 705 } | |
| 706 | |
| 707 m_mouseDownMayStartDrag = false; | 696 m_mouseDownMayStartDrag = false; |
| 708 | 697 |
| 709 if (m_mouseDownMayStartAutoscroll && !panScrollInProgress()) { | |
| 710 m_autoscrollController->startAutoscrollForSelection(renderer); | |
| 711 m_mouseDownMayStartAutoscroll = false; | |
| 712 } | |
| 713 | |
| 714 if (m_selectionInitiationState != ExtendedSelection) { | 698 if (m_selectionInitiationState != ExtendedSelection) { |
| 715 HitTestRequest request(HitTestRequest::ReadOnly | HitTestRequest::Active
| HitTestRequest::DisallowShadowContent); | 699 HitTestRequest request(HitTestRequest::ReadOnly | HitTestRequest::Active
| HitTestRequest::DisallowShadowContent); |
| 716 HitTestResult result(m_mouseDownPos); | 700 HitTestResult result(m_mouseDownPos); |
| 717 m_frame->document()->renderView()->hitTest(request, result); | 701 m_frame->document()->renderView()->hitTest(request, result); |
| 718 | 702 |
| 719 updateSelectionForMouseDrag(result); | 703 updateSelectionForMouseDrag(result); |
| 720 } | 704 } |
| 721 updateSelectionForMouseDrag(event.hitTestResult()); | 705 updateSelectionForMouseDrag(event.hitTestResult()); |
| 722 return true; | 706 return true; |
| 723 } | 707 } |
| (...skipping 934 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1658 } | 1642 } |
| 1659 } | 1643 } |
| 1660 } | 1644 } |
| 1661 | 1645 |
| 1662 m_lastMouseMoveEventSubframe = newSubframe; | 1646 m_lastMouseMoveEventSubframe = newSubframe; |
| 1663 | 1647 |
| 1664 if (swallowEvent) | 1648 if (swallowEvent) |
| 1665 return true; | 1649 return true; |
| 1666 | 1650 |
| 1667 swallowEvent = !dispatchMouseEvent(eventNames().mousemoveEvent, mev.targetNo
de(), false, 0, mouseEvent, true); | 1651 swallowEvent = !dispatchMouseEvent(eventNames().mousemoveEvent, mev.targetNo
de(), false, 0, mouseEvent, true); |
| 1652 |
| 1653 RenderObject* renderer = targetNode->renderer(); |
| 1654 if (!renderer) { |
| 1655 Node* parent = EventPathWalker::parent(targetNode); |
| 1656 if (!parent) |
| 1657 return false; |
| 1658 |
| 1659 renderer = parent->renderer(); |
| 1660 if (!renderer || !renderer->isListBox()) |
| 1661 return false; |
| 1662 } |
| 1663 |
| 1664 if (m_mouseDownMayStartAutoscroll && !panScrollInProgress()) { |
| 1665 m_autoscrollController->startAutoscrollForSelection(renderer); |
| 1666 m_mouseDownMayStartAutoscroll = false; |
| 1667 } |
| 1668 if (!swallowEvent) | 1668 if (!swallowEvent) |
| 1669 swallowEvent = handleMouseDraggedEvent(mev); | 1669 swallowEvent = handleMouseDraggedEvent(mev); |
| 1670 | 1670 |
| 1671 return swallowEvent; | 1671 return swallowEvent; |
| 1672 } | 1672 } |
| 1673 | 1673 |
| 1674 void EventHandler::invalidateClick() | 1674 void EventHandler::invalidateClick() |
| 1675 { | 1675 { |
| 1676 m_clickCount = 0; | 1676 m_clickCount = 0; |
| 1677 m_clickNode = 0; | 1677 m_clickNode = 0; |
| (...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1989 void EventHandler::setCapturingMouseEventsNode(PassRefPtr<Node> n) | 1989 void EventHandler::setCapturingMouseEventsNode(PassRefPtr<Node> n) |
| 1990 { | 1990 { |
| 1991 m_capturingMouseEventsNode = n; | 1991 m_capturingMouseEventsNode = n; |
| 1992 m_eventHandlerWillResetCapturingMouseEventsNode = false; | 1992 m_eventHandlerWillResetCapturingMouseEventsNode = false; |
| 1993 } | 1993 } |
| 1994 | 1994 |
| 1995 MouseEventWithHitTestResults EventHandler::prepareMouseEvent(const HitTestReques
t& request, const PlatformMouseEvent& mev) | 1995 MouseEventWithHitTestResults EventHandler::prepareMouseEvent(const HitTestReques
t& request, const PlatformMouseEvent& mev) |
| 1996 { | 1996 { |
| 1997 ASSERT(m_frame); | 1997 ASSERT(m_frame); |
| 1998 ASSERT(m_frame->document()); | 1998 ASSERT(m_frame->document()); |
| 1999 | 1999 |
| 2000 return m_frame->document()->prepareMouseEvent(request, documentPointForWindo
wPoint(m_frame, mev.position()), mev); | 2000 return m_frame->document()->prepareMouseEvent(request, documentPointForWindo
wPoint(m_frame, mev.position()), mev); |
| 2001 } | 2001 } |
| 2002 | 2002 |
| 2003 #if ENABLE(SVG) | 2003 #if ENABLE(SVG) |
| 2004 static inline SVGElementInstance* instanceAssociatedWithShadowTreeElement(Node*
referenceNode) | 2004 static inline SVGElementInstance* instanceAssociatedWithShadowTreeElement(Node*
referenceNode) |
| 2005 { | 2005 { |
| 2006 if (!referenceNode || !referenceNode->isSVGElement()) | 2006 if (!referenceNode || !referenceNode->isSVGElement()) |
| 2007 return 0; | 2007 return 0; |
| 2008 | 2008 |
| 2009 ShadowRoot* shadowRoot = referenceNode->containingShadowRoot(); | 2009 ShadowRoot* shadowRoot = referenceNode->containingShadowRoot(); |
| (...skipping 1988 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3998 unsigned EventHandler::accessKeyModifiers() | 3998 unsigned EventHandler::accessKeyModifiers() |
| 3999 { | 3999 { |
| 4000 #if OS(DARWIN) | 4000 #if OS(DARWIN) |
| 4001 return PlatformEvent::CtrlKey | PlatformEvent::AltKey; | 4001 return PlatformEvent::CtrlKey | PlatformEvent::AltKey; |
| 4002 #else | 4002 #else |
| 4003 return PlatformEvent::AltKey; | 4003 return PlatformEvent::AltKey; |
| 4004 #endif | 4004 #endif |
| 4005 } | 4005 } |
| 4006 | 4006 |
| 4007 } // namespace WebCore | 4007 } // namespace WebCore |
| OLD | NEW |