Title: [96638] trunk/Source/WebCore
Revision
96638
Author
commit-qu...@webkit.org
Date
2011-10-04 13:39:45 -0700 (Tue, 04 Oct 2011)

Log Message

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

Patch by Andreas Kling <kl...@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:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (96637 => 96638)


--- trunk/Source/WebCore/ChangeLog	2011-10-04 20:37:58 UTC (rev 96637)
+++ trunk/Source/WebCore/ChangeLog	2011-10-04 20:39:45 UTC (rev 96638)
@@ -1,3 +1,21 @@
+2011-10-04  Andreas Kling  <kl...@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....@gmail.com>
 
         Unreviewed, rolling out r96630.

Modified: trunk/Source/WebCore/html/HTMLTableCellElement.cpp (96637 => 96638)


--- trunk/Source/WebCore/html/HTMLTableCellElement.cpp	2011-10-04 20:37:58 UTC (rev 96637)
+++ trunk/Source/WebCore/html/HTMLTableCellElement.cpp	2011-10-04 20:39:45 UTC (rev 96638)
@@ -44,8 +44,6 @@
 
 inline HTMLTableCellElement::HTMLTableCellElement(const QualifiedName& tagName, Document* document)
     : HTMLTablePartElement(tagName, document)
-    , m_rowSpan(1)
-    , m_colSpan(1)
 {
 }
 
@@ -54,6 +52,18 @@
     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 @@
 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) {

Modified: trunk/Source/WebCore/html/HTMLTableCellElement.h (96637 => 96638)


--- trunk/Source/WebCore/html/HTMLTableCellElement.h	2011-10-04 20:37:58 UTC (rev 96637)
+++ trunk/Source/WebCore/html/HTMLTableCellElement.h	2011-10-04 20:39:45 UTC (rev 96638)
@@ -36,8 +36,8 @@
 
     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 @@
     virtual bool isURLAttribute(Attribute*) const;
 
     virtual void addSubresourceAttributeURLs(ListHashSet<KURL>&) const;
-
-    int m_rowSpan;
-    int m_colSpan;
 };
 
 } // namespace
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to