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

Side by Side Diff: third_party/WebKit/Source/core/html/HTMLLabelElement.cpp

Issue 2833313003: Pass clickEvent to controlElement inside label if targetNode can't start selection (Closed)
Patch Set: patch set updated Created 3 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 unified diff | Download patch
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/forms/label/label-selection-by-textSelection-and-click.html ('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) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Dirk Mueller (mueller@kde.org) 4 * (C) 2001 Dirk Mueller (mueller@kde.org)
5 * Copyright (C) 2004, 2005, 2006, 2007, 2010 Apple Inc. All rights reserved. 5 * Copyright (C) 2004, 2005, 2006, 2007, 2010 Apple Inc. All rights reserved.
6 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) 6 * (C) 2006 Alexey Proskuryakov (ap@nypop.com)
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 // is clicked, then click event is passed to control element and 156 // is clicked, then click event is passed to control element and
157 // control element is focused. 157 // control element is focused.
158 158
159 bool is_label_text_selected = false; 159 bool is_label_text_selected = false;
160 160
161 // If the click is not simulated and the text of the label element 161 // If the click is not simulated and the text of the label element
162 // is selected by dragging over it, then return without passing the 162 // is selected by dragging over it, then return without passing the
163 // click event to control element. 163 // click event to control element.
164 // Note: check if it is a MouseEvent because a click event may 164 // Note: check if it is a MouseEvent because a click event may
165 // not be an instance of a MouseEvent if created by document.createEvent(). 165 // not be an instance of a MouseEvent if created by document.createEvent().
166 if (evt->IsMouseEvent() && ToMouseEvent(evt)->HasPosition()) { 166 if (evt->IsMouseEvent() && ToMouseEvent(evt)->HasPosition() &&
167 isHTMLLabelElement(evt->target()->ToNode())) {
yosin_UTC9 2017/05/09 00:56:06 I think we should check Event#srcElement in select
tkent 2017/05/09 02:14:26 Does this work if <label> has a child element? e.
tanvir 2017/05/09 12:02:32 1) On using the label element as below <label><in
tanvir 2017/05/10 13:44:36 Hi Yosin, I couldn't get what you meant by " we sh
167 if (LocalFrame* frame = GetDocument().GetFrame()) { 168 if (LocalFrame* frame = GetDocument().GetFrame()) {
168 // Check if there is a selection and click is not on the 169 // Check if there is a selection and click is not on the
169 // selection. 170 // selection.
170 if (GetLayoutObject() && GetLayoutObject()->IsSelectable() && 171 if (GetLayoutObject() && GetLayoutObject()->IsSelectable() &&
171 frame->Selection() 172 frame->Selection()
172 .ComputeVisibleSelectionInDOMTreeDeprecated() 173 .ComputeVisibleSelectionInDOMTreeDeprecated()
173 .IsRange() && 174 .IsRange() &&
174 !frame->GetEventHandler() 175 !frame->GetEventHandler()
175 .GetSelectionController() 176 .GetSelectionController()
176 .MouseDownWasSingleClickInSelection()) 177 .MouseDownWasSingleClickInSelection())
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 } 231 }
231 232
232 void HTMLLabelElement::AccessKeyAction(bool send_mouse_events) { 233 void HTMLLabelElement::AccessKeyAction(bool send_mouse_events) {
233 if (HTMLElement* element = control()) 234 if (HTMLElement* element = control())
234 element->AccessKeyAction(send_mouse_events); 235 element->AccessKeyAction(send_mouse_events);
235 else 236 else
236 HTMLElement::AccessKeyAction(send_mouse_events); 237 HTMLElement::AccessKeyAction(send_mouse_events);
237 } 238 }
238 239
239 } // namespace blink 240 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/forms/label/label-selection-by-textSelection-and-click.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698