Changeset 89035 in webkit


Ignore:
Timestamp:
Jun 16, 2011 9:50:19 AM (13 years ago)
Author:
jchaffraix@webkit.org
Message:

2011-06-16 Julien Chaffraix <jchaffraix@webkit.org>

Reviewed by Darin Adler.

HTMLTable should cache its 'rows' collection results
https://bugs.webkit.org/show_bug.cgi?id=62800

  • perf/table-rows-length-caching-expected.txt: Added.
  • perf/table-rows-length-caching.html: Added. This test checks that the call to table.rows is CONSTANT once it has been populated once (and the DOM is not mutated).

2011-06-16 Julien Chaffraix <jchaffraix@webkit.org>

Reviewed by Darin Adler.

HTMLTable should cache its 'rows' collection results
https://bugs.webkit.org/show_bug.cgi?id=62800

Test: perf/table-rows-length-caching.html

Currently all our HTMLCollection's are recreated on call. This means that
we don't cache the information about the collection between calls to, for
example, table.rows.

This change adds a CollectionCache to HTMLTableElement. It is similar to what
is done for HTMLFormElement.

  • html/HTMLTableElement.cpp: (WebCore::HTMLTableElement::collectionCache): This method does lazy initialization of the table's collectionCache.
  • html/HTMLTableElement.h: Added a new member and the previous method.
  • html/HTMLTableRowsCollection.cpp: (WebCore::HTMLTableRowsCollection::HTMLTableRowsCollection): Pass the HTMLTableElement's CollectionCache so that we reuse the cached results.
Location:
trunk
Files:
2 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r89034 r89035  
     12011-06-16  Julien Chaffraix  <jchaffraix@webkit.org>
     2
     3        Reviewed by Darin Adler.
     4
     5        HTMLTable should cache its 'rows' collection results
     6        https://bugs.webkit.org/show_bug.cgi?id=62800
     7
     8        * perf/table-rows-length-caching-expected.txt: Added.
     9        * perf/table-rows-length-caching.html: Added.
     10        This test checks that the call to table.rows is CONSTANT once it has
     11        been populated once (and the DOM is not mutated).
     12
    1132011-06-16  Vitaly Repeshko  <vitalyr@chromium.org>
    214
  • trunk/Source/WebCore/ChangeLog

    r89027 r89035  
     12011-06-16  Julien Chaffraix  <jchaffraix@webkit.org>
     2
     3        Reviewed by Darin Adler.
     4
     5        HTMLTable should cache its 'rows' collection results
     6        https://bugs.webkit.org/show_bug.cgi?id=62800
     7
     8        Test: perf/table-rows-length-caching.html
     9
     10        Currently all our HTMLCollection's are recreated on call. This means that
     11        we don't cache the information about the collection between calls to, for
     12        example, table.rows.
     13
     14        This change adds a CollectionCache to HTMLTableElement. It is similar to what
     15        is done for HTMLFormElement.
     16
     17        * html/HTMLTableElement.cpp:
     18        (WebCore::HTMLTableElement::collectionCache): This method does
     19        lazy initialization of the table's collectionCache.
     20        * html/HTMLTableElement.h: Added a new member and the previous
     21        method.
     22
     23        * html/HTMLTableRowsCollection.cpp:
     24        (WebCore::HTMLTableRowsCollection::HTMLTableRowsCollection): Pass
     25        the HTMLTableElement's CollectionCache so that we reuse the cached
     26        results.
     27
    1282011-06-16  Sheriff Bot  <webkit.review.bot@gmail.com>
    229
  • trunk/Source/WebCore/html/HTMLTableElement.cpp

    r72259 r89035  
    625625}
    626626
     627CollectionCache* HTMLTableElement::collectionCache() const
     628{
     629    if (!m_collectionCache)
     630        m_collectionCache = adoptPtr(new CollectionCache());
     631
     632    return m_collectionCache.get();
     633}
     634
    627635void HTMLTableElement::attach()
    628636{
  • trunk/Source/WebCore/html/HTMLTableElement.h

    r66057 r89035  
    6969    void addSharedGroupDecls(bool rows, Vector<CSSMutableStyleDeclaration*>&);
    7070
     71    CollectionCache* collectionCache() const;
     72
    7173private:
    7274    HTMLTableElement(const QualifiedName&, Document*);
     
    101103    unsigned short m_padding;
    102104    RefPtr<CSSMappedAttributeDeclaration> m_paddingDecl;
     105    mutable OwnPtr<CollectionCache> m_collectionCache;
    103106};
    104107
  • trunk/Source/WebCore/html/HTMLTableRowsCollection.cpp

    r72259 r89035  
    150150
    151151HTMLTableRowsCollection::HTMLTableRowsCollection(PassRefPtr<HTMLTableElement> table)
    152     : HTMLCollection(table, OtherCollection, 0)
     152    : HTMLCollection(table, OtherCollection, table->collectionCache())
    153153{
    154154}
Note: See TracChangeset for help on using the changeset viewer.