| 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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 { | 61 { |
| 62 const AtomicString& controlId = getAttribute(forAttr); | 62 const AtomicString& controlId = getAttribute(forAttr); |
| 63 if (controlId.isNull()) { | 63 if (controlId.isNull()) { |
| 64 // Search the children and descendants of the label element for a form e
lement. | 64 // Search the children and descendants of the label element for a form e
lement. |
| 65 // per http://dev.w3.org/html5/spec/Overview.html#the-label-element | 65 // per http://dev.w3.org/html5/spec/Overview.html#the-label-element |
| 66 // the form element must be "labelable form-associated element". | 66 // the form element must be "labelable form-associated element". |
| 67 for (LabelableElement& element : Traversal<LabelableElement>::descendant
sOf(*this)) { | 67 for (LabelableElement& element : Traversal<LabelableElement>::descendant
sOf(*this)) { |
| 68 if (element.supportLabels()) | 68 if (element.supportLabels()) |
| 69 return &element; | 69 return &element; |
| 70 } | 70 } |
| 71 return 0; | 71 return nullptr; |
| 72 } | 72 } |
| 73 | 73 |
| 74 if (Element* element = treeScope().getElementById(controlId)) { | 74 if (Element* element = treeScope().getElementById(controlId)) { |
| 75 if (isLabelableElement(*element) && toLabelableElement(*element).support
Labels()) | 75 if (isLabelableElement(*element) && toLabelableElement(*element).support
Labels()) |
| 76 return toLabelableElement(element); | 76 return toLabelableElement(element); |
| 77 } | 77 } |
| 78 | 78 |
| 79 return 0; | 79 return nullptr; |
| 80 } | 80 } |
| 81 | 81 |
| 82 HTMLFormElement* HTMLLabelElement::formOwner() const | 82 HTMLFormElement* HTMLLabelElement::formOwner() const |
| 83 { | 83 { |
| 84 return FormAssociatedElement::form(); | 84 return FormAssociatedElement::form(); |
| 85 } | 85 } |
| 86 | 86 |
| 87 void HTMLLabelElement::setActive(bool down) | 87 void HTMLLabelElement::setActive(bool down) |
| 88 { | 88 { |
| 89 if (down == active()) | 89 if (down == active()) |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 276 | 276 |
| 277 void HTMLLabelElement::parseAttribute(const QualifiedName& attributeName, const
AtomicString& attributeValue) | 277 void HTMLLabelElement::parseAttribute(const QualifiedName& attributeName, const
AtomicString& attributeValue) |
| 278 { | 278 { |
| 279 if (attributeName == formAttr) | 279 if (attributeName == formAttr) |
| 280 formAttributeChanged(); | 280 formAttributeChanged(); |
| 281 else | 281 else |
| 282 HTMLElement::parseAttribute(attributeName, attributeValue); | 282 HTMLElement::parseAttribute(attributeName, attributeValue); |
| 283 } | 283 } |
| 284 | 284 |
| 285 } // namespace | 285 } // namespace |
| OLD | NEW |