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

Unified Diff: Source/core/html/HTMLLabelElement.cpp

Issue 291243002: Never ignore HTMLLabelElement's click() calls (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 7 months 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
Index: Source/core/html/HTMLLabelElement.cpp
diff --git a/Source/core/html/HTMLLabelElement.cpp b/Source/core/html/HTMLLabelElement.cpp
index b625e78f6d1c03e85537220ce833a8da5c2d4f3e..fe95b1ba3b016f12383de61b4e76e1ef704d2936 100644
--- a/Source/core/html/HTMLLabelElement.cpp
+++ b/Source/core/html/HTMLLabelElement.cpp
@@ -28,7 +28,7 @@
#include "HTMLNames.h"
#include "core/dom/ElementTraversal.h"
#include "core/editing/FrameSelection.h"
-#include "core/events/Event.h"
+#include "core/events/MouseEvent.h"
#include "core/frame/LocalFrame.h"
#include "core/html/FormAssociatedElement.h"
@@ -138,9 +138,9 @@ void HTMLLabelElement::defaultEventHandler(Event* evt)
static bool processingClick = false;
if (evt->type() == EventTypeNames::click && !processingClick) {
- // If text of label element is selected, do not pass
+ // If the click is not simulated and the text of label element is selected, do not pass
tkent 2014/05/21 00:35:49 nit: Please wrap a comment line in 80-columns.
Xianzhu 2014/05/21 15:58:53 Done.
// the event to control element.
- if (document().frame()->selection().selection().isRange())
+ if (!static_cast<MouseEvent*>(evt)->isSimulated() && document().frame()->selection().selection().isRange())
tkent 2014/05/21 00:35:49 Pease use toMouseEvent(evt) instead of static_cast
Xianzhu 2014/05/21 15:58:53 Done.
return;
RefPtrWillBeRawPtr<HTMLElement> element = control();
« LayoutTests/fast/events/label-click.html ('K') | « LayoutTests/fast/events/label-click-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698