diff options
author | Feng Qian <> | 2009-04-10 18:11:29 -0700 |
---|---|---|
committer | The Android Open Source Project <initial-contribution@android.com> | 2009-04-10 18:11:29 -0700 |
commit | 8f72e70a9fd78eec56623b3a62e68f16b7b27e28 (patch) | |
tree | 181bf9a400c30a1bf34ea6d72560e8d00111d549 /WebCore/dom/NamedAttrMap.h | |
parent | 7ed56f225e0ade046e1c2178977f72b2d896f196 (diff) | |
download | external_webkit-8f72e70a9fd78eec56623b3a62e68f16b7b27e28.zip external_webkit-8f72e70a9fd78eec56623b3a62e68f16b7b27e28.tar.gz external_webkit-8f72e70a9fd78eec56623b3a62e68f16b7b27e28.tar.bz2 |
AI 145796: Land the WebKit merge @r42026.
Automated import of CL 145796
Diffstat (limited to 'WebCore/dom/NamedAttrMap.h')
-rw-r--r-- | WebCore/dom/NamedAttrMap.h | 55 |
1 files changed, 27 insertions, 28 deletions
diff --git a/WebCore/dom/NamedAttrMap.h b/WebCore/dom/NamedAttrMap.h index 693a9e5..61628e4 100644 --- a/WebCore/dom/NamedAttrMap.h +++ b/WebCore/dom/NamedAttrMap.h @@ -1,11 +1,9 @@ /* - * This file is part of the DOM implementation for KDE. - * * Copyright (C) 1999 Lars Knoll (knoll@kde.org) * (C) 1999 Antti Koivisto (koivisto@kde.org) * (C) 2001 Peter Kelly (pmk@post.com) * (C) 2001 Dirk Mueller (mueller@kde.org) - * Copyright (C) 2003, 2004, 2005, 2006 Apple Computer, Inc. + * Copyright (C) 2003, 2004, 2005, 2006, 2008 Apple Inc. All rights reserved. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -29,7 +27,6 @@ #include "Attribute.h" #include "NamedNodeMap.h" -#include <wtf/RefPtr.h> #include <wtf/Vector.h> #ifdef __OBJC__ @@ -50,28 +47,12 @@ public: void setAttributes(const NamedAttrMap&); - // DOM methods & attributes for NamedNodeMap - - virtual PassRefPtr<Node> getNamedItem(const String& name) const; - virtual PassRefPtr<Node> removeNamedItem(const String& name, ExceptionCode&); - - virtual PassRefPtr<Node> getNamedItemNS(const String& namespaceURI, const String& localName) const; - virtual PassRefPtr<Node> removeNamedItemNS(const String& namespaceURI, const String& localName, ExceptionCode&); - - virtual PassRefPtr<Node> getNamedItem(const QualifiedName& name) const; - virtual PassRefPtr<Node> removeNamedItem(const QualifiedName& name, ExceptionCode&); - virtual PassRefPtr<Node> setNamedItem(Node* arg, ExceptionCode&); - - virtual PassRefPtr<Node> item(unsigned index) const; size_t length() const { return m_attributes.size(); } - - // Other methods (not part of DOM) Attribute* attributeItem(unsigned index) const { return m_attributes[index].get(); } - Attribute* getAttributeItem(const QualifiedName& name) const; - Attribute* getAttributeItem(const String& name, bool shouldIgnoreAttributeCase) const; - + Attribute* getAttributeItem(const QualifiedName&) const; + void shrinkToLength() { m_attributes.shrinkCapacity(length()); } - void reserveCapacity(unsigned capacity) { m_attributes.reserveCapacity(capacity); } + void reserveInitialCapacity(unsigned capacity) { m_attributes.reserveInitialCapacity(capacity); } // used during parsing: only inserts if not already there // no error checking! @@ -83,20 +64,38 @@ public: } virtual bool isMappedAttributeMap() const; - - const AtomicString& id() const { return m_id; } - void setID(const AtomicString& _id) { m_id = _id; } + const AtomicString& id() const { return m_id; } + void setID(const AtomicString& newId) { m_id = newId; } + bool mapsEquivalent(const NamedAttrMap* otherMap) const; - // These functions are internal, and do no error checking. + // These functions do no error checking. void addAttribute(PassRefPtr<Attribute>); - void removeAttribute(const QualifiedName& name); + void removeAttribute(const QualifiedName&); protected: virtual void clearAttributes(); + Element* element() const { return m_element; } + +private: + void detachAttributesFromElement(); void detachFromElement(); + Attribute* getAttributeItem(const String& name, bool shouldIgnoreAttributeCase) const; + + virtual PassRefPtr<Node> getNamedItem(const String& name) const; + virtual PassRefPtr<Node> removeNamedItem(const String& name, ExceptionCode&); + + virtual PassRefPtr<Node> getNamedItemNS(const String& namespaceURI, const String& localName) const; + virtual PassRefPtr<Node> removeNamedItemNS(const String& namespaceURI, const String& localName, ExceptionCode&); + + virtual PassRefPtr<Node> getNamedItem(const QualifiedName& name) const; + virtual PassRefPtr<Node> removeNamedItem(const QualifiedName& name, ExceptionCode&); + virtual PassRefPtr<Node> setNamedItem(Node*, ExceptionCode&); + + virtual PassRefPtr<Node> item(unsigned index) const; + virtual size_t virtualLength() const; Element* m_element; Vector<RefPtr<Attribute> > m_attributes; |