| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> | 2 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * | 7 * |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 227 sortedNodes.reserveInitialCapacity(nodeCount); | 227 sortedNodes.reserveInitialCapacity(nodeCount); |
| 228 | 228 |
| 229 for (Node* n = findRootNode(m_nodes.first().get()); n; n = NodeTraversal::ne
xt(*n)) { | 229 for (Node* n = findRootNode(m_nodes.first().get()); n; n = NodeTraversal::ne
xt(*n)) { |
| 230 if (nodes.contains(n)) | 230 if (nodes.contains(n)) |
| 231 sortedNodes.append(n); | 231 sortedNodes.append(n); |
| 232 | 232 |
| 233 if (!containsAttributeNodes || !n->isElementNode()) | 233 if (!containsAttributeNodes || !n->isElementNode()) |
| 234 continue; | 234 continue; |
| 235 | 235 |
| 236 Element* element = toElement(n); | 236 Element* element = toElement(n); |
| 237 if (!element->hasAttributes()) | |
| 238 continue; | |
| 239 | |
| 240 AttributeCollection attributes = element->attributes(); | 237 AttributeCollection attributes = element->attributes(); |
| 241 AttributeCollection::const_iterator end = attributes.end(); | 238 AttributeCollection::const_iterator end = attributes.end(); |
| 242 for (AttributeCollection::const_iterator it = attributes.begin(); it !=
end; ++it) { | 239 for (AttributeCollection::const_iterator it = attributes.begin(); it !=
end; ++it) { |
| 243 RefPtrWillBeRawPtr<Attr> attr = element->attrIfExists(it->name()); | 240 RefPtrWillBeRawPtr<Attr> attr = element->attrIfExists(it->name()); |
| 244 if (attr && nodes.contains(attr.get())) | 241 if (attr && nodes.contains(attr.get())) |
| 245 sortedNodes.append(attr); | 242 sortedNodes.append(attr); |
| 246 } | 243 } |
| 247 } | 244 } |
| 248 | 245 |
| 249 ASSERT(sortedNodes.size() == nodeCount); | 246 ASSERT(sortedNodes.size() == nodeCount); |
| (...skipping 28 matching lines...) Expand all Loading... |
| 278 Node* NodeSet::anyNode() const | 275 Node* NodeSet::anyNode() const |
| 279 { | 276 { |
| 280 if (isEmpty()) | 277 if (isEmpty()) |
| 281 return 0; | 278 return 0; |
| 282 | 279 |
| 283 return m_nodes.at(0).get(); | 280 return m_nodes.at(0).get(); |
| 284 } | 281 } |
| 285 | 282 |
| 286 } | 283 } |
| 287 } | 284 } |
| OLD | NEW |