Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1356)

Unified Diff: Source/core/page/EventHandler.cpp

Issue 110173005: Don't dispatch a 'click' event for mousedown/mouseup across form controls. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/dom/Node.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/page/EventHandler.cpp
diff --git a/Source/core/page/EventHandler.cpp b/Source/core/page/EventHandler.cpp
index ae1dcb2150812c2a1eface03dedbfde39b38abfd..9278c0b925de26da12b6d8e5abc448db1f003da3 100644
--- a/Source/core/page/EventHandler.cpp
+++ b/Source/core/page/EventHandler.cpp
@@ -1612,6 +1612,15 @@ void EventHandler::invalidateClick()
m_clickNode = 0;
}
+static Node* parentForClickEvent(const Node& node)
+{
+ // IE doesn't dispatch click events for mousedown/mouseup events across from
hayato 2013/12/18 03:46:18 typo: s/from/form/ ?
tkent 2013/12/18 03:52:05 Right! Thanks.
+ // controls.
+ if (node.isHTMLElement() && toHTMLElement(node).isInteractiveContent())
+ return 0;
+ return node.parentOrShadowHostNode();
+}
+
bool EventHandler::handleMouseReleaseEvent(const PlatformMouseEvent& mouseEvent)
{
RefPtr<FrameView> protector(m_frame->view());
@@ -1676,7 +1685,7 @@ bool EventHandler::handleMouseReleaseEvent(const PlatformMouseEvent& mouseEvent)
bool swallowClickEvent = false;
if (m_clickCount > 0 && !contextMenuEvent && mev.targetNode() && m_clickNode) {
- if (Node* clickTargetNode = mev.targetNode()->commonAncestorOverShadowBoundary(*m_clickNode))
+ if (Node* clickTargetNode = mev.targetNode()->commonAncestor(*m_clickNode, parentForClickEvent))
swallowClickEvent = !dispatchMouseEvent(EventTypeNames::click, clickTargetNode, true, m_clickCount, mouseEvent, true);
}
« no previous file with comments | « Source/core/dom/Node.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698