Make elements that don't have attributes smaller.
authorkling@webkit.org <kling@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 1 Feb 2012 07:36:21 +0000 (07:36 +0000)
committerkling@webkit.org <kling@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 1 Feb 2012 07:36:21 +0000 (07:36 +0000)
commitd498e06acbd79a319d88dfb6618cd4c51d4fd02c
tree28ef2d2e3ddde97977e004ff44adae881bdee054
parent4e95b6be282307fdcadb3e2f96183dfc269c56fa
Make elements that don't have attributes smaller.
<http://webkit.org/b/76876>

Reviewed by Sam Weinig and Antti Koivisto.

Move the inline style declaration from StyledElement to ElementAttributeData, since having
an inline style declaration also implies having a style attribute on the element.
This saves one CPU word per element that has no attributes.

This reduces memory consumption by 412 kB (on 64-bit) when viewing the full
HTML5 spec at <http://whatwg.org/c>.

This was rolled out once because of a performance regression which has been averted this
time around by adding an Element::ensureAttributeMap() so we can force creation of the
NamedNodeMap without also serializing the inline style for the "style" attribute.

* dom/Element.h:
(Element):
(WebCore::Element::ensureAttributeMap):
(WebCore):
* dom/ElementAttributeData.h:
(ElementAttributeData):
* dom/NamedNodeMap.cpp:
(WebCore::NamedNodeMap::ensureInlineStyleDecl):
(WebCore):
(WebCore::NamedNodeMap::destroyInlineStyleDecl):
* dom/NamedNodeMap.h:
(WebCore::NamedNodeMap::inlineStyleDecl):
(NamedNodeMap):
* dom/StyledElement.cpp:
(WebCore::StyledElement::addSubresourceAttributeURLs):
* dom/StyledElement.h:
(WebCore::StyledElement::inlineStyleDecl):
(WebCore::StyledElement::ensureInlineStyleDecl):
(StyledElement):
(WebCore::StyledElement::destroyInlineStyleDecl):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@106435 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebCore/ChangeLog
Source/WebCore/dom/Element.h
Source/WebCore/dom/ElementAttributeData.h
Source/WebCore/dom/NamedNodeMap.cpp
Source/WebCore/dom/NamedNodeMap.h
Source/WebCore/dom/StyledElement.cpp
Source/WebCore/dom/StyledElement.h