Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(304)

Unified Diff: Source/WebCore/dom/DynamicNodeList.h

Issue 10695128: Merge 120979 (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1180/
Patch Set: Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/WebCore/dom/Document.cpp ('k') | Source/WebCore/dom/DynamicNodeList.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/WebCore/dom/DynamicNodeList.h
===================================================================
--- Source/WebCore/dom/DynamicNodeList.h (revision 122245)
+++ Source/WebCore/dom/DynamicNodeList.h (working copy)
@@ -36,14 +36,26 @@
class DynamicNodeList : public NodeList {
public:
+ enum NodeListType {
+ ChildNodeListType,
+ ClassNodeListType,
+ NameNodeListType,
+ TagNodeListType,
+ RadioNodeListType,
+ LabelsNodeListType,
+ MicroDataItemListType,
+ };
enum RootType {
RootedAtNode,
RootedAtDocument,
};
-
- DynamicNodeList(PassRefPtr<Node> node, RootType rootType = RootedAtNode)
+ enum InvalidationType {
+ AlwaysInvalidate,
+ DoNotInvalidateOnAttributeChange,
+ };
+ DynamicNodeList(PassRefPtr<Node> node, RootType rootType, InvalidationType invalidationType)
: m_node(node)
- , m_caches(rootType)
+ , m_caches(rootType, invalidationType)
{ }
virtual ~DynamicNodeList() { }
@@ -59,15 +71,19 @@
return m_node->document();
return m_node.get();
}
+ Document* document() { return m_node->document(); }
+ bool shouldInvalidateOnAttributeChange() const { return m_caches.shouldInvalidateOnAttributeChange; }
+
void invalidateCache() { m_caches.reset(); }
protected:
virtual bool nodeMatches(Element*) const = 0;
struct Caches {
- Caches(RootType rootType)
+ Caches(RootType rootType, InvalidationType invalidationType)
: rootedAtDocument(rootType == RootedAtDocument)
+ , shouldInvalidateOnAttributeChange(invalidationType == AlwaysInvalidate)
{
reset();
}
@@ -81,10 +97,14 @@
Node* lastItem;
unsigned cachedLength;
- unsigned lastItemOffset : 29; // Borrow 3-bits for bit fields
+ unsigned lastItemOffset;
unsigned isLengthCacheValid : 1;
unsigned isItemCacheValid : 1;
+
+ // Following flags should belong in DynamicSubtreeNode but are here for bit-packing.
+ unsigned type : 4;
unsigned rootedAtDocument : 1;
+ unsigned shouldInvalidateOnAttributeChange : 1;
};
RefPtr<Node> m_node;
@@ -101,7 +121,9 @@
virtual Node* item(unsigned index) const OVERRIDE;
protected:
- DynamicSubtreeNodeList(PassRefPtr<Node>, RootType = RootedAtNode);
+ DynamicSubtreeNodeList(PassRefPtr<Node> node, RootType rootType = RootedAtNode, InvalidationType invalidationType = AlwaysInvalidate)
+ : DynamicNodeList(node, rootType, invalidationType)
+ { }
private:
Node* itemForwardsFromCurrent(Node* start, unsigned offset, int remainingOffset) const;
« no previous file with comments | « Source/WebCore/dom/Document.cpp ('k') | Source/WebCore/dom/DynamicNodeList.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698