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 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 // should pass click event to control element. | 187 // should pass click event to control element. |
188 // Only in case of drag, *neither* we pass the click event, | 188 // Only in case of drag, *neither* we pass the click event, |
189 // *nor* we focus the control element. | 189 // *nor* we focus the control element. |
190 if (isLabelTextSelected && frame->eventHandler().clickCount() ==
1) | 190 if (isLabelTextSelected && frame->eventHandler().clickCount() ==
1) |
191 return; | 191 return; |
192 } | 192 } |
193 } | 193 } |
194 | 194 |
195 m_processingClick = true; | 195 m_processingClick = true; |
196 | 196 |
197 document().updateLayoutIgnorePendingStylesheets(); | 197 document().updateStyleAndLayoutIgnorePendingStylesheets(); |
198 if (element->isMouseFocusable()) { | 198 if (element->isMouseFocusable()) { |
199 // If the label is *not* selected, or if the click happened on | 199 // If the label is *not* selected, or if the click happened on |
200 // selection of label, only then focus the control element. | 200 // selection of label, only then focus the control element. |
201 // In case of double click or triple click, selection will be there, | 201 // In case of double click or triple click, selection will be there, |
202 // so do not focus the control element. | 202 // so do not focus the control element. |
203 if (!isLabelTextSelected) | 203 if (!isLabelTextSelected) |
204 element->focus(FocusParams(SelectionBehaviorOnFocus::Restore, We
bFocusTypeMouse, nullptr)); | 204 element->focus(FocusParams(SelectionBehaviorOnFocus::Restore, We
bFocusTypeMouse, nullptr)); |
205 } | 205 } |
206 | 206 |
207 // Click the corresponding control. | 207 // Click the corresponding control. |
(...skipping 10 matching lines...) Expand all Loading... |
218 bool HTMLLabelElement::willRespondToMouseClickEvents() | 218 bool HTMLLabelElement::willRespondToMouseClickEvents() |
219 { | 219 { |
220 if (control() && control()->willRespondToMouseClickEvents()) | 220 if (control() && control()->willRespondToMouseClickEvents()) |
221 return true; | 221 return true; |
222 | 222 |
223 return HTMLElement::willRespondToMouseClickEvents(); | 223 return HTMLElement::willRespondToMouseClickEvents(); |
224 } | 224 } |
225 | 225 |
226 void HTMLLabelElement::focus(const FocusParams& params) | 226 void HTMLLabelElement::focus(const FocusParams& params) |
227 { | 227 { |
228 document().updateLayoutTreeForNode(this); | 228 document().updateStyleAndLayoutTreeForNode(this); |
229 if (isFocusable()) { | 229 if (isFocusable()) { |
230 HTMLElement::focus(params); | 230 HTMLElement::focus(params); |
231 return; | 231 return; |
232 } | 232 } |
233 // To match other browsers, always restore previous selection. | 233 // To match other browsers, always restore previous selection. |
234 if (HTMLElement* element = control()) | 234 if (HTMLElement* element = control()) |
235 element->focus(FocusParams(SelectionBehaviorOnFocus::Restore, params.typ
e, params.sourceCapabilities)); | 235 element->focus(FocusParams(SelectionBehaviorOnFocus::Restore, params.typ
e, params.sourceCapabilities)); |
236 } | 236 } |
237 | 237 |
238 void HTMLLabelElement::accessKeyAction(bool sendMouseEvents) | 238 void HTMLLabelElement::accessKeyAction(bool sendMouseEvents) |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
301 if (attributeName == forAttr) { | 301 if (attributeName == forAttr) { |
302 TreeScope& scope = treeScope(); | 302 TreeScope& scope = treeScope(); |
303 if (scope.shouldCacheLabelsByForAttribute()) | 303 if (scope.shouldCacheLabelsByForAttribute()) |
304 updateLabel(scope, oldValue, attributeValue); | 304 updateLabel(scope, oldValue, attributeValue); |
305 } | 305 } |
306 HTMLElement::parseAttribute(attributeName, oldValue, attributeValue); | 306 HTMLElement::parseAttribute(attributeName, oldValue, attributeValue); |
307 } | 307 } |
308 } | 308 } |
309 | 309 |
310 } // namespace blink | 310 } // namespace blink |
OLD | NEW |