diff options
| author | Simon Hausmann <simon.hausmann@nokia.com> | 2012-02-09 14:16:12 +0100 |
|---|---|---|
| committer | Simon Hausmann <simon.hausmann@nokia.com> | 2012-02-09 14:16:12 +0100 |
| commit | 03e12282df9aa1e1fb05a8b90f1cfc2e08764cec (patch) | |
| tree | 52599cd0ab782b1768e23ad176f7618f98333cb6 /Source/WebCore/dom/Node.cpp | |
| parent | cd44dc59cdfc39534aef4d417e9f3c412e3be139 (diff) | |
| download | qtwebkit-03e12282df9aa1e1fb05a8b90f1cfc2e08764cec.tar.gz | |
Imported WebKit commit e09a82039aa4273ab318b71122e92d8e5f233525 (http://svn.webkit.org/repository/webkit/trunk@107223)
Diffstat (limited to 'Source/WebCore/dom/Node.cpp')
| -rw-r--r-- | Source/WebCore/dom/Node.cpp | 41 |
1 files changed, 17 insertions, 24 deletions
diff --git a/Source/WebCore/dom/Node.cpp b/Source/WebCore/dom/Node.cpp index 738000fec..39b8fa895 100644 --- a/Source/WebCore/dom/Node.cpp +++ b/Source/WebCore/dom/Node.cpp @@ -159,8 +159,6 @@ void Node::dumpStatistics() HashMap<String, size_t> perTagCount; size_t attributes = 0; - size_t mappedAttributes = 0; - size_t mappedAttributesWithStyleDecl = 0; size_t attributesWithAttr = 0; size_t attrMaps = 0; @@ -188,11 +186,6 @@ void Node::dumpStatistics() Attribute* attr = attrMap->attributeItem(i); if (attr->attr()) ++attributesWithAttr; - if (attr->isMappedAttribute()) { - ++mappedAttributes; - if (attr->style()) - ++mappedAttributesWithStyleDecl; - } } } break; @@ -277,8 +270,6 @@ void Node::dumpStatistics() printf("Attribute Maps:\n"); printf(" Number of Attributes (non-Node and Node): %zu [%zu]\n", attributes, sizeof(Attribute)); - printf(" Number of Attributes that are mapped: %zu\n", mappedAttributes); - printf(" Number of Attributes with a StyleDeclaration: %zu\n", mappedAttributesWithStyleDecl); printf(" Number of Attributes with an Attr: %zu\n", attributesWithAttr); printf(" Number of NamedNodeMaps: %zu [%zu]\n", attrMaps, sizeof(NamedNodeMap)); #endif @@ -641,7 +632,7 @@ void Node::normalize() continue; } - Text* text = static_cast<Text*>(node.get()); + RefPtr<Text> text = static_cast<Text*>(node.get()); // Remove empty text nodes. if (!text->length()) { @@ -1831,9 +1822,9 @@ bool Node::isDefaultNamespace(const AtomicString& namespaceURIMaybeEmpty) const if (elem->prefix().isNull()) return elem->namespaceURI() == namespaceURI; - if (NamedNodeMap* attrs = elem->updatedAttributes()) { - for (unsigned i = 0; i < attrs->length(); i++) { - Attribute* attr = attrs->attributeItem(i); + if (elem->hasAttributes()) { + for (unsigned i = 0; i < elem->attributeCount(); i++) { + Attribute* attr = elem->attributeItem(i); if (attr->localName() == xmlnsAtom) return attr->value() == namespaceURI; @@ -1917,9 +1908,9 @@ String Node::lookupNamespaceURI(const String &prefix) const if (!elem->namespaceURI().isNull() && elem->prefix() == prefix) return elem->namespaceURI(); - if (NamedNodeMap* attrs = elem->updatedAttributes()) { - for (unsigned i = 0; i < attrs->length(); i++) { - Attribute *attr = attrs->attributeItem(i); + if (elem->hasAttributes()) { + for (unsigned i = 0; i < elem->attributeCount(); i++) { + Attribute* attr = elem->attributeItem(i); if (attr->prefix() == xmlnsAtom && attr->localName() == prefix) { if (!attr->value().isEmpty()) @@ -1971,9 +1962,11 @@ String Node::lookupNamespacePrefix(const AtomicString &_namespaceURI, const Elem if (originalElement->lookupNamespaceURI(prefix()) == _namespaceURI) return prefix(); - if (NamedNodeMap* attrs = toElement(this)->updatedAttributes()) { - for (unsigned i = 0; i < attrs->length(); i++) { - Attribute* attr = attrs->attributeItem(i); + ASSERT(isElementNode()); + const Element* thisElement = toElement(this); + if (thisElement->hasAttributes()) { + for (unsigned i = 0; i < thisElement->attributeCount(); i++) { + Attribute* attr = thisElement->attributeItem(i); if (attr->prefix() == xmlnsAtom && attr->value() == _namespaceURI && originalElement->lookupNamespaceURI(attr->localName()) == _namespaceURI) @@ -2114,17 +2107,17 @@ unsigned short Node::compareDocumentPosition(Node* otherNode) chain2.append(attr2); if (attr1 && attr2 && start1 == start2 && start1) { - // We are comparing two attributes on the same node. Crawl our attribute map - // and see which one we hit first. - NamedNodeMap* map = attr1->ownerElement()->updatedAttributes(); - unsigned length = map->length(); + // We are comparing two attributes on the same node. Crawl our attribute map and see which one we hit first. + Element* owner1 = attr1->ownerElement(); + owner1->updatedAttributes(); // Force update invalid attributes. + unsigned length = owner1->attributeCount(); for (unsigned i = 0; i < length; ++i) { // If neither of the two determining nodes is a child node and nodeType is the same for both determining nodes, then an // implementation-dependent order between the determining nodes is returned. This order is stable as long as no nodes of // the same nodeType are inserted into or removed from the direct container. This would be the case, for example, // when comparing two attributes of the same element, and inserting or removing additional attributes might change // the order between existing attributes. - Attribute* attr = map->attributeItem(i); + Attribute* attr = owner1->attributeItem(i); if (attr1->attr() == attr) return DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC | DOCUMENT_POSITION_FOLLOWING; if (attr2->attr() == attr) |
