Shrink attribute style property sets after populating them.
authorkling@webkit.org <kling@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 21 Feb 2012 14:37:51 +0000 (14:37 +0000)
committerkling@webkit.org <kling@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 21 Feb 2012 14:37:51 +0000 (14:37 +0000)
<http://webkit.org/b/78972>

Reviewed by Antti Koivisto.

Add a StylePropertySet::shrinkToFit() and call it at the end of updateStyleAttribute()
to minimize the amount of wasted space.

* css/StylePropertySet.h:
(WebCore::StylePropertySet::shrinkToFit):
* dom/StyledElement.cpp:
(WebCore::StyledElement::updateAttributeStyle):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@108350 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/css/StylePropertySet.h
Source/WebCore/dom/StyledElement.cpp

index 07d42df..0e098c1 100644 (file)
@@ -1,3 +1,18 @@
+2012-02-21  Andreas Kling  <awesomekling@apple.com>
+
+        Shrink attribute style property sets after populating them.
+        <http://webkit.org/b/78972>
+
+        Reviewed by Antti Koivisto.
+
+        Add a StylePropertySet::shrinkToFit() and call it at the end of updateStyleAttribute()
+        to minimize the amount of wasted space.
+
+        * css/StylePropertySet.h:
+        (WebCore::StylePropertySet::shrinkToFit):
+        * dom/StyledElement.cpp:
+        (WebCore::StyledElement::updateAttributeStyle):
+
 2012-02-21  Antti Koivisto  <antti@apple.com>
 
         Remove stylesheet pointer from StylePropertySet
index 68ed6fa..50cfe00 100644 (file)
@@ -55,6 +55,8 @@ public:
     bool isEmpty() const { return m_properties.isEmpty(); }
     const CSSProperty& propertyAt(unsigned index) const { return m_properties[index]; }
 
+    void shrinkToFit() { m_properties.shrinkToFit(); }
+
     PassRefPtr<CSSValue> getPropertyCSSValue(int propertyID) const;
     String getPropertyValue(int propertyID) const;
     bool propertyIsImportant(int propertyID) const;
index 817ff48..c818a2e 100644 (file)
@@ -166,8 +166,10 @@ void StyledElement::updateAttributeStyle()
 
     if (style->isEmpty())
         attributeData()->setAttributeStyle(0);
-    else
+    else {
+        style->shrinkToFit();
         attributeData()->setAttributeStyle(style.release());
+    }
 }
 
 }