-
kling@webkit.org authored
<http://webkit.org/b/75416> Reviewed by Anders Carlsson. Source/WebCore: Add a (lazily-allocated) array of HTMLCollections to ElementRareData and cache the various collections on their base node rather than recreating them every time. Test: fast/dom/collection-idempotence.html fast/dom/gc-9.html * html/CollectionType.h: * dom/ElementRareData.h: (WebCore::ElementRareData::hasCachedHTMLCollections): (WebCore::ElementRareData::cachedHTMLCollection): (WebCore::ElementRareData::ensureCachedHTMLCollection): * dom/Element.h: * dom/Element.cpp: (WebCore::Element::ensureCachedHTMLCollection): Plumbing to cache HTMLCollections on ElementRareData. (WebCore::Element::~Element): Detach any cached collections from an element when it's destroyed. * html/HTMLCollection.h: * html/HTMLCollection.cpp: (WebCore::HTMLCollection::HTMLCollection): (WebCore::HTMLCollection::create): (WebCore::HTMLCollection::~HTMLCollection): (WebCore::HTMLCollection::detachFromNode): * html/HTMLTableRowsCollection.cpp: (WebCore::HTMLTableRowsCollection::HTMLTableRowsCollection): * html/HTMLOptionsCollection.cpp: (WebCore::HTMLOptionsCollection::HTMLOptionsCollection): * html/HTMLFormCollection.cpp: (WebCore::HTMLFormCollection::HTMLFormCollection): * dom/Document.cpp: (WebCore::Document::cachedCollection): Consolidate the HTMLCollection constructors and get rid of the hacks to optionally retain the base node. * html/HTMLDataListElement.cpp: (WebCore::HTMLDataListElement::options): * html/HTMLElement.cpp: (WebCore::HTMLElement::children): * html/HTMLMapElement.cpp: (WebCore::HTMLMapElement::areas): * html/HTMLTableElement.cpp: (WebCore::HTMLTableElement::tBodies): * html/HTMLTableRowElement.cpp: (WebCore::HTMLTableRowElement::cells): * html/HTMLTableSectionElement.cpp: (WebCore::HTMLTableSectionElement::rows): Cached collections! LayoutTests: - Updated gc-9.html to document the new lifetime behavior of HTMLCollections. - Merged all the *collection-idempotence.html tests into a big one and added tests for the newly changed collections. * fast/dom/gc-9-expected.txt: * fast/dom/gc-9.html: * fast/dom/collection-idempotence-expected.txt: Added. * fast/dom/collection-idempotence.html: Added. * fast/dom/document-collection-idempotence-expected.txt: Removed. * fast/dom/document-collection-idempotence.html: Removed. * fast/dom/form-elements-collection-idempotence-expected.txt: Removed. * fast/dom/form-elements-collection-idempotence.html: Removed. * fast/dom/select-options-collection-idempotence-expected.txt: Removed. * fast/dom/select-options-collection-idempotence.html: Removed. * fast/dom/table-rows-collection-idempotence-expected.txt: Removed. * fast/dom/table-rows-collection-idempotence.html: Removed. git-svn-id: http://svn.webkit.org/repository/webkit/trunk@103883 268f45cc-cd09-0410-ab3c-d52691b4dbfc
a3a65e36