| 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 1238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1249 | 1249 |
| 1250 WebInputEventResult eventResult = WebInputEventResult::NotHandled; | 1250 WebInputEventResult eventResult = WebInputEventResult::NotHandled; |
| 1251 RefPtrWillBeRawPtr<LocalFrame> newSubframe = m_capturingMouseEventsNode.get(
) ? subframeForTargetNode(m_capturingMouseEventsNode.get()) : subframeForHitTest
Result(mev); | 1251 RefPtrWillBeRawPtr<LocalFrame> newSubframe = m_capturingMouseEventsNode.get(
) ? subframeForTargetNode(m_capturingMouseEventsNode.get()) : subframeForHitTest
Result(mev); |
| 1252 | 1252 |
| 1253 // We want mouseouts to happen first, from the inside out. First send a mov
e event to the last subframe so that it will fire mouseouts. | 1253 // We want mouseouts to happen first, from the inside out. First send a mov
e event to the last subframe so that it will fire mouseouts. |
| 1254 if (m_lastMouseMoveEventSubframe && m_lastMouseMoveEventSubframe->tree().isD
escendantOf(m_frame) && m_lastMouseMoveEventSubframe != newSubframe) | 1254 if (m_lastMouseMoveEventSubframe && m_lastMouseMoveEventSubframe->tree().isD
escendantOf(m_frame) && m_lastMouseMoveEventSubframe != newSubframe) |
| 1255 m_lastMouseMoveEventSubframe->eventHandler().handleMouseLeaveEvent(mev.e
vent()); | 1255 m_lastMouseMoveEventSubframe->eventHandler().handleMouseLeaveEvent(mev.e
vent()); |
| 1256 | 1256 |
| 1257 if (newSubframe) { | 1257 if (newSubframe) { |
| 1258 // Update over/out state before passing the event to the subframe. | 1258 // Update over/out state before passing the event to the subframe. |
| 1259 updateMouseEventTargetNode(mev.innerNode(), mev.event()); | 1259 updateMouseEventTargetNode(mev.innerNode(), mev.event(), true); |
| 1260 | 1260 |
| 1261 // Event dispatch in updateMouseEventTargetNode may have caused the subf
rame of the target | 1261 // Event dispatch in updateMouseEventTargetNode may have caused the subf
rame of the target |
| 1262 // node to be detached from its FrameView, in which case the event shoul
d not be passed. | 1262 // node to be detached from its FrameView, in which case the event shoul
d not be passed. |
| 1263 if (newSubframe->view()) | 1263 if (newSubframe->view()) |
| 1264 eventResult = passMouseMoveEventToSubframe(mev, newSubframe.get(), h
overedNode); | 1264 eventResult = passMouseMoveEventToSubframe(mev, newSubframe.get(), h
overedNode); |
| 1265 } else { | 1265 } else { |
| 1266 if (scrollbar && !m_mousePressed) | 1266 if (scrollbar && !m_mousePressed) |
| 1267 scrollbar->mouseMoved(mev.event()); // Handle hover effects on platf
orms that support visual feedback on scrollbar hovering. | 1267 scrollbar->mouseMoved(mev.event()); // Handle hover effects on platf
orms that support visual feedback on scrollbar hovering. |
| 1268 if (FrameView* view = m_frame->view()) { | 1268 if (FrameView* view = m_frame->view()) { |
| 1269 OptionalCursor optionalCursor = selectCursor(mev.hitTestResult()); | 1269 OptionalCursor optionalCursor = selectCursor(mev.hitTestResult()); |
| (...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1583 } | 1583 } |
| 1584 | 1584 |
| 1585 MouseEventWithHitTestResults EventHandler::prepareMouseEvent(const HitTestReques
t& request, const PlatformMouseEvent& mev) | 1585 MouseEventWithHitTestResults EventHandler::prepareMouseEvent(const HitTestReques
t& request, const PlatformMouseEvent& mev) |
| 1586 { | 1586 { |
| 1587 ASSERT(m_frame); | 1587 ASSERT(m_frame); |
| 1588 ASSERT(m_frame->document()); | 1588 ASSERT(m_frame->document()); |
| 1589 | 1589 |
| 1590 return m_frame->document()->prepareMouseEvent(request, contentPointFromRootF
rame(m_frame, mev.position()), mev); | 1590 return m_frame->document()->prepareMouseEvent(request, contentPointFromRootF
rame(m_frame, mev.position()), mev); |
| 1591 } | 1591 } |
| 1592 | 1592 |
| 1593 void EventHandler::updateMouseEventTargetNode(Node* targetNode, const PlatformMo
useEvent& mouseEvent) | 1593 void EventHandler::updateMouseEventTargetNode(Node* targetNode, |
| 1594 const PlatformMouseEvent& mouseEvent, bool setPointerPosition) |
| 1594 { | 1595 { |
| 1595 Node* result = targetNode; | 1596 Node* result = targetNode; |
| 1596 | 1597 |
| 1597 // If we're capturing, we always go right to that node. | 1598 // If we're capturing, we always go right to that node. |
| 1598 if (m_capturingMouseEventsNode) { | 1599 if (m_capturingMouseEventsNode) { |
| 1599 result = m_capturingMouseEventsNode.get(); | 1600 result = m_capturingMouseEventsNode.get(); |
| 1600 } else { | 1601 } else { |
| 1601 // If the target node is a text node, dispatch on the parent node - rdar
://4196646 | 1602 // If the target node is a text node, dispatch on the parent node - rdar
://4196646 |
| 1602 if (result && result->isTextNode()) | 1603 if (result && result->isTextNode()) |
| 1603 result = FlatTreeTraversal::parent(*result); | 1604 result = FlatTreeTraversal::parent(*result); |
| (...skipping 28 matching lines...) Expand all Loading... |
| 1632 if (ScrollableArea* scrollableAreaForNodeUnderMouse = associatedScrollab
leArea(layerForNodeUnderMouse)) | 1633 if (ScrollableArea* scrollableAreaForNodeUnderMouse = associatedScrollab
leArea(layerForNodeUnderMouse)) |
| 1633 scrollableAreaForNodeUnderMouse->mouseEnteredContentArea(); | 1634 scrollableAreaForNodeUnderMouse->mouseEnteredContentArea(); |
| 1634 } | 1635 } |
| 1635 | 1636 |
| 1636 if (lastNodeUnderMouse && lastNodeUnderMouse->document() != m_frame->documen
t()) { | 1637 if (lastNodeUnderMouse && lastNodeUnderMouse->document() != m_frame->documen
t()) { |
| 1637 lastNodeUnderMouse = nullptr; | 1638 lastNodeUnderMouse = nullptr; |
| 1638 m_lastScrollbarUnderMouse = nullptr; | 1639 m_lastScrollbarUnderMouse = nullptr; |
| 1639 } | 1640 } |
| 1640 | 1641 |
| 1641 m_pointerEventManager.sendNodeTransitionEvents(lastNodeUnderMouse, | 1642 m_pointerEventManager.sendNodeTransitionEvents(lastNodeUnderMouse, |
| 1642 m_nodeUnderMouse, mouseEvent, m_frame->document()->domWindow()); | 1643 m_nodeUnderMouse, mouseEvent, m_frame->document()->domWindow(), |
| 1644 setPointerPosition); |
| 1643 } | 1645 } |
| 1644 | 1646 |
| 1645 WebInputEventResult EventHandler::dispatchMouseEvent(const AtomicString& eventTy
pe, Node* targetNode, int clickCount, const PlatformMouseEvent& mouseEvent) | 1647 WebInputEventResult EventHandler::dispatchMouseEvent(const AtomicString& eventTy
pe, Node* targetNode, int clickCount, const PlatformMouseEvent& mouseEvent) |
| 1646 { | 1648 { |
| 1647 updateMouseEventTargetNode(targetNode, mouseEvent); | 1649 updateMouseEventTargetNode(targetNode, mouseEvent); |
| 1648 if (!m_nodeUnderMouse) | 1650 if (!m_nodeUnderMouse) |
| 1649 return WebInputEventResult::NotHandled; | 1651 return WebInputEventResult::NotHandled; |
| 1650 | 1652 |
| 1651 RefPtrWillBeRawPtr<MouseEvent> event = MouseEvent::create(eventType, m_nodeU
nderMouse->document().domWindow(), mouseEvent, clickCount, nullptr); | 1653 RefPtrWillBeRawPtr<MouseEvent> event = MouseEvent::create(eventType, m_nodeU
nderMouse->document().domWindow(), mouseEvent, clickCount, nullptr); |
| 1652 return toWebInputEventResult(m_nodeUnderMouse->dispatchEvent(event)); | 1654 return toWebInputEventResult(m_nodeUnderMouse->dispatchEvent(event)); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 1674 } | 1676 } |
| 1675 | 1677 |
| 1676 // TODO(mustaq): Make PE drive ME dispatch & bookkeeping in EventHandler. | 1678 // TODO(mustaq): Make PE drive ME dispatch & bookkeeping in EventHandler. |
| 1677 WebInputEventResult EventHandler::updatePointerTargetAndDispatchEvents(const Ato
micString& mouseEventType, Node* targetNode, int clickCount, const PlatformMouse
Event& mouseEvent) | 1679 WebInputEventResult EventHandler::updatePointerTargetAndDispatchEvents(const Ato
micString& mouseEventType, Node* targetNode, int clickCount, const PlatformMouse
Event& mouseEvent) |
| 1678 { | 1680 { |
| 1679 ASSERT(mouseEventType == EventTypeNames::mousedown | 1681 ASSERT(mouseEventType == EventTypeNames::mousedown |
| 1680 || mouseEventType == EventTypeNames::mousemove | 1682 || mouseEventType == EventTypeNames::mousemove |
| 1681 || mouseEventType == EventTypeNames::mouseup); | 1683 || mouseEventType == EventTypeNames::mouseup); |
| 1682 | 1684 |
| 1683 updateMouseEventTargetNode(targetNode, mouseEvent); | 1685 updateMouseEventTargetNode(targetNode, mouseEvent); |
| 1684 if (!m_nodeUnderMouse) | |
| 1685 return WebInputEventResult::NotHandled; | |
| 1686 | 1686 |
| 1687 return m_pointerEventManager.sendMousePointerEvent( | 1687 return m_pointerEventManager.sendMousePointerEvent( |
| 1688 m_nodeUnderMouse, mouseEventType, clickCount, mouseEvent, nullptr, | 1688 m_nodeUnderMouse, mouseEventType, clickCount, mouseEvent, nullptr, |
| 1689 m_frame->document()->domWindow()); | 1689 m_frame->document()->domWindow()); |
| 1690 } | 1690 } |
| 1691 | 1691 |
| 1692 WebInputEventResult EventHandler::handleMouseFocus(const MouseEventWithHitTestRe
sults& targetedEvent, InputDeviceCapabilities* sourceCapabilities) | 1692 WebInputEventResult EventHandler::handleMouseFocus(const MouseEventWithHitTestRe
sults& targetedEvent, InputDeviceCapabilities* sourceCapabilities) |
| 1693 { | 1693 { |
| 1694 // If clicking on a frame scrollbar, do not mess up with content focus. | 1694 // If clicking on a frame scrollbar, do not mess up with content focus. |
| 1695 if (targetedEvent.hitTestResult().scrollbar() && m_frame->contentLayoutObjec
t()) { | 1695 if (targetedEvent.hitTestResult().scrollbar() && m_frame->contentLayoutObjec
t()) { |
| (...skipping 2273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3969 PlatformEvent::Modifiers EventHandler::accessKeyModifiers() | 3969 PlatformEvent::Modifiers EventHandler::accessKeyModifiers() |
| 3970 { | 3970 { |
| 3971 #if OS(MACOSX) | 3971 #if OS(MACOSX) |
| 3972 return static_cast<PlatformEvent::Modifiers>(PlatformEvent::CtrlKey | Platfo
rmEvent::AltKey); | 3972 return static_cast<PlatformEvent::Modifiers>(PlatformEvent::CtrlKey | Platfo
rmEvent::AltKey); |
| 3973 #else | 3973 #else |
| 3974 return PlatformEvent::AltKey; | 3974 return PlatformEvent::AltKey; |
| 3975 #endif | 3975 #endif |
| 3976 } | 3976 } |
| 3977 | 3977 |
| 3978 } // namespace blink | 3978 } // namespace blink |
| OLD | NEW |