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

Side by Side 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: fix a test 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/dom/Node.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1594 matching lines...) Expand 10 before | Expand all | Expand 10 after
1605 1605
1606 return swallowEvent; 1606 return swallowEvent;
1607 } 1607 }
1608 1608
1609 void EventHandler::invalidateClick() 1609 void EventHandler::invalidateClick()
1610 { 1610 {
1611 m_clickCount = 0; 1611 m_clickCount = 0;
1612 m_clickNode = 0; 1612 m_clickNode = 0;
1613 } 1613 }
1614 1614
1615 static Node* parentForClickEvent(const Node& node)
1616 {
1617 // IE doesn't dispatch click events for mousedown/mouseup events across form
1618 // controls.
1619 if (node.isHTMLElement() && toHTMLElement(node).isInteractiveContent())
1620 return 0;
1621 return node.parentOrShadowHostNode();
1622 }
1623
1615 bool EventHandler::handleMouseReleaseEvent(const PlatformMouseEvent& mouseEvent) 1624 bool EventHandler::handleMouseReleaseEvent(const PlatformMouseEvent& mouseEvent)
1616 { 1625 {
1617 RefPtr<FrameView> protector(m_frame->view()); 1626 RefPtr<FrameView> protector(m_frame->view());
1618 1627
1619 m_frame->selection().setCaretBlinkingSuspended(false); 1628 m_frame->selection().setCaretBlinkingSuspended(false);
1620 1629
1621 bool defaultPrevented = dispatchSyntheticTouchEventIfEnabled(mouseEvent); 1630 bool defaultPrevented = dispatchSyntheticTouchEventIfEnabled(mouseEvent);
1622 if (defaultPrevented) 1631 if (defaultPrevented)
1623 return true; 1632 return true;
1624 1633
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
1669 1678
1670 bool contextMenuEvent = mouseEvent.button() == RightButton; 1679 bool contextMenuEvent = mouseEvent.button() == RightButton;
1671 #if OS(MACOSX) 1680 #if OS(MACOSX)
1672 // 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. 1681 // 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.
1673 if (mouseEvent.button() == LeftButton && mouseEvent.modifiers() & PlatformEv ent::CtrlKey) 1682 if (mouseEvent.button() == LeftButton && mouseEvent.modifiers() & PlatformEv ent::CtrlKey)
1674 contextMenuEvent = true; 1683 contextMenuEvent = true;
1675 #endif 1684 #endif
1676 1685
1677 bool swallowClickEvent = false; 1686 bool swallowClickEvent = false;
1678 if (m_clickCount > 0 && !contextMenuEvent && mev.targetNode() && m_clickNode ) { 1687 if (m_clickCount > 0 && !contextMenuEvent && mev.targetNode() && m_clickNode ) {
1679 if (Node* clickTargetNode = mev.targetNode()->commonAncestorOverShadowBo undary(*m_clickNode)) 1688 if (Node* clickTargetNode = mev.targetNode()->commonAncestor(*m_clickNod e, parentForClickEvent))
1680 swallowClickEvent = !dispatchMouseEvent(EventTypeNames::click, click TargetNode, true, m_clickCount, mouseEvent, true); 1689 swallowClickEvent = !dispatchMouseEvent(EventTypeNames::click, click TargetNode, true, m_clickCount, mouseEvent, true);
1681 } 1690 }
1682 1691
1683 if (m_resizeScrollableArea) { 1692 if (m_resizeScrollableArea) {
1684 m_resizeScrollableArea->setInResizeMode(false); 1693 m_resizeScrollableArea->setInResizeMode(false);
1685 m_resizeScrollableArea = 0; 1694 m_resizeScrollableArea = 0;
1686 } 1695 }
1687 1696
1688 bool swallowMouseReleaseEvent = false; 1697 bool swallowMouseReleaseEvent = false;
1689 if (!swallowMouseUpEvent) 1698 if (!swallowMouseUpEvent)
(...skipping 2318 matching lines...) Expand 10 before | Expand all | Expand 10 after
4008 unsigned EventHandler::accessKeyModifiers() 4017 unsigned EventHandler::accessKeyModifiers()
4009 { 4018 {
4010 #if OS(MACOSX) 4019 #if OS(MACOSX)
4011 return PlatformEvent::CtrlKey | PlatformEvent::AltKey; 4020 return PlatformEvent::CtrlKey | PlatformEvent::AltKey;
4012 #else 4021 #else
4013 return PlatformEvent::AltKey; 4022 return PlatformEvent::AltKey;
4014 #endif 4023 #endif
4015 } 4024 }
4016 4025
4017 } // namespace WebCore 4026 } // namespace WebCore
OLDNEW
« 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