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

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

Issue 258933006: Fix selection of label having control element. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 8 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 65d71604ee8999d090a814c33155be190de33774..9dd855b64d1279d39ba3b612d288938f91175e61 100644
--- a/Source/core/html/HTMLLabelElement.cpp
+++ b/Source/core/html/HTMLLabelElement.cpp
@@ -27,7 +27,9 @@
#include "HTMLNames.h"
#include "core/dom/ElementTraversal.h"
+#include "core/editing/FrameSelection.h"
#include "core/events/Event.h"
+#include "core/frame/LocalFrame.h"
#include "core/html/FormAssociatedElement.h"
namespace WebCore {
@@ -136,6 +138,11 @@ 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
tkent 2014/04/29 23:36:09 Is this behavior compatible with other browsers?
deepak.sa 2014/05/02 06:18:46 Firefox allows the text of label associated with i
+ // the event to control element.
+ if (document().frame()->selection().selection().isRange())
+ return;
+
RefPtr<HTMLElement> element = control();
// If we can't find a control or if the control received the click

Powered by Google App Engine
This is Rietveld 408576698