Changeset 96638 in webkit


Ignore:
Timestamp:
Oct 4, 2011 1:39:45 PM (13 years ago)
Author:
commit-queue@webkit.org
Message:

Shrink HTMLTableCellElement.
https://bugs.webkit.org/show_bug.cgi?id=69347

Patch by Andreas Kling <kling@webkit.org> on 2011-10-04
Reviewed by Antti Koivisto.

Don't cache the rowspan and colspan attributes on the element.
This shrinks HTMLTableCellElement by one CPU word, reducing memory
consumption by 80 kB (on 64-bit) when loading the full HTML5 spec.

  • html/HTMLTableCellElement.cpp:

(WebCore::HTMLTableCellElement::HTMLTableCellElement):
(WebCore::HTMLTableCellElement::colSpan):
(WebCore::HTMLTableCellElement::rowSpan):
(WebCore::HTMLTableCellElement::parseMappedAttribute):

  • html/HTMLTableCellElement.h:
Location:
trunk/Source/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r96637 r96638  
     12011-10-04  Andreas Kling  <kling@webkit.org>
     2
     3        Shrink HTMLTableCellElement.
     4        https://bugs.webkit.org/show_bug.cgi?id=69347
     5
     6        Reviewed by Antti Koivisto.
     7
     8        Don't cache the rowspan and colspan attributes on the element.
     9        This shrinks HTMLTableCellElement by one CPU word, reducing memory
     10        consumption by 80 kB (on 64-bit) when loading the full HTML5 spec.
     11
     12        * html/HTMLTableCellElement.cpp:
     13        (WebCore::HTMLTableCellElement::HTMLTableCellElement):
     14        (WebCore::HTMLTableCellElement::colSpan):
     15        (WebCore::HTMLTableCellElement::rowSpan):
     16        (WebCore::HTMLTableCellElement::parseMappedAttribute):
     17        * html/HTMLTableCellElement.h:
     18
    1192011-10-04  Sheriff Bot  <webkit.review.bot@gmail.com>
    220
  • trunk/Source/WebCore/html/HTMLTableCellElement.cpp

    r94427 r96638  
    4545inline HTMLTableCellElement::HTMLTableCellElement(const QualifiedName& tagName, Document* document)
    4646    : HTMLTablePartElement(tagName, document)
    47     , m_rowSpan(1)
    48     , m_colSpan(1)
    4947{
    5048}
     
    5351{
    5452    return adoptRef(new HTMLTableCellElement(tagName, document));
     53}
     54
     55int HTMLTableCellElement::colSpan() const
     56{
     57    const AtomicString& colSpanValue = fastGetAttribute(colspanAttr);
     58    return max(1, colSpanValue.toInt());
     59}
     60
     61int HTMLTableCellElement::rowSpan() const
     62{
     63    const AtomicString& rowSpanValue = fastGetAttribute(rowspanAttr);
     64    return max(1, min(rowSpanValue.toInt(), maxRowspan));
    5565}
    5666
     
    8595{
    8696    if (attr->name() == rowspanAttr) {
    87         m_rowSpan = max(1, min(attr->value().toInt(), maxRowspan));
    8897        if (renderer() && renderer()->isTableCell())
    8998            toRenderTableCell(renderer())->updateFromElement();
    9099    } else if (attr->name() == colspanAttr) {
    91         m_colSpan = max(1, attr->value().toInt());
    92100        if (renderer() && renderer()->isTableCell())
    93101            toRenderTableCell(renderer())->updateFromElement();
  • trunk/Source/WebCore/html/HTMLTableCellElement.h

    r74953 r96638  
    3737    int cellIndex() const;
    3838
    39     int colSpan() const { return m_colSpan; }
    40     int rowSpan() const { return m_rowSpan; }
     39    int colSpan() const;
     40    int rowSpan() const;
    4141
    4242    void setCellIndex(int);
     
    6464
    6565    virtual void addSubresourceAttributeURLs(ListHashSet<KURL>&) const;
    66 
    67     int m_rowSpan;
    68     int m_colSpan;
    6966};
    7067
Note: See TracChangeset for help on using the changeset viewer.