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 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 | 179 |
180 m_processingClick = true; | 180 m_processingClick = true; |
181 | 181 |
182 document().updateLayoutIgnorePendingStylesheets(); | 182 document().updateLayoutIgnorePendingStylesheets(); |
183 if (element->isMouseFocusable()) { | 183 if (element->isMouseFocusable()) { |
184 // If the label is *not* selected, or if the click happened on | 184 // If the label is *not* selected, or if the click happened on |
185 // selection of label, only then focus the control element. | 185 // selection of label, only then focus the control element. |
186 // In case of double click or triple click, selection will be there, | 186 // In case of double click or triple click, selection will be there, |
187 // so do not focus the control element. | 187 // so do not focus the control element. |
188 if (!isLabelTextSelected) | 188 if (!isLabelTextSelected) |
189 element->focus(true, WebFocusTypeMouse); | 189 element->focus(FocusParams(SelectionBehaviorOnFocus::Restore, We
bFocusTypeMouse, nullptr)); |
190 } | 190 } |
191 | 191 |
192 // Click the corresponding control. | 192 // Click the corresponding control. |
193 element->dispatchSimulatedClick(evt); | 193 element->dispatchSimulatedClick(evt); |
194 | 194 |
195 m_processingClick = false; | 195 m_processingClick = false; |
196 | 196 |
197 evt->setDefaultHandled(); | 197 evt->setDefaultHandled(); |
198 } | 198 } |
199 | 199 |
200 HTMLElement::defaultEventHandler(evt); | 200 HTMLElement::defaultEventHandler(evt); |
201 } | 201 } |
202 | 202 |
203 bool HTMLLabelElement::willRespondToMouseClickEvents() | 203 bool HTMLLabelElement::willRespondToMouseClickEvents() |
204 { | 204 { |
205 if (control() && control()->willRespondToMouseClickEvents()) | 205 if (control() && control()->willRespondToMouseClickEvents()) |
206 return true; | 206 return true; |
207 | 207 |
208 return HTMLElement::willRespondToMouseClickEvents(); | 208 return HTMLElement::willRespondToMouseClickEvents(); |
209 } | 209 } |
210 | 210 |
211 void HTMLLabelElement::focus(bool, WebFocusType type, InputDeviceCapabilities* s
ourceCapabilities) | 211 void HTMLLabelElement::focus(const FocusParams& params) |
212 { | 212 { |
213 // to match other browsers, always restore previous selection | 213 // to match other browsers, always restore previous selection |
214 if (HTMLElement* element = control()) | 214 if (HTMLElement* element = control()) |
215 element->focus(true, type, sourceCapabilities); | 215 element->focus(FocusParams(SelectionBehaviorOnFocus::Restore, params.typ
e, params.sourceCapabilities)); |
216 if (isFocusable()) | 216 if (isFocusable()) |
217 HTMLElement::focus(true, type, sourceCapabilities); | 217 HTMLElement::focus(params); |
218 } | 218 } |
219 | 219 |
220 void HTMLLabelElement::accessKeyAction(bool sendMouseEvents) | 220 void HTMLLabelElement::accessKeyAction(bool sendMouseEvents) |
221 { | 221 { |
222 if (HTMLElement* element = control()) | 222 if (HTMLElement* element = control()) |
223 element->accessKeyAction(sendMouseEvents); | 223 element->accessKeyAction(sendMouseEvents); |
224 else | 224 else |
225 HTMLElement::accessKeyAction(sendMouseEvents); | 225 HTMLElement::accessKeyAction(sendMouseEvents); |
226 } | 226 } |
227 | 227 |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
288 { | 288 { |
289 if (attributeName == formAttr) { | 289 if (attributeName == formAttr) { |
290 formAttributeChanged(); | 290 formAttributeChanged(); |
291 UseCounter::count(document(), UseCounter::HTMLLabelElementFormContentAtt
ribute); | 291 UseCounter::count(document(), UseCounter::HTMLLabelElementFormContentAtt
ribute); |
292 } else { | 292 } else { |
293 HTMLElement::parseAttribute(attributeName, attributeValue); | 293 HTMLElement::parseAttribute(attributeName, attributeValue); |
294 } | 294 } |
295 } | 295 } |
296 | 296 |
297 } // namespace | 297 } // namespace |
OLD | NEW |