| 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 Apple Inc. All rights reserved. | 5 * Copyright (C) 2004, 2005, 2006, 2007 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 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 bool oldReadOnly = m_readOnly; | 115 bool oldReadOnly = m_readOnly; |
| 116 m_readOnly = !attr->isNull(); | 116 m_readOnly = !attr->isNull(); |
| 117 if (oldReadOnly != m_readOnly) { | 117 if (oldReadOnly != m_readOnly) { |
| 118 setNeedsStyleRecalc(); | 118 setNeedsStyleRecalc(); |
| 119 if (renderer() && renderer()->style()->hasAppearance()) | 119 if (renderer() && renderer()->style()->hasAppearance()) |
| 120 renderer()->theme()->stateChanged(renderer(), ReadOnlyState); | 120 renderer()->theme()->stateChanged(renderer(), ReadOnlyState); |
| 121 } | 121 } |
| 122 } else if (attr->name() == requiredAttr) { | 122 } else if (attr->name() == requiredAttr) { |
| 123 bool oldRequired = m_required; | 123 bool oldRequired = m_required; |
| 124 m_required = !attr->isNull(); | 124 m_required = !attr->isNull(); |
| 125 if (oldRequired != m_required) | 125 if (oldRequired != m_required) { |
| 126 requiredAttributeChanged(); | 126 setNeedsValidityCheck(); |
| 127 setNeedsStyleRecalc(); // Updates for :required :optional classes. |
| 128 } |
| 127 } else | 129 } else |
| 128 HTMLElement::parseMappedAttribute(attr); | 130 HTMLElement::parseMappedAttribute(attr); |
| 129 setNeedsWillValidateCheck(); | 131 setNeedsWillValidateCheck(); |
| 130 } | 132 } |
| 131 | 133 |
| 132 void HTMLFormControlElement::requiredAttributeChanged() | |
| 133 { | |
| 134 setNeedsValidityCheck(); | |
| 135 // Style recalculation is needed because style selectors may include | |
| 136 // :required and :optional pseudo-classes. | |
| 137 setNeedsStyleRecalc(); | |
| 138 } | |
| 139 | |
| 140 static bool shouldAutofocus(HTMLFormControlElement* element) | 134 static bool shouldAutofocus(HTMLFormControlElement* element) |
| 141 { | 135 { |
| 142 if (!element->autofocus()) | 136 if (!element->autofocus()) |
| 143 return false; | 137 return false; |
| 144 if (!element->renderer()) | 138 if (!element->renderer()) |
| 145 return false; | 139 return false; |
| 146 if (element->document()->ignoreAutofocus()) | 140 if (element->document()->ignoreAutofocus()) |
| 147 return false; | 141 return false; |
| 148 if (element->document()->isSandboxed(SandboxAutomaticFeatures)) | 142 if (element->document()->isSandboxed(SandboxAutomaticFeatures)) |
| 149 return false; | 143 return false; |
| (...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 490 NodeListsNodeData* nodeLists = Node::ensureRareData()->ensureNodeLists(this)
; | 484 NodeListsNodeData* nodeLists = Node::ensureRareData()->ensureNodeLists(this)
; |
| 491 if (nodeLists->m_labelsNodeListCache) | 485 if (nodeLists->m_labelsNodeListCache) |
| 492 return nodeLists->m_labelsNodeListCache; | 486 return nodeLists->m_labelsNodeListCache; |
| 493 | 487 |
| 494 RefPtr<LabelsNodeList> list = LabelsNodeList::create(this); | 488 RefPtr<LabelsNodeList> list = LabelsNodeList::create(this); |
| 495 nodeLists->m_labelsNodeListCache = list.get(); | 489 nodeLists->m_labelsNodeListCache = list.get(); |
| 496 return list.release(); | 490 return list.release(); |
| 497 } | 491 } |
| 498 | 492 |
| 499 } // namespace Webcore | 493 } // namespace Webcore |
| OLD | NEW |