summaryrefslogtreecommitdiff
path: root/Source/WebCore/html/HTMLPropertiesCollection.h
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@nokia.com>2012-05-07 11:21:11 +0200
committerSimon Hausmann <simon.hausmann@nokia.com>2012-05-07 11:21:11 +0200
commit2cf6c8816a73e0132bd8fa3b509d62d7c51b6e47 (patch)
tree988e8c5b116dd0466244ae2fe5af8ee9be926d76 /Source/WebCore/html/HTMLPropertiesCollection.h
parentdd91e772430dc294e3bf478c119ef8d43c0a3358 (diff)
downloadqtwebkit-2cf6c8816a73e0132bd8fa3b509d62d7c51b6e47.tar.gz
Imported WebKit commit 7e538425aa020340619e927792f3d895061fb54b (http://svn.webkit.org/repository/webkit/trunk@116286)
Diffstat (limited to 'Source/WebCore/html/HTMLPropertiesCollection.h')
-rw-r--r--Source/WebCore/html/HTMLPropertiesCollection.h91
1 files changed, 87 insertions, 4 deletions
diff --git a/Source/WebCore/html/HTMLPropertiesCollection.h b/Source/WebCore/html/HTMLPropertiesCollection.h
index 46434e3a9..9cd9175bc 100644
--- a/Source/WebCore/html/HTMLPropertiesCollection.h
+++ b/Source/WebCore/html/HTMLPropertiesCollection.h
@@ -33,6 +33,7 @@
#if ENABLE(MICRODATA)
+#include "DOMStringList.h"
#include "HTMLCollection.h"
namespace WebCore {
@@ -56,11 +57,93 @@ public:
private:
HTMLPropertiesCollection(Node*);
- void findPropetiesOfAnItem(Node* current) const;
- void getNamedItems(Vector<RefPtr<Node> >&, const String&) const;
+ unsigned calcLength() const;
+ void findProperties(Element* base) const;
+
+ Node* findRefElements(Node* previous) const;
+
+ Element* firstProperty() const;
+ Element* itemAfter(Element* base, Element* previous) const;
+
+ void updateNameCache() const;
+ void updateRefElements() const;
+
+ void invalidateCacheIfNeeded() const;
+
+ mutable struct {
+ uint64_t version;
+ Element* current;
+ unsigned position;
+ unsigned length;
+ bool hasLength;
+ bool hasNameCache;
+ NodeCacheMap propertyCache;
+ Vector<Element*> itemRefElements;
+ RefPtr<DOMStringList> propertyNames;
+ unsigned itemRefElementPosition;
+ bool hasItemRefElements;
+
+ void clear()
+ {
+ version = 0;
+ current = 0;
+ position = 0;
+ length = 0;
+ hasLength = false;
+ hasNameCache = false;
+ propertyCache.clear();
+ itemRefElements.clear();
+ propertyNames.clear();
+ itemRefElementPosition = 0;
+ hasItemRefElements = false;
+ }
+
+ void setItemRefElements(const Vector<Element*>& elements)
+ {
+ itemRefElements = elements;
+ hasItemRefElements = true;
+ }
+
+ const Vector<Element*>& getItemRefElements()
+ {
+ return itemRefElements;
+ }
+
+ void updateLength(unsigned len)
+ {
+ length = len;
+ hasLength = true;
+ }
+
+ void updatePropertyCache(Element* element, const AtomicString& propertyName)
+ {
+ if (!propertyNames)
+ propertyNames = DOMStringList::create();
+
+ if (!propertyNames->contains(propertyName))
+ propertyNames->append(propertyName);
+
+ Vector<Element*>* propertyResults = propertyCache.get(propertyName.impl());
+ if (!propertyResults || !propertyResults->contains(element))
+ append(propertyCache, propertyName, element);
+ }
+
+ void updateCurrentItem(Element* element, unsigned pos, unsigned itemRefElementPos)
+ {
+ current = element;
+ position = pos;
+ itemRefElementPosition = itemRefElementPos;
+ }
+
+ void resetPosition()
+ {
+ current = 0;
+ position = 0;
+ itemRefElementPosition = 0;
+ }
+
+ } m_cache;
- mutable Vector<Node*> m_properties;
- mutable RefPtr<DOMStringList> m_propertyNames;
};
} // namespace WebCore