| 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 Dirk Mueller (mueller@kde.org) | 4 * (C) 2001 Dirk Mueller (mueller@kde.org) |
| 5 * Copyright (C) 2004, 2006, 2007 Apple Inc. All rights reserved. | 5 * Copyright (C) 2004, 2006, 2007 Apple Inc. All rights reserved. |
| 6 * | 6 * |
| 7 * This library is free software; you can redistribute it and/or | 7 * This library is free software; you can redistribute it and/or |
| 8 * modify it under the terms of the GNU Library General Public | 8 * modify it under the terms of the GNU Library General Public |
| 9 * License as published by the Free Software Foundation; either | 9 * License as published by the Free Software Foundation; either |
| 10 * version 2 of the License, or (at your option) any later version. | 10 * version 2 of the License, or (at your option) any later version. |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 : m_ownerNode(ownerNode) | 53 : m_ownerNode(ownerNode) |
| 54 , m_cachedItem(0) | 54 , m_cachedItem(0) |
| 55 , m_isLengthCacheValid(false) | 55 , m_isLengthCacheValid(false) |
| 56 , m_isItemCacheValid(false) | 56 , m_isItemCacheValid(false) |
| 57 , m_rootType(rootType) | 57 , m_rootType(rootType) |
| 58 , m_invalidationType(invalidationType) | 58 , m_invalidationType(invalidationType) |
| 59 , m_shouldOnlyIncludeDirectChildren(shouldOnlyIncludeDirectChildren) | 59 , m_shouldOnlyIncludeDirectChildren(shouldOnlyIncludeDirectChildren) |
| 60 , m_isNameCacheValid(false) | 60 , m_isNameCacheValid(false) |
| 61 , m_collectionType(collectionType) | 61 , m_collectionType(collectionType) |
| 62 , m_overridesItemAfter(itemAfterOverrideType == OverridesItemAfter) | 62 , m_overridesItemAfter(itemAfterOverrideType == OverridesItemAfter) |
| 63 , m_isItemRefElementsCacheValid(false) | |
| 64 { | 63 { |
| 65 ASSERT(m_rootType == static_cast<unsigned>(rootType)); | 64 ASSERT(m_rootType == static_cast<unsigned>(rootType)); |
| 66 ASSERT(m_invalidationType == static_cast<unsigned>(invalidationType)); | 65 ASSERT(m_invalidationType == static_cast<unsigned>(invalidationType)); |
| 67 ASSERT(m_collectionType == static_cast<unsigned>(collectionType)); | 66 ASSERT(m_collectionType == static_cast<unsigned>(collectionType)); |
| 68 ASSERT(!m_overridesItemAfter || !isNodeList(collectionType)); | 67 ASSERT(!m_overridesItemAfter || !isNodeList(collectionType)); |
| 69 | 68 |
| 70 if (collectionType != ChildNodeListType) | 69 if (collectionType != ChildNodeListType) |
| 71 document().registerNodeList(this); | 70 document().registerNodeList(this); |
| 72 } | 71 } |
| 73 | 72 |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 } | 116 } |
| 118 ALWAYS_INLINE void setItemCache(Node* item, unsigned offset) const | 117 ALWAYS_INLINE void setItemCache(Node* item, unsigned offset) const |
| 119 { | 118 { |
| 120 ASSERT(item); | 119 ASSERT(item); |
| 121 m_cachedItem = item; | 120 m_cachedItem = item; |
| 122 m_cachedItemOffset = offset; | 121 m_cachedItemOffset = offset; |
| 123 m_isItemCacheValid = true; | 122 m_isItemCacheValid = true; |
| 124 } | 123 } |
| 125 void setItemCache(Node* item, unsigned offset, unsigned elementsArrayOffset)
const; | 124 void setItemCache(Node* item, unsigned offset, unsigned elementsArrayOffset)
const; |
| 126 | 125 |
| 127 ALWAYS_INLINE bool isItemRefElementsCacheValid() const { return m_isItemRefE
lementsCacheValid; } | |
| 128 ALWAYS_INLINE void setItemRefElementsCacheValid() const { m_isItemRefElement
sCacheValid = true; } | |
| 129 | |
| 130 ALWAYS_INLINE NodeListRootType rootType() const { return static_cast<NodeLis
tRootType>(m_rootType); } | 126 ALWAYS_INLINE NodeListRootType rootType() const { return static_cast<NodeLis
tRootType>(m_rootType); } |
| 131 | 127 |
| 132 bool hasNameCache() const { return m_isNameCacheValid; } | 128 bool hasNameCache() const { return m_isNameCacheValid; } |
| 133 void setHasNameCache() const { m_isNameCacheValid = true; } | 129 void setHasNameCache() const { m_isNameCacheValid = true; } |
| 134 | 130 |
| 135 bool shouldOnlyIncludeDirectChildren() const { return m_shouldOnlyIncludeDir
ectChildren; } | 131 bool shouldOnlyIncludeDirectChildren() const { return m_shouldOnlyIncludeDir
ectChildren; } |
| 136 | 132 |
| 137 private: | 133 private: |
| 138 Node* itemBeforeOrAfterCachedItem(unsigned offset, ContainerNode* root) cons
t; | 134 Node* itemBeforeOrAfterCachedItem(unsigned offset, ContainerNode* root) cons
t; |
| 139 Node* traverseChildNodeListForwardToOffset(unsigned offset, Node* currentNod
e, unsigned& currentOffset) const; | 135 Node* traverseChildNodeListForwardToOffset(unsigned offset, Node* currentNod
e, unsigned& currentOffset) const; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 151 mutable unsigned m_isLengthCacheValid : 1; | 147 mutable unsigned m_isLengthCacheValid : 1; |
| 152 mutable unsigned m_isItemCacheValid : 1; | 148 mutable unsigned m_isItemCacheValid : 1; |
| 153 const unsigned m_rootType : 2; | 149 const unsigned m_rootType : 2; |
| 154 const unsigned m_invalidationType : 4; | 150 const unsigned m_invalidationType : 4; |
| 155 const unsigned m_shouldOnlyIncludeDirectChildren : 1; | 151 const unsigned m_shouldOnlyIncludeDirectChildren : 1; |
| 156 | 152 |
| 157 // From HTMLCollection | 153 // From HTMLCollection |
| 158 mutable unsigned m_isNameCacheValid : 1; | 154 mutable unsigned m_isNameCacheValid : 1; |
| 159 const unsigned m_collectionType : 5; | 155 const unsigned m_collectionType : 5; |
| 160 const unsigned m_overridesItemAfter : 1; | 156 const unsigned m_overridesItemAfter : 1; |
| 161 mutable unsigned m_isItemRefElementsCacheValid : 1; | |
| 162 }; | 157 }; |
| 163 | 158 |
| 164 ALWAYS_INLINE bool LiveNodeListBase::shouldInvalidateTypeOnAttributeChange(NodeL
istInvalidationType type, const QualifiedName& attrName) | 159 ALWAYS_INLINE bool LiveNodeListBase::shouldInvalidateTypeOnAttributeChange(NodeL
istInvalidationType type, const QualifiedName& attrName) |
| 165 { | 160 { |
| 166 switch (type) { | 161 switch (type) { |
| 167 case InvalidateOnClassAttrChange: | 162 case InvalidateOnClassAttrChange: |
| 168 return attrName == HTMLNames::classAttr; | 163 return attrName == HTMLNames::classAttr; |
| 169 case InvalidateOnNameAttrChange: | 164 case InvalidateOnNameAttrChange: |
| 170 return attrName == HTMLNames::nameAttr; | 165 return attrName == HTMLNames::nameAttr; |
| 171 case InvalidateOnIdNameAttrChange: | 166 case InvalidateOnIdNameAttrChange: |
| (...skipping 24 matching lines...) Expand all Loading... |
| 196 virtual Node* namedItem(const AtomicString&) const OVERRIDE; | 191 virtual Node* namedItem(const AtomicString&) const OVERRIDE; |
| 197 virtual bool nodeMatches(Element*) const = 0; | 192 virtual bool nodeMatches(Element*) const = 0; |
| 198 | 193 |
| 199 private: | 194 private: |
| 200 virtual bool isLiveNodeList() const OVERRIDE { return true; } | 195 virtual bool isLiveNodeList() const OVERRIDE { return true; } |
| 201 }; | 196 }; |
| 202 | 197 |
| 203 } // namespace WebCore | 198 } // namespace WebCore |
| 204 | 199 |
| 205 #endif // LiveNodeList_h | 200 #endif // LiveNodeList_h |
| OLD | NEW |