Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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 Loading... | |
| 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 |
| OLD | NEW |