Make ElementAttributeData a variable-sized object to reduce memory use.
<http://webkit.org/b/88240>

Reviewed by Antti "Obi-Wan" Koivisto.

Take advantage of the fact that we know at ElementAttributeData construction time how many attributes
it needs to accomodate and allocate exactly as much space as needed instead of using a Vector.
For elements that never have their attribute list mutated (the vast majority), this saves a lot of
memory and removes the indirection to Vector<Attribute>'s heap-allocated storage.

Introduced a mutability flag to ElementAttributeData and sprinkled assertions all over to make sure
that nothing tries to mutate an element with a raw attribute array.

When an Element's attribute(s) are mutated, we reconstruct the ElementAttributeData, this time using
a Vector as backing instead. This is triggered when calling Element::mutableAttributeData().

This reduces memory consumption by 3.2MB when viewing the full HTML5 spec at <http://whatwg.org/c/>.
That is a ~35% reduction in DOM attribute memory use.

Furthermore, that page ends up promoting 27% of the elements to mutable attribute storage due to dynamic
adding of "class" attributes. For more static pages, savings are even greater.

Also did away with ElementAttributeData::removeAttribute(name) and do separate index lookup where
needed. Not a big deal but avoids double lookup of attributes when removing them.

* css/PropertySetCSSStyleDeclaration.cpp:
(WebCore::InlineCSSStyleDeclaration::ensureMutablePropertySet):

    Call ensureInlineStyle() on the element so we know we have a StylePropertySet to work with.
    May cause the creation (and replacement) of a new underlying StylePropertySet on the Element's
    attribute data.

* css/StylePropertySet.cpp:
(WebCore::StylePropertySet::adoptCSSOMWrapperFrom):

    Added. Allows switching the underlying StylePropertySet object while retaining CSSOM wrapper
    identity (web facing behavior.)

* dom/Element.cpp:
(WebCore::Element::detachAttribute):
(WebCore::Element::removeAttribute):
(WebCore::Element::attributes):
(WebCore::Element::setAttributeInternal):
(WebCore::Element::parserSetAttributes):
(WebCore::Element::hasEquivalentAttributes):
(WebCore::Element::setAttributeNode):
(WebCore::Element::removeAttributeNode):
(WebCore::Element::getAttributeNode):
(WebCore::Element::getAttributeNodeNS):
(WebCore::Element::hasAttribute):
(WebCore::Element::hasAttributeNS):
(WebCore::Element::normalizeAttributes):
(WebCore::Element::cloneAttributesFromElement):
(WebCore::Element::createMutableAttributeData):
* dom/Element.h:
(WebCore::Element::attributeData):
(Element):
(WebCore::Element::updatedAttributeData):
(WebCore::Element::ensureAttributeData):
(WebCore::Element::ensureUpdatedAttributeData):
(WebCore::Element::mutableAttributeData):
(WebCore):
* dom/ElementAttributeData.cpp:
(WebCore::ElementAttributeData::createImmutable):
(WebCore):
(WebCore::ElementAttributeData::ElementAttributeData):
(WebCore::ElementAttributeData::~ElementAttributeData):
(WebCore::ElementAttributeData::attrIfExists):
(WebCore::ElementAttributeData::ensureAttr):
(WebCore::ElementAttributeData::setAttr):
(WebCore::ElementAttributeData::removeAttr):
(WebCore::ElementAttributeData::ensureInlineStyle):
(WebCore::ElementAttributeData::ensureMutableInlineStyle):
(WebCore::ElementAttributeData::destroyInlineStyle):
(WebCore::ElementAttributeData::addAttribute):
(WebCore::ElementAttributeData::removeAttribute):
(WebCore::ElementAttributeData::isEquivalent):
(WebCore::ElementAttributeData::detachAttrObjectsFromElement):
(WebCore::ElementAttributeData::getAttributeItemIndexSlowCase):
(WebCore::ElementAttributeData::cloneDataFrom):
(WebCore::ElementAttributeData::clearAttributes):
(WebCore::ElementAttributeData::replaceAttribute):
(WebCore::ElementAttributeData::getAttributeNode):
* dom/ElementAttributeData.h:
(WebCore::ElementAttributeData::create):
(ElementAttributeData):
(WebCore::ElementAttributeData::setClass):
(WebCore::ElementAttributeData::setIdForStyleResolution):
(WebCore::ElementAttributeData::inlineStyle):
(WebCore::ElementAttributeData::setAttributeStyle):
(WebCore::ElementAttributeData::reportMemoryUsage):
(WebCore::ElementAttributeData::isMutable):
(WebCore::ElementAttributeData::makeMutable):
(WebCore::ElementAttributeData::length):
(WebCore):
(WebCore::ElementAttributeData::isEmpty):
(WebCore::ElementAttributeData::array):
(WebCore::ElementAttributeData::removeAttribute):
(WebCore::ElementAttributeData::getAttributeItem):
(WebCore::ElementAttributeData::getAttributeItemIndex):
(WebCore::ElementAttributeData::attributeItem):
* dom/StyledElement.cpp:
(WebCore::StyledElement::style):
(WebCore::StyledElement::classAttributeChanged):
(WebCore::StyledElement::setInlineStyleProperty):
(WebCore::StyledElement::removeInlineStyleProperty):
(WebCore::StyledElement::addSubresourceAttributeURLs):
* dom/StyledElement.h:
(WebCore::StyledElement::ensureInlineStyle):
* html/parser/HTMLConstructionSite.cpp:
(WebCore::HTMLConstructionSite::createHTMLElementFromSavedElement):
* xml/parser/XMLDocumentParserQt.cpp:
(WebCore::XMLDocumentParser::XMLDocumentParser):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@122450 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[Qt] [Part 1] platform/qt/css1 tests needs update after rebaseline and new testfonts
https://bugs.webkit.org/show_bug.cgi?id=90809

Batch of expected result files reviewed. It comprises
/LayoutTests/platform/qt/css1/box_properties directory.

Patch by Luciano Wolf <luciano.wolf@openbossa.org> on 2012-07-12
Reviewed by Csaba Osztrogonác.

* platform/qt-5.0-wk1/Skipped:
* platform/qt-5.0-wk2/Skipped:
* platform/qt-5.0/Skipped:
* platform/qt/css1/box_properties/acid_test-expected.png:
* platform/qt/css1/box_properties/acid_test-expected.txt:
* platform/qt/css1/box_properties/border-expected.png:
* platform/qt/css1/box_properties/border-expected.txt:
* platform/qt/css1/box_properties/border_bottom-expected.png:
* platform/qt/css1/box_properties/border_bottom-expected.txt:
* platform/qt/css1/box_properties/border_bottom_inline-expected.png:
* platform/qt/css1/box_properties/border_bottom_inline-expected.txt:
* platform/qt/css1/box_properties/border_bottom_width-expected.png:
* platform/qt/css1/box_properties/border_bottom_width-expected.txt:
* platform/qt/css1/box_properties/border_bottom_width_inline-expected.png:
* platform/qt/css1/box_properties/border_bottom_width_inline-expected.txt:
* platform/qt/css1/box_properties/border_color-expected.png:
* platform/qt/css1/box_properties/border_color-expected.txt:
* platform/qt/css1/box_properties/border_color_inline-expected.png:
* platform/qt/css1/box_properties/border_color_inline-expected.txt:
* platform/qt/css1/box_properties/border_inline-expected.png:
* platform/qt/css1/box_properties/border_inline-expected.txt:
* platform/qt/css1/box_properties/border_left-expected.png:
* platform/qt/css1/box_properties/border_left-expected.txt:
* platform/qt/css1/box_properties/border_left_inline-expected.png:
* platform/qt/css1/box_properties/border_left_inline-expected.txt:
* platform/qt/css1/box_properties/border_left_width-expected.png:
* platform/qt/css1/box_properties/border_left_width-expected.txt:
* platform/qt/css1/box_properties/border_left_width_inline-expected.png:
* platform/qt/css1/box_properties/border_left_width_inline-expected.txt:
* platform/qt/css1/box_properties/border_right-expected.png:
* platform/qt/css1/box_properties/border_right-expected.txt:
* platform/qt/css1/box_properties/border_right_inline-expected.png:
* platform/qt/css1/box_properties/border_right_inline-expected.txt:
* platform/qt/css1/box_properties/border_right_width-expected.png:
* platform/qt/css1/box_properties/border_right_width-expected.txt:
* platform/qt/css1/box_properties/border_right_width_inline-expected.png:
* platform/qt/css1/box_properties/border_right_width_inline-expected.txt:
* platform/qt/css1/box_properties/border_style-expected.png:
* platform/qt/css1/box_properties/border_style-expected.txt:
* platform/qt/css1/box_properties/border_style_inline-expected.png:
* platform/qt/css1/box_properties/border_style_inline-expected.txt:
* platform/qt/css1/box_properties/border_top-expected.png:
* platform/qt/css1/box_properties/border_top-expected.txt:
* platform/qt/css1/box_properties/border_top_inline-expected.png:
* platform/qt/css1/box_properties/border_top_inline-expected.txt:
* platform/qt/css1/box_properties/border_top_width-expected.png:
* platform/qt/css1/box_properties/border_top_width-expected.txt:
* platform/qt/css1/box_properties/border_top_width_inline-expected.png:
* platform/qt/css1/box_properties/border_top_width_inline-expected.txt:
* platform/qt/css1/box_properties/border_width-expected.png:
* platform/qt/css1/box_properties/border_width-expected.txt:
* platform/qt/css1/box_properties/border_width_inline-expected.png:
* platform/qt/css1/box_properties/border_width_inline-expected.txt:
* platform/qt/css1/box_properties/clear-expected.png:
* platform/qt/css1/box_properties/clear-expected.txt:
* platform/qt/css1/box_properties/clear_float-expected.png:
* platform/qt/css1/box_properties/clear_float-expected.txt:
* platform/qt/css1/box_properties/float-expected.png:
* platform/qt/css1/box_properties/float-expected.txt:
* platform/qt/css1/box_properties/float_elements_in_series-expected.png:
* platform/qt/css1/box_properties/float_elements_in_series-expected.txt:
* platform/qt/css1/box_properties/float_margin-expected.png:
* platform/qt/css1/box_properties/float_margin-expected.txt:
* platform/qt/css1/box_properties/float_on_text_elements-expected.png:
* platform/qt/css1/box_properties/float_on_text_elements-expected.txt:
* platform/qt/css1/box_properties/height-expected.png:
* platform/qt/css1/box_properties/height-expected.txt:
* platform/qt/css1/box_properties/margin-expected.png:
* platform/qt/css1/box_properties/margin-expected.txt:
* platform/qt/css1/box_properties/margin_bottom-expected.png:
* platform/qt/css1/box_properties/margin_bottom-expected.txt:
* platform/qt/css1/box_properties/margin_bottom_inline-expected.png:
* platform/qt/css1/box_properties/margin_bottom_inline-expected.txt:
* platform/qt/css1/box_properties/margin_inline-expected.png:
* platform/qt/css1/box_properties/margin_inline-expected.txt:
* platform/qt/css1/box_properties/margin_left-expected.png:
* platform/qt/css1/box_properties/margin_left-expected.txt:
* platform/qt/css1/box_properties/margin_left_inline-expected.png:
* platform/qt/css1/box_properties/margin_left_inline-expected.txt:
* platform/qt/css1/box_properties/margin_right-expected.png:
* platform/qt/css1/box_properties/margin_right-expected.txt:
* platform/qt/css1/box_properties/margin_right_inline-expected.png:
* platform/qt/css1/box_properties/margin_right_inline-expected.txt:
* platform/qt/css1/box_properties/margin_top-expected.png:
* platform/qt/css1/box_properties/margin_top-expected.txt:
* platform/qt/css1/box_properties/margin_top_inline-expected.png:
* platform/qt/css1/box_properties/margin_top_inline-expected.txt:
* platform/qt/css1/box_properties/padding-expected.png:
* platform/qt/css1/box_properties/padding-expected.txt:
* platform/qt/css1/box_properties/padding_bottom-expected.png:
* platform/qt/css1/box_properties/padding_bottom-expected.txt:
* platform/qt/css1/box_properties/padding_bottom_inline-expected.png:
* platform/qt/css1/box_properties/padding_bottom_inline-expected.txt:
* platform/qt/css1/box_properties/padding_inline-expected.png:
* platform/qt/css1/box_properties/padding_inline-expected.txt:
* platform/qt/css1/box_properties/padding_left-expected.png:
* platform/qt/css1/box_properties/padding_left-expected.txt:
* platform/qt/css1/box_properties/padding_left_inline-expected.png:
* platform/qt/css1/box_properties/padding_left_inline-expected.txt:
* platform/qt/css1/box_properties/padding_right-expected.png:
* platform/qt/css1/box_properties/padding_right-expected.txt:
* platform/qt/css1/box_properties/padding_right_inline-expected.png:
* platform/qt/css1/box_properties/padding_right_inline-expected.txt:
* platform/qt/css1/box_properties/padding_top-expected.png:
* platform/qt/css1/box_properties/padding_top-expected.txt:
* platform/qt/css1/box_properties/padding_top_inline-expected.png:
* platform/qt/css1/box_properties/padding_top_inline-expected.txt:
* platform/qt/css1/box_properties/width-expected.png:
* platform/qt/css1/box_properties/width-expected.txt:

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