Cache and reuse the HTMLTableElement.rows collection.
authorkling@webkit.org <kling@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 31 Dec 2011 02:56:55 +0000 (02:56 +0000)
committerkling@webkit.org <kling@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 31 Dec 2011 02:56:55 +0000 (02:56 +0000)
commit2f8c82c7e13892e867e4a6aaedea2879c28ffd05
tree54c4f99e4c3a56616c36fbf6585816fdd7396530
parent8fdc8911ef39a0fc198932cdc176a38a7bd34d74
Cache and reuse the HTMLTableElement.rows collection.
<http://webkit.org/b/75398>

Reviewed by Anders Carlsson.

Source/WebCore:

Let HTMLTableElement::rows() cache the returned collection and tie it to the
lifetime of the form.

Test: fast/dom/table-rows-collection-idempotence.html
      fast/dom/gc-9.html

* html/HTMLTableElement.h:
* html/HTMLTableElement.cpp:
(WebCore::HTMLTableElement::rows):

    Cache the HTMLTableRowsCollection returned by rows() on the HTMLTableElement.
    Remove the per-table CollectionCache and let the collection manage that.

* html/HTMLTableRowsCollection.h:
* html/HTMLTableRowsCollection.cpp:
(WebCore::HTMLTableRowsCollection::HTMLTableRowsCollection):
(WebCore::HTMLTableRowsCollection::create):

    Tell the base class constructor to not retain the back-pointer to the table.

LayoutTests:

- Update gc-9.html to document the new lifetime characteristics of HTMLTableElement.rows.
- Add a test to verify that HTMLTableElement.rows returns the same object when called repeatedly.

* fast/dom/gc-9-expected.txt:
* fast/dom/gc-9.html:
* fast/dom/table-rows-collection-idempotence-expected.txt: Added.
* fast/dom/table-rows-collection-idempotence.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@103856 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/fast/dom/gc-9-expected.txt
LayoutTests/fast/dom/gc-9.html
LayoutTests/fast/dom/table-rows-collection-idempotence-expected.txt [new file with mode: 0644]
LayoutTests/fast/dom/table-rows-collection-idempotence.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/html/HTMLTableElement.cpp
Source/WebCore/html/HTMLTableElement.h
Source/WebCore/html/HTMLTableRowsCollection.cpp
Source/WebCore/html/HTMLTableRowsCollection.h