12011-12-13 Ryosuke Niwa <rniwa@webkit.org>
2
3 NodeChildList shouldn't be in NodeListNodeData
4 https://bugs.webkit.org/show_bug.cgi?id=73969
5
6 Reviewed by NOBODY (OOPS!).
7
8 Move NodeChildList out of NodeListNodeData to separate it from the other node lists in order to
9 resolve the bug 73853. Unlike other DynamicNodeList, we don't need to invalidate NodeChildList
10 on ancestors when children change. Moving ChildNodeList out of NodeListNodeData makes this difference
11 apparent and makes DynamicNodeList::Caches in NodeListNodeData always held by a DynamicSubtreeNodeList,
12 eliminating the need for hasOwnCaches() checks in various places.
13
14 Also renamed the existing DynamicNodeList to DynamicSubtreeNodeList and re-introduced DynamicNodeList
15 from which DynamicSubtreeNodeList and ChildNodeList both inherit to share the code for itemWithName.
16
17 In addition, renamed registerDynamicNodeList and unregisterDynamicNodeList, which updates a counter for
18 TreeScope::hasNodeListCaches, to registerDynamicSubtreeNodeList and unregisterDynamicSubtreeNodeList
19 respectively. They are no longer called by ChildNodeList in order to avoid walking up the DOM tree
20 inside invalidateNodeListsCacheAfterAttributeChanged and invalidateNodeListsCacheAfterChildrenChanged.
21
22 Test: fast/dom/childnode-item-after-itemname.html
23
24 * bindings/js/JSNodeListCustom.cpp:
25 (WebCore::JSNodeListOwner::isReachableFromOpaqueRoots):
26 * dom/ChildNodeList.cpp:
27 (WebCore::ChildNodeList::ChildNodeList):
28 (WebCore::ChildNodeList::length):
29 (WebCore::ChildNodeList::item):
30 (WebCore::ChildNodeList::nodeMatches):
31 * dom/ChildNodeList.h:
32 * dom/ClassNodeList.cpp:
33 (WebCore::ClassNodeList::ClassNodeList):
34 (WebCore::ClassNodeList::~ClassNodeList):
35 * dom/ClassNodeList.h:
36 * dom/ContainerNode.cpp:
37 (WebCore::ContainerNode::childrenChanged):
38 * dom/DynamicNodeList.cpp:
39 (WebCore::DynamicSubtreeNodeList::DynamicSubtreeNodeList):
40 (WebCore::DynamicSubtreeNodeList::~DynamicSubtreeNodeList):
41 (WebCore::DynamicSubtreeNodeList::length):
42 (WebCore::DynamicSubtreeNodeList::itemForwardsFromCurrent):
43 (WebCore::DynamicSubtreeNodeList::itemBackwardsFromCurrent):
44 (WebCore::DynamicSubtreeNodeList::item):
45 (WebCore::DynamicNodeList::itemWithName):
46 (WebCore::DynamicSubtreeNodeList::isDynamicNodeList):
47 (WebCore::DynamicSubtreeNodeList::invalidateCache):
48 (WebCore::DynamicSubtreeNodeList::Caches::Caches):
49 (WebCore::DynamicSubtreeNodeList::Caches::create):
50 (WebCore::DynamicSubtreeNodeList::Caches::reset):
51 * dom/DynamicNodeList.h:
52 (WebCore::DynamicNodeList::DynamicNodeList):
53 (WebCore::DynamicNodeList::~DynamicNodeList):
54 (WebCore::DynamicNodeList::node):
55 (WebCore::DynamicSubtreeNodeList::rootNode):
56 * dom/NameNodeList.cpp:
57 (WebCore::NameNodeList::NameNodeList):
58 (WebCore::NameNodeList::~NameNodeList):
59 * dom/NameNodeList.h:
60 * dom/Node.cpp:
61 (WebCore::Node::childNodes):
62 (WebCore::Node::registerDynamicSubtreeNodeList):
63 (WebCore::Node::unregisterDynamicSubtreeNodeList):
64 (WebCore::Node::invalidateNodeListsCacheAfterAttributeChanged):
65 (WebCore::Node::invalidateNodeListsCacheAfterChildrenChanged):
66 (WebCore::Node::removeCachedClassNodeList):
67 (WebCore::Node::removeCachedNameNodeList):
68 (WebCore::Node::removeCachedTagNodeList):
69 (WebCore::Node::removeCachedLabelsNodeList):
70 (WebCore::NodeListsNodeData::invalidateCaches):
71 (WebCore::NodeListsNodeData::isEmpty):
72 (WebCore::NodeRareData::clearChildNodeListCache):
73 * dom/Node.h:
74 * dom/NodeRareData.h:
75 (WebCore::NodeRareData::nodeLists):
76 (WebCore::NodeRareData::ensureChildNodeListCache):
77 * dom/TagNodeList.cpp:
78 (WebCore::TagNodeList::TagNodeList):
79 (WebCore::TagNodeList::~TagNodeList):
80 * dom/TagNodeList.h:
81 * html/LabelsNodeList.cpp:
82 (WebCore::LabelsNodeList::LabelsNodeList):
83 * html/LabelsNodeList.h:
84