- a/LayoutTests/ChangeLog +12 lines
Lines 1-3 a/LayoutTests/ChangeLog_sec1
1
2011-06-16  Julien Chaffraix  <jchaffraix@webkit.org>
2
3
        Reviewed by NOBODY (OOPS!).
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
1
2011-06-15  Stephen White  <senorblanco@chromium.org>
13
2011-06-15  Stephen White  <senorblanco@chromium.org>
2
14
3
        Unreviewed; new chromium test baselines.
15
        Unreviewed; new chromium test baselines.
- a/LayoutTests/perf/table-rows-length-caching-expected.txt +3 lines
Line 0 a/LayoutTests/perf/table-rows-length-caching-expected.txt_sec1
1
Tests that check that table.row.length is properly cached
2
PASS
3
- a/LayoutTests/perf/table-rows-length-caching.html +43 lines
Line 0 a/LayoutTests/perf/table-rows-length-caching.html_sec1
1
<!DOCTYPE html>
2
<html>
3
<body>
4
<div id='sandbox'></div>
5
<div id="console"></div>
6
<script src="../resources/magnitude-perf.js"></script>
7
<script>
8
9
if (window.layoutTestController)
10
    layoutTestController.dumpAsText();
11
12
var table;
13
var sandbox = document.getElementById('sandbox');
14
15
// Check that table.rows.length is properly cached.
16
17
function setupTableRows(magnitude)
18
{
19
    if (sandbox.firstChild)
20
        sandbox.removeChild(sandbox.firstChild);
21
    table = document.createElement('table');
22
23
    for (var i = 0; i < magnitude; ++i) {
24
        var tr = document.createElement('tr');
25
        table.appendChild(tr);
26
    }
27
    sandbox.appendChild(table);
28
29
    // Make sure we have cached the length before testing!
30
    table.rows.length;
31
}
32
33
function testTableRows(magnitude)
34
{
35
    table.rows.length;
36
}
37
38
Magnitude.description('Tests that check that table.row.length is properly cached');
39
Magnitude.run(setupTableRows, testTableRows, Magnitude.CONSTANT);
40
sandbox.removeChild(sandbox.firstChild);
41
</script>
42
</body>
43
</html>
- a/Source/WebCore/ChangeLog +27 lines
Lines 1-3 a/Source/WebCore/ChangeLog_sec1
1
2011-06-16  Julien Chaffraix  <jchaffraix@webkit.org>
2
3
        Reviewed by NOBODY (OOPS!).
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
1
2011-06-15  Eric Carlson  <eric.carlson@apple.com>
28
2011-06-15  Eric Carlson  <eric.carlson@apple.com>
2
29
3
        Reviewed by Alexey Proskuryakov.
30
        Reviewed by Alexey Proskuryakov.
- a/Source/WebCore/html/HTMLTableElement.cpp +8 lines
Lines 624-629 void HTMLTableElement::addSharedGroupDecls(bool rows, Vector<CSSMutableStyleDecl a/Source/WebCore/html/HTMLTableElement.cpp_sec1
624
    results.append(decl);
624
    results.append(decl);
625
}
625
}
626
626
627
CollectionCache* HTMLTableElement::collectionCache() const
628
{
629
    if (!m_collectionCache)
630
        m_collectionCache = adoptPtr(new CollectionCache());
631
632
    return m_collectionCache.get();
633
}
634
627
void HTMLTableElement::attach()
635
void HTMLTableElement::attach()
628
{
636
{
629
    ASSERT(!attached());
637
    ASSERT(!attached());
- a/Source/WebCore/html/HTMLTableElement.h +3 lines
Lines 68-73 public: a/Source/WebCore/html/HTMLTableElement.h_sec1
68
    void addSharedCellDecls(Vector<CSSMutableStyleDeclaration*>&);
68
    void addSharedCellDecls(Vector<CSSMutableStyleDeclaration*>&);
69
    void addSharedGroupDecls(bool rows, Vector<CSSMutableStyleDeclaration*>&);
69
    void addSharedGroupDecls(bool rows, Vector<CSSMutableStyleDeclaration*>&);
70
70
71
    CollectionCache* collectionCache() const;
72
71
private:
73
private:
72
    HTMLTableElement(const QualifiedName&, Document*);
74
    HTMLTableElement(const QualifiedName&, Document*);
73
75
Lines 100-105 private: a/Source/WebCore/html/HTMLTableElement.h_sec2
100
102
101
    unsigned short m_padding;
103
    unsigned short m_padding;
102
    RefPtr<CSSMappedAttributeDeclaration> m_paddingDecl;
104
    RefPtr<CSSMappedAttributeDeclaration> m_paddingDecl;
105
    mutable OwnPtr<CollectionCache> m_collectionCache;
103
};
106
};
104
107
105
} //namespace
108
} //namespace
- a/Source/WebCore/html/HTMLTableRowsCollection.cpp -1 / +1 lines
Lines 149-155 HTMLTableRowElement* HTMLTableRowsCollection::lastRow(HTMLTableElement* table) a/Source/WebCore/html/HTMLTableRowsCollection.cpp_sec1
149
}
149
}
150
150
151
HTMLTableRowsCollection::HTMLTableRowsCollection(PassRefPtr<HTMLTableElement> table)
151
HTMLTableRowsCollection::HTMLTableRowsCollection(PassRefPtr<HTMLTableElement> table)
152
    : HTMLCollection(table, OtherCollection, 0)
152
    : HTMLCollection(table, OtherCollection, table->collectionCache())
153
{
153
{
154
}
154
}
155
155

Return to Bug 62800