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 1137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1148 HitTestRequest request(hitType); | 1148 HitTestRequest request(hitType); |
1149 MouseEventWithHitTestResults mev = prepareMouseEvent(request, mouseEvent); | 1149 MouseEventWithHitTestResults mev = prepareMouseEvent(request, mouseEvent); |
1150 LocalFrame* subframe = m_capturingMouseEventsNode.get() ? subframeForTargetN
ode(m_capturingMouseEventsNode.get()) : subframeForHitTestResult(mev); | 1150 LocalFrame* subframe = m_capturingMouseEventsNode.get() ? subframeForTargetN
ode(m_capturingMouseEventsNode.get()) : subframeForHitTestResult(mev); |
1151 if (m_eventHandlerWillResetCapturingMouseEventsNode) | 1151 if (m_eventHandlerWillResetCapturingMouseEventsNode) |
1152 m_capturingMouseEventsNode = nullptr; | 1152 m_capturingMouseEventsNode = nullptr; |
1153 if (subframe) | 1153 if (subframe) |
1154 return passMouseReleaseEventToSubframe(mev, subframe); | 1154 return passMouseReleaseEventToSubframe(mev, subframe); |
1155 | 1155 |
1156 WebInputEventResult eventResult = updatePointerTargetAndDispatchEvents(Event
TypeNames::mouseup, mev.innerNode(), m_clickCount, mev.event()); | 1156 WebInputEventResult eventResult = updatePointerTargetAndDispatchEvents(Event
TypeNames::mouseup, mev.innerNode(), m_clickCount, mev.event()); |
1157 | 1157 |
1158 bool contextMenuEvent = mouseEvent.button() == RightButton; | 1158 // We only prevent click event when the click may cause contextmenu to popup
. |
| 1159 // However, we always send auxclick. |
| 1160 bool macContextMenuEvent = false; |
1159 #if OS(MACOSX) | 1161 #if OS(MACOSX) |
1160 // FIXME: The Mac port achieves the same behavior by checking whether the co
ntext menu is currently open in WebPage::mouseEvent(). Consider merging the impl
ementations. | 1162 // FIXME: The Mac port achieves the same behavior by checking whether the co
ntext menu is currently open in WebPage::mouseEvent(). Consider merging the impl
ementations. |
1161 if (mouseEvent.button() == LeftButton && mouseEvent.getModifiers() & Platfor
mEvent::CtrlKey) | 1163 if (mouseEvent.button() == LeftButton && mouseEvent.getModifiers() & Platfor
mEvent::CtrlKey) |
1162 contextMenuEvent = true; | 1164 macContextMenuEvent = true; |
1163 #endif | 1165 #endif |
1164 | 1166 |
1165 WebInputEventResult clickEventResult = WebInputEventResult::NotHandled; | 1167 WebInputEventResult clickEventResult = WebInputEventResult::NotHandled; |
1166 const bool shouldDispatchClickEvent = m_clickCount > 0 | 1168 const bool shouldDispatchClickEvent = m_clickCount > 0 |
1167 && !contextMenuEvent | 1169 && !macContextMenuEvent |
1168 && mev.innerNode() && m_clickNode | 1170 && mev.innerNode() && m_clickNode |
1169 && mev.innerNode()->canParticipateInFlatTree() && m_clickNode->canPartic
ipateInFlatTree() | 1171 && mev.innerNode()->canParticipateInFlatTree() && m_clickNode->canPartic
ipateInFlatTree() |
1170 && !(selectionController().hasExtendedSelection() && isLinkSelection(mev
)); | 1172 && !(selectionController().hasExtendedSelection() && isLinkSelection(mev
)); |
1171 if (shouldDispatchClickEvent) { | 1173 if (shouldDispatchClickEvent) { |
1172 Node* clickTargetNode = nullptr; | 1174 Node* clickTargetNode = nullptr; |
1173 // Updates distribution because a 'mouseup' event listener can make the | 1175 // Updates distribution because a 'mouseup' event listener can make the |
1174 // tree dirty at dispatchMouseEvent() invocation above. | 1176 // tree dirty at dispatchMouseEvent() invocation above. |
1175 // Unless distribution is updated, commonAncestor would hit ASSERT. | 1177 // Unless distribution is updated, commonAncestor would hit ASSERT. |
1176 if (m_clickNode == mev.innerNode()) { | 1178 if (m_clickNode == mev.innerNode()) { |
1177 clickTargetNode = m_clickNode; | 1179 clickTargetNode = m_clickNode; |
1178 clickTargetNode->updateDistribution(); | 1180 clickTargetNode->updateDistribution(); |
1179 } else if (m_clickNode->document() == mev.innerNode()->document()) { | 1181 } else if (m_clickNode->document() == mev.innerNode()->document()) { |
1180 m_clickNode->updateDistribution(); | 1182 m_clickNode->updateDistribution(); |
1181 mev.innerNode()->updateDistribution(); | 1183 mev.innerNode()->updateDistribution(); |
1182 clickTargetNode = mev.innerNode()->commonAncestor( | 1184 clickTargetNode = mev.innerNode()->commonAncestor( |
1183 *m_clickNode, parentForClickEvent); | 1185 *m_clickNode, parentForClickEvent); |
1184 } | 1186 } |
1185 if (clickTargetNode) { | 1187 if (clickTargetNode) { |
1186 // Dispatch mouseup directly w/o calling updateMouseEventTargetNodeA
ndSendEvents | 1188 // Dispatch mouseup directly w/o calling updateMouseEventTargetNodeA
ndSendEvents |
1187 // because the mouseup dispatch above has already updated it | 1189 // because the mouseup dispatch above has already updated it |
1188 // correctly. Moreover, clickTargetNode is different from | 1190 // correctly. Moreover, clickTargetNode is different from |
1189 // mev.innerNode at drag-release. | 1191 // mev.innerNode at drag-release. |
1190 clickEventResult = toWebInputEventResult(clickTargetNode->dispatchMo
useEvent(mev.event(), | 1192 clickEventResult = toWebInputEventResult(clickTargetNode->dispatchMo
useEvent(mev.event(), |
1191 EventTypeNames::click, m_clickCount)); | 1193 !RuntimeEnabledFeatures::auxclickEnabled() || (mev.event().butto
n() == MouseButton::LeftButton) |
| 1194 ? EventTypeNames::click |
| 1195 : EventTypeNames::auxclick, |
| 1196 m_clickCount)); |
1192 } | 1197 } |
1193 } | 1198 } |
1194 | 1199 |
1195 m_scrollManager.clearResizeScrollableArea(false); | 1200 m_scrollManager.clearResizeScrollableArea(false); |
1196 | 1201 |
1197 if (eventResult == WebInputEventResult::NotHandled) | 1202 if (eventResult == WebInputEventResult::NotHandled) |
1198 eventResult = handleMouseReleaseEvent(mev); | 1203 eventResult = handleMouseReleaseEvent(mev); |
1199 clearDragHeuristicState(); | 1204 clearDragHeuristicState(); |
1200 | 1205 |
1201 invalidateClick(); | 1206 invalidateClick(); |
(...skipping 1384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2586 | 2591 |
2587 FrameHost* EventHandler::frameHost() const | 2592 FrameHost* EventHandler::frameHost() const |
2588 { | 2593 { |
2589 if (!m_frame->page()) | 2594 if (!m_frame->page()) |
2590 return nullptr; | 2595 return nullptr; |
2591 | 2596 |
2592 return &m_frame->page()->frameHost(); | 2597 return &m_frame->page()->frameHost(); |
2593 } | 2598 } |
2594 | 2599 |
2595 } // namespace blink | 2600 } // namespace blink |
OLD | NEW |