Enable ElementAttributeData sharing for non-HTML elements.
authorkling@webkit.org <kling@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 24 Sep 2012 00:57:54 +0000 (00:57 +0000)
committerkling@webkit.org <kling@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 24 Sep 2012 00:57:54 +0000 (00:57 +0000)
commit974e7a2751696714e4c04aff67647bcdd7ba28fe
tree947a3fb63689f9deab6cdd358e2b775a7001f7e6
parent82fb13cca4a3df10d46a82e3f79d8081e19f0212
Enable ElementAttributeData sharing for non-HTML elements.
<http://webkit.org/b/97413>

Reviewed by Anders Carlsson.

Use the whole qualified tag name when creating the ElementAttributeData cache key
instead of just the localName(). This allows sharing and caching of attribute data
for non-HTML elements and makes the code a little cleaner.

* dom/Element.cpp:
(WebCore::Element::parserSetAttributes):

    Enable the ElementAttributeData sharing path for non-HTML elements.

* dom/ElementAttributeData.h:

    Make immutableAttributeArray() public so Document can call it instead of getting
    the raw data address from a const_cast'ed attributeItem(0).

* dom/Document.cpp:
(WebCore::ImmutableAttributeDataCacheKey::ImmutableAttributeDataCacheKey):
(WebCore::ImmutableAttributeDataCacheKey::operator!=):
(WebCore::ImmutableAttributeDataCacheKey::hash):
(ImmutableAttributeDataCacheKey):
(WebCore::ImmutableAttributeDataCacheEntry::ImmutableAttributeDataCacheEntry):
(ImmutableAttributeDataCacheEntry):
(WebCore::Document::cachedImmutableAttributeData):

    Let the immutable attribute data cache use a QualifiedName/attributes key
    instead of the AtomicString/attributes we were using before. We still grab the
    existingHash() from the QualifiedName::localName() and use that for the actual
    HashMap key.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@129318 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebCore/ChangeLog
Source/WebCore/dom/Document.cpp
Source/WebCore/dom/Element.cpp
Source/WebCore/dom/ElementAttributeData.h