OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved. |
3 * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org) | 3 * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org) |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 1357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1368 MouseEventWithHitTestResults mev = prepareMouseEvent(request, mouseEvent); | 1368 MouseEventWithHitTestResults mev = prepareMouseEvent(request, mouseEvent); |
1369 Frame* subframe = subframeForHitTestResult(mev); | 1369 Frame* subframe = subframeForHitTestResult(mev); |
1370 if (m_eventHandlerWillResetCapturingMouseEventsNode) | 1370 if (m_eventHandlerWillResetCapturingMouseEventsNode) |
1371 m_capturingMouseEventsNode = 0; | 1371 m_capturingMouseEventsNode = 0; |
1372 if (subframe && passMousePressEventToSubframe(mev, subframe)) | 1372 if (subframe && passMousePressEventToSubframe(mev, subframe)) |
1373 return true; | 1373 return true; |
1374 | 1374 |
1375 m_clickCount = mouseEvent.clickCount(); | 1375 m_clickCount = mouseEvent.clickCount(); |
1376 bool swallowMouseUpEvent = dispatchMouseEvent(eventNames().mouseupEvent, mev
.targetNode(), true, m_clickCount, mouseEvent, false); | 1376 bool swallowMouseUpEvent = dispatchMouseEvent(eventNames().mouseupEvent, mev
.targetNode(), true, m_clickCount, mouseEvent, false); |
1377 | 1377 |
1378 bool swallowClickEvent = false; | 1378 bool swallowClickEvent = mouseEvent.button() == LeftButton && mev.targetNode
() == m_clickNode && dispatchMouseEvent(eventNames().clickEvent, mev.targetNode(
), true, m_clickCount, mouseEvent, true); |
1379 // Don't ever dispatch click events for right clicks | |
1380 if (mouseEvent.button() != RightButton && mev.targetNode() == m_clickNode) | |
1381 swallowClickEvent = dispatchMouseEvent(eventNames().clickEvent, mev.targ
etNode(), true, m_clickCount, mouseEvent, true); | |
1382 | 1379 |
1383 if (m_lastScrollbarUnderMouse) | 1380 if (m_lastScrollbarUnderMouse) |
1384 swallowMouseUpEvent = m_lastScrollbarUnderMouse->mouseUp(); | 1381 swallowMouseUpEvent = m_lastScrollbarUnderMouse->mouseUp(); |
1385 | 1382 |
1386 bool swallowMouseReleaseEvent = false; | 1383 bool swallowMouseReleaseEvent = !swallowMouseUpEvent && handleMouseReleaseEv
ent(mev); |
1387 if (!swallowMouseUpEvent) | |
1388 swallowMouseReleaseEvent = handleMouseReleaseEvent(mev); | |
1389 | 1384 |
1390 invalidateClick(); | 1385 invalidateClick(); |
1391 | 1386 |
1392 return swallowMouseUpEvent || swallowClickEvent || swallowMouseReleaseEvent; | 1387 return swallowMouseUpEvent || swallowClickEvent || swallowMouseReleaseEvent; |
1393 } | 1388 } |
1394 | 1389 |
1395 bool EventHandler::mouseMoved(const PlatformMouseEvent& event) | 1390 bool EventHandler::mouseMoved(const PlatformMouseEvent& event) |
1396 { | 1391 { |
1397 HitTestResult hoveredNode = HitTestResult(IntPoint()); | 1392 HitTestResult hoveredNode = HitTestResult(IntPoint()); |
1398 bool result = handleMouseMoveEvent(event, &hoveredNode); | 1393 bool result = handleMouseMoveEvent(event, &hoveredNode); |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1564 HitTestRequest request(HitTestRequest::MouseUp); | 1559 HitTestRequest request(HitTestRequest::MouseUp); |
1565 MouseEventWithHitTestResults mev = prepareMouseEvent(request, mouseEvent); | 1560 MouseEventWithHitTestResults mev = prepareMouseEvent(request, mouseEvent); |
1566 Frame* subframe = m_capturingMouseEventsNode.get() ? subframeForTargetNode(m
_capturingMouseEventsNode.get()) : subframeForHitTestResult(mev); | 1561 Frame* subframe = m_capturingMouseEventsNode.get() ? subframeForTargetNode(m
_capturingMouseEventsNode.get()) : subframeForHitTestResult(mev); |
1567 if (m_eventHandlerWillResetCapturingMouseEventsNode) | 1562 if (m_eventHandlerWillResetCapturingMouseEventsNode) |
1568 m_capturingMouseEventsNode = 0; | 1563 m_capturingMouseEventsNode = 0; |
1569 if (subframe && passMouseReleaseEventToSubframe(mev, subframe)) | 1564 if (subframe && passMouseReleaseEventToSubframe(mev, subframe)) |
1570 return true; | 1565 return true; |
1571 | 1566 |
1572 bool swallowMouseUpEvent = dispatchMouseEvent(eventNames().mouseupEvent, mev
.targetNode(), true, m_clickCount, mouseEvent, false); | 1567 bool swallowMouseUpEvent = dispatchMouseEvent(eventNames().mouseupEvent, mev
.targetNode(), true, m_clickCount, mouseEvent, false); |
1573 | 1568 |
1574 // Don't ever dispatch click events for right clicks | 1569 bool swallowClickEvent = m_clickCount > 0 && mouseEvent.button() == LeftButt
on && mev.targetNode() == m_clickNode && dispatchMouseEvent(eventNames().clickEv
ent, mev.targetNode(), true, m_clickCount, mouseEvent, true); |
1575 bool swallowClickEvent = false; | |
1576 if (m_clickCount > 0 && mouseEvent.button() != RightButton && mev.targetNode
() == m_clickNode) | |
1577 swallowClickEvent = dispatchMouseEvent(eventNames().clickEvent, mev.targ
etNode(), true, m_clickCount, mouseEvent, true); | |
1578 | 1570 |
1579 if (m_resizeLayer) { | 1571 if (m_resizeLayer) { |
1580 m_resizeLayer->setInResizeMode(false); | 1572 m_resizeLayer->setInResizeMode(false); |
1581 m_resizeLayer = 0; | 1573 m_resizeLayer = 0; |
1582 } | 1574 } |
1583 | 1575 |
1584 bool swallowMouseReleaseEvent = false; | 1576 bool swallowMouseReleaseEvent = false; |
1585 if (!swallowMouseUpEvent) | 1577 if (!swallowMouseUpEvent) |
1586 swallowMouseReleaseEvent = handleMouseReleaseEvent(mev); | 1578 swallowMouseReleaseEvent = handleMouseReleaseEvent(mev); |
1587 | 1579 |
(...skipping 1420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3008 ExceptionCode ec = 0; | 3000 ExceptionCode ec = 0; |
3009 touchEventTarget->dispatchEvent(moveEv.get(), ec); | 3001 touchEventTarget->dispatchEvent(moveEv.get(), ec); |
3010 defaultPrevented |= moveEv->defaultPrevented(); | 3002 defaultPrevented |= moveEv->defaultPrevented(); |
3011 } | 3003 } |
3012 | 3004 |
3013 return defaultPrevented; | 3005 return defaultPrevented; |
3014 } | 3006 } |
3015 #endif | 3007 #endif |
3016 | 3008 |
3017 } | 3009 } |
OLD | NEW |