Exploit shared attribute data to avoid parsing identical "style" attributes.
authorakling@apple.com <akling@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 17 Nov 2012 01:34:36 +0000 (01:34 +0000)
committerakling@apple.com <akling@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 17 Nov 2012 01:34:36 +0000 (01:34 +0000)
commit50173e17df1ad5f2befc76c2593850db456a833d
treecd4947bfb0e099175ed8ada59af469118e2ac8ad
parentfa87117c81f84d90a49d91c56c35a0d064306bb5
Exploit shared attribute data to avoid parsing identical "style" attributes.
<http://webkit.org/b/101163>

Reviewed by Antti Koivisto.

Track the "inline style dirty" state on ElementAttributeData instead of in a Node flag.
This allows us to avoid duplicate work for ElementAttributeData that are shared between multiple elements,
since the state is no longer per-Element.

* css/StyleResolver.cpp:
(WebCore::isCacheableInMatchedPropertiesCache):

    Disable the matched properties cache for styles with non-standard writing-mode.
    This is necessary because some CSS properties have different meaning depending on context -
    properties handled by CSSProperty::resolveDirectionAwareProperty().

    Now that multiple elements may have identical inlineStyle() pointers, this is necessary to
    avoid mapping StylePropertySets with direction-aware properties to RenderStyles with differing
    writing-modes in the matched properties cache.

* dom/Node.h:
* dom/ElementAttributeData.cpp:
(WebCore::ElementAttributeData::ElementAttributeData):
* dom/ElementAttributeData.h:
(WebCore::ElementAttributeData::ElementAttributeData):
(ElementAttributeData):
* dom/Element.h:
(WebCore::Element::updateInvalidAttributes):
* dom/Element.cpp:
(WebCore::Element::getAttribute):
(WebCore::Element::removeAttribute):
* dom/StyledElement.h:
(WebCore::StyledElement::invalidateStyleAttribute):
* dom/StyledElement.cpp:
(WebCore::StyledElement::updateStyleAttribute):

    Move "style attribute dirty" flag to ElementAttributeData.

(WebCore::Element::cloneAttributesFromElement):

    Remove ugly optimization to avoid reparsing inline style when cloning elements. This now happens
    automagically since cloning nodes just refs the original attribute data.

* dom/StyledElement.cpp:
(WebCore::StyledElement::updateStyleAttribute):
(WebCore::StyledElement::setInlineStyleFromString):
(WebCore::StyledElement::styleAttributeChanged):
(WebCore::StyledElement::inlineStyleChanged):

    Avoid reparsing the inline style if the element's attribute data is immutable and already has
    a parsed inlineStyle(). Split the set-inline-style-from-string code out of styleAttributeChanged()
    to make the code more understandable.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@135021 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebCore/ChangeLog
Source/WebCore/css/StyleResolver.cpp
Source/WebCore/dom/Element.cpp
Source/WebCore/dom/Element.h
Source/WebCore/dom/ElementAttributeData.cpp
Source/WebCore/dom/ElementAttributeData.h
Source/WebCore/dom/Node.h
Source/WebCore/dom/StyledElement.cpp
Source/WebCore/dom/StyledElement.h