From: kling@webkit.org Date: Tue, 21 Feb 2012 14:37:51 +0000 (+0000) Subject: Shrink attribute style property sets after populating them. X-Git-Tag: 070512121124~12299 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=da93a9b23b7ec2070526d3680f0edab04367fcec;p=profile%2Fivi%2Fwebkit-efl.git Shrink attribute style property sets after populating them. 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 --- diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog index 07d42df..0e098c1 100644 --- a/Source/WebCore/ChangeLog +++ b/Source/WebCore/ChangeLog @@ -1,3 +1,18 @@ +2012-02-21 Andreas Kling + + Shrink attribute style property sets after populating them. + + + 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 Remove stylesheet pointer from StylePropertySet diff --git a/Source/WebCore/css/StylePropertySet.h b/Source/WebCore/css/StylePropertySet.h index 68ed6fa..50cfe00 100644 --- a/Source/WebCore/css/StylePropertySet.h +++ b/Source/WebCore/css/StylePropertySet.h @@ -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 getPropertyCSSValue(int propertyID) const; String getPropertyValue(int propertyID) const; bool propertyIsImportant(int propertyID) const; diff --git a/Source/WebCore/dom/StyledElement.cpp b/Source/WebCore/dom/StyledElement.cpp index 817ff48..c818a2e 100644 --- a/Source/WebCore/dom/StyledElement.cpp +++ b/Source/WebCore/dom/StyledElement.cpp @@ -166,8 +166,10 @@ void StyledElement::updateAttributeStyle() if (style->isEmpty()) attributeData()->setAttributeStyle(0); - else + else { + style->shrinkToFit(); attributeData()->setAttributeStyle(style.release()); + } } }