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 Peter Kelly (pmk@post.com) | 4 * (C) 2001 Peter Kelly (pmk@post.com) |
5 * (C) 2001 Dirk Mueller (mueller@kde.org) | 5 * (C) 2001 Dirk Mueller (mueller@kde.org) |
6 * Copyright (C) 2004, 2005, 2006, 2007, 2009, 2010 Apple Inc. All rights reserv
ed. | 6 * Copyright (C) 2004, 2005, 2006, 2007, 2009, 2010 Apple Inc. All rights reserv
ed. |
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 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 } | 110 } |
111 | 111 |
112 m_attribute->setPrefix(prefix.isEmpty() ? AtomicString() : prefix); | 112 m_attribute->setPrefix(prefix.isEmpty() ? AtomicString() : prefix); |
113 } | 113 } |
114 | 114 |
115 String Attr::nodeValue() const | 115 String Attr::nodeValue() const |
116 { | 116 { |
117 return value(); | 117 return value(); |
118 } | 118 } |
119 | 119 |
120 void Attr::setValue(const AtomicString& value, ExceptionCode&) | 120 void Attr::setValue(const AtomicString& value) |
121 { | 121 { |
122 m_ignoreChildrenChanged++; | 122 m_ignoreChildrenChanged++; |
123 removeChildren(); | 123 removeChildren(); |
124 m_attribute->setValue(value); | 124 m_attribute->setValue(value); |
125 createTextChild(); | 125 createTextChild(); |
126 m_ignoreChildrenChanged--; | 126 m_ignoreChildrenChanged--; |
| 127 } |
| 128 |
| 129 void Attr::setValue(const AtomicString& value, ExceptionCode&) |
| 130 { |
| 131 if (m_element && m_element->isIdAttributeName(m_attribute->name())) |
| 132 m_element->updateId(m_element->getIdAttribute(), value); |
| 133 |
| 134 setValue(value); |
127 | 135 |
128 if (m_element) | 136 if (m_element) |
129 m_element->attributeChanged(m_attribute.get()); | 137 m_element->attributeChanged(m_attribute.get()); |
130 } | 138 } |
131 | 139 |
132 void Attr::setNodeValue(const String& v, ExceptionCode& ec) | 140 void Attr::setNodeValue(const String& v, ExceptionCode& ec) |
133 { | 141 { |
134 setValue(v, ec); | 142 setValue(v, ec); |
135 } | 143 } |
136 | 144 |
(...skipping 23 matching lines...) Expand all Loading... |
160 | 168 |
161 Node::childrenChanged(changedByParser, beforeChange, afterChange, childCount
Delta); | 169 Node::childrenChanged(changedByParser, beforeChange, afterChange, childCount
Delta); |
162 | 170 |
163 // FIXME: We should include entity references in the value | 171 // FIXME: We should include entity references in the value |
164 | 172 |
165 String val = ""; | 173 String val = ""; |
166 for (Node *n = firstChild(); n; n = n->nextSibling()) { | 174 for (Node *n = firstChild(); n; n = n->nextSibling()) { |
167 if (n->isTextNode()) | 175 if (n->isTextNode()) |
168 val += static_cast<Text *>(n)->data(); | 176 val += static_cast<Text *>(n)->data(); |
169 } | 177 } |
170 | 178 |
| 179 if (m_element && m_element->isIdAttributeName(m_attribute->name())) |
| 180 m_element->updateId(m_attribute->value(), val); |
| 181 |
171 m_attribute->setValue(val.impl()); | 182 m_attribute->setValue(val.impl()); |
172 if (m_element) | 183 if (m_element) |
173 m_element->attributeChanged(m_attribute.get()); | 184 m_element->attributeChanged(m_attribute.get()); |
174 } | 185 } |
175 | 186 |
176 bool Attr::isId() const | 187 bool Attr::isId() const |
177 { | 188 { |
178 return qualifiedName().matches(document()->idAttributeName()); | 189 return qualifiedName().matches(document()->idAttributeName()); |
179 } | 190 } |
180 | 191 |
181 } | 192 } |
OLD | NEW |