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, 2012 Apple Inc. All rights
reserved. | 6 * Copyright (C) 2004, 2005, 2006, 2007, 2009, 2010, 2012 Apple Inc. All rights
reserved. |
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 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 PassRefPtr<Node> Attr::cloneNode(bool /*deep*/) | 144 PassRefPtr<Node> Attr::cloneNode(bool /*deep*/) |
145 { | 145 { |
146 RefPtr<Attr> clone = adoptRef(new Attr(document(), qualifiedName(), value())
); | 146 RefPtr<Attr> clone = adoptRef(new Attr(document(), qualifiedName(), value())
); |
147 cloneChildNodes(clone.get()); | 147 cloneChildNodes(clone.get()); |
148 return clone.release(); | 148 return clone.release(); |
149 } | 149 } |
150 | 150 |
151 // DOM Section 1.1.1 | 151 // DOM Section 1.1.1 |
152 bool Attr::childTypeAllowed(NodeType type) const | 152 bool Attr::childTypeAllowed(NodeType type) const |
153 { | 153 { |
154 switch (type) { | 154 return TEXT_NODE == type; |
155 case TEXT_NODE: | |
156 case ENTITY_REFERENCE_NODE: | |
157 return true; | |
158 default: | |
159 return false; | |
160 } | |
161 } | 155 } |
162 | 156 |
163 void Attr::childrenChanged(bool, Node*, Node*, int) | 157 void Attr::childrenChanged(bool, Node*, Node*, int) |
164 { | 158 { |
165 if (m_ignoreChildrenChanged > 0) | 159 if (m_ignoreChildrenChanged > 0) |
166 return; | 160 return; |
167 | 161 |
168 invalidateNodeListCachesInAncestors(&qualifiedName(), m_element); | 162 invalidateNodeListCachesInAncestors(&qualifiedName(), m_element); |
169 | 163 |
170 // FIXME: We should include entity references in the value | |
171 | |
172 StringBuilder valueBuilder; | 164 StringBuilder valueBuilder; |
173 for (Node *n = firstChild(); n; n = n->nextSibling()) { | 165 for (Node *n = firstChild(); n; n = n->nextSibling()) { |
174 if (n->isTextNode()) | 166 if (n->isTextNode()) |
175 valueBuilder.append(toText(n)->data()); | 167 valueBuilder.append(toText(n)->data()); |
176 } | 168 } |
177 | 169 |
178 AtomicString newValue = valueBuilder.toAtomicString(); | 170 AtomicString newValue = valueBuilder.toAtomicString(); |
179 if (m_element) | 171 if (m_element) |
180 m_element->willModifyAttribute(qualifiedName(), value(), newValue); | 172 m_element->willModifyAttribute(qualifiedName(), value(), newValue); |
181 | 173 |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 } | 218 } |
227 | 219 |
228 void Attr::attachToElement(Element* element) | 220 void Attr::attachToElement(Element* element) |
229 { | 221 { |
230 ASSERT(!m_element); | 222 ASSERT(!m_element); |
231 m_element = element; | 223 m_element = element; |
232 m_standaloneValue = nullAtom; | 224 m_standaloneValue = nullAtom; |
233 } | 225 } |
234 | 226 |
235 } | 227 } |
OLD | NEW |