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:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@96638 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 4faffd7b
2011-10-04 Andreas Kling <kling@webkit.org>
Shrink HTMLTableCellElement.
https://bugs.webkit.org/show_bug.cgi?id=69347
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:
2011-10-04 Sheriff Bot <webkit.review.bot@gmail.com>
Unreviewed, rolling out r96630.
......@@ -44,8 +44,6 @@ using namespace HTMLNames;
inline HTMLTableCellElement::HTMLTableCellElement(const QualifiedName& tagName, Document* document)
: HTMLTablePartElement(tagName, document)
, m_rowSpan(1)
, m_colSpan(1)
{
}
......@@ -54,6 +52,18 @@ PassRefPtr<HTMLTableCellElement> HTMLTableCellElement::create(const QualifiedNam
return adoptRef(new HTMLTableCellElement(tagName, document));
}
int HTMLTableCellElement::colSpan() const
{
const AtomicString& colSpanValue = fastGetAttribute(colspanAttr);
return max(1, colSpanValue.toInt());
}
int HTMLTableCellElement::rowSpan() const
{
const AtomicString& rowSpanValue = fastGetAttribute(rowspanAttr);
return max(1, min(rowSpanValue.toInt(), maxRowspan));
}
int HTMLTableCellElement::cellIndex() const
{
int index = 0;
......@@ -84,11 +94,9 @@ bool HTMLTableCellElement::mapToEntry(const QualifiedName& attrName, MappedAttri
void HTMLTableCellElement::parseMappedAttribute(Attribute* attr)
{
if (attr->name() == rowspanAttr) {
m_rowSpan = max(1, min(attr->value().toInt(), maxRowspan));
if (renderer() && renderer()->isTableCell())
toRenderTableCell(renderer())->updateFromElement();
} else if (attr->name() == colspanAttr) {
m_colSpan = max(1, attr->value().toInt());
if (renderer() && renderer()->isTableCell())
toRenderTableCell(renderer())->updateFromElement();
} else if (attr->name() == nowrapAttr) {
......
......@@ -36,8 +36,8 @@ public:
int cellIndex() const;
int colSpan() const { return m_colSpan; }
int rowSpan() const { return m_rowSpan; }
int colSpan() const;
int rowSpan() const;
void setCellIndex(int);
......@@ -63,9 +63,6 @@ private:
virtual bool isURLAttribute(Attribute*) const;
virtual void addSubresourceAttributeURLs(ListHashSet<KURL>&) const;
int m_rowSpan;
int m_colSpan;
};
} // namespace
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment