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

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: Address Review Comments 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 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 if (evt->IsMouseEvent() && ToMouseEvent(evt)->HasPosition()) { 166 if (evt->IsMouseEvent() && ToMouseEvent(evt)->HasPosition()) {
167 if (LocalFrame* frame = GetDocument().GetFrame()) { 167 if (LocalFrame* frame = GetDocument().GetFrame()) {
168 // Check if there is a selection and click is not on the 168 // Check if there is a selection and click is not on the
169 // selection. 169 // selection.
170 if (GetLayoutObject() && GetLayoutObject()->IsSelectable() && 170 if (GetLayoutObject() && GetLayoutObject()->IsSelectable() &&
171 frame->Selection() 171 frame->Selection()
172 .ComputeVisibleSelectionInDOMTreeDeprecated() 172 .ComputeVisibleSelectionInDOMTreeDeprecated()
173 .IsRange() && 173 .IsRange() &&
174 !frame->GetEventHandler() 174 !frame->GetEventHandler()
175 .GetSelectionController() 175 .GetSelectionController()
176 .MouseDownWasSingleClickInSelection()) 176 .MouseDownWasSingleClickInSelection() &&
177 evt->target()->ToNode()->CanStartSelection())
177 is_label_text_selected = true; 178 is_label_text_selected = true;
178 // If selection is there and is single click i.e. text is 179 // If selection is there and is single click i.e. text is
179 // selected by dragging over label text, then return. 180 // selected by dragging over label text, then return.
180 // Click count >=2, meaning double click or triple click, 181 // Click count >=2, meaning double click or triple click,
181 // should pass click event to control element. 182 // should pass click event to control element.
182 // Only in case of drag, *neither* we pass the click event, 183 // Only in case of drag, *neither* we pass the click event,
183 // *nor* we focus the control element. 184 // *nor* we focus the control element.
184 if (is_label_text_selected && ToMouseEvent(evt)->ClickCount() == 1) 185 if (is_label_text_selected && ToMouseEvent(evt)->ClickCount() == 1)
185 return; 186 return;
186 } 187 }
(...skipping 43 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