12012-11-22 Ryosuke Niwa <rniwa@webkit.org>
2
3 REGRESSION(r135493): HTMLCollection and DynamicNodeList have two vtable pointers
4 https://bugs.webkit.org/show_bug.cgi?id=103096
5
6 Reviewed by NOBODY (OOPS!).
7
8 Co-authored by Ilya Tikhonovsky.
9
10 Made DynamicNodeListCacheBase inherit from NodeList. While HTMLCollection doesn't inherit
11 from NodeList in IDL, it makes a lot of sense for the C++ implementation to do so via
12 DynamicNodeListCacheBase since HTMLCollection and live NodeList share a lot of code in
13 DynamicNodeListCacheBase.
14
15 This lets remove proxies for item() and length() in DynamicNodeList and HTMLCollection
16 and directly implement them in DynamicNodeListCacheBase which used to provide itemCommon()
17 and lengthCommon().
18
19 Also renamed NodeList::itemWithName() to NodeList::namedItem() to match HTMLCollection's
20 naming convention.
21
22 Finally, removed reportMemoryUsage in DynamicNodeList::reportMemoryUsage since DynamicNodeList
23 now uses single inheritance.
24
25 * bindings/js/JSNodeListCustom.cpp:
26 (WebCore::JSNodeList::canGetItemsForName): Calls namedItem, which has been renamed from
27 itemWithName.
28 (WebCore::JSNodeList::nameGetter): Ditto.
29 * bindings/v8/custom/V8NodeListCustom.cpp:
30 (WebCore::V8NodeList::namedPropertyGetter): Ditto.
31 * bindings/v8/custom/V8NamedNodesCollection.cpp:
32 (WebCore::V8NamedNodesCollection::namedItem): Renamed from itemWithName.
33 * bindings/v8/custom/V8NamedNodesCollection.h:
34 * dom/ChildNodeList.cpp:
35 (WebCore::ChildNodeList::nodeMatches): Updated comment.
36 * dom/DynamicNodeList.cpp:
37 (WebCore::DynamicNodeList::namedItem): Renamed from itemWithName.
38 * dom/DynamicNodeList.h:
39 (DynamicNodeListCacheBase): Inhertis from NodeList and renamed lengthCommon and itemCommon
40 to virtual length and item respectively.
41 (DynamicNodeList): Now inherits from just DynamicNodeListCacheBase instead of NodeList
42 and DynamicNodeListCacheBase since the former now inhertis from NodeList. Also removed
43 length() and item() since they're implemented in DynamicNodeListCacheBase now and renamed
44 itemWithName() to namedItem() to match HTMLCollection's naming convention.
45 * dom/NodeList.h:
46 (NodeList::namedItem): Renamed from itemWithName. Note that this member function is not
47 exposed via IDL. It's merely used in the binding code.
48 * dom/StaticHashSetNodeList.cpp:
49 (WebCore::StaticHashSetNodeList::namedItem): Ditto.
50 * dom/StaticHashSetNodeList.h:
51 (StaticHashSetNodeList::namedItem): Ditto.
52 * dom/StaticNodeList.cpp:
53 (WebCore::StaticNodeList::namedItem): Ditto.
54 * dom/StaticNodeList.h:
55 (StaticNodeList::namedItem): Ditto.
56 * html/HTMLCollection.cpp:
57 (WebCore::DynamicNodeListCacheBase::length): Renamed from lengthCommon.
58 (WebCore::DynamicNodeListCacheBase::item): Renamed from itemCommon.
59 * html/HTMLCollection.h:
60 (HTMLCollection): Inherits from DynamicNodeListCacheBase since DynamicNodeListCacheBase
61 is already RefCount'ed and NodeList, from which DynamicNodeListCacheBase inherits,
62 inherits from ScriptWrappable.
63