Better names for ElementAttributeData & subclasses.
authorakling@apple.com <akling@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 13 Feb 2013 21:48:40 +0000 (21:48 +0000)
committerakling@apple.com <akling@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 13 Feb 2013 21:48:40 +0000 (21:48 +0000)
<http://webkit.org/b/109529>

Reviewed by Antti Koivisto.

- ElementAttributeData => ElementData

    Because ElementAttributeData won't be a good name once we move some non-attribute related
    things to this structure.

- ImmutableElementAttributeData => ShareableElementData

    These objects can be shared with other Elements that have the same attribute name/value pairs.

- MutableElementAttributeData => UniqueElementData

    These objects contain data that is unique to a specific Element, and cannot be shared with
    other Elements. This is what's important about it, not that its underlying storage is mutable.

- attributeData() -> elementData()
- updatedAttributeData() -> elementDataWithSynchronizedAttributes()
- ensureUpdatedAttributeData() -> ensureElementDataWithSynchronizedAttributes()
- mutableAttributeData() -> ensureUniqueElementData()

    Ride-along renames. Much less vague than previous names IMO.

* css/StyleResolver.cpp:
(WebCore::StyleResolver::canShareStyleWithControl):
(WebCore::StyleResolver::sharingCandidateHasIdenticalStyleAffectingAttributes):
* dom/Attr.cpp:
(WebCore::Attr::elementAttribute):
* dom/DocumentSharedObjectPool.cpp:
(WebCore::ShareableElementDataCacheKey::ShareableElementDataCacheKey):
(WebCore::ShareableElementDataCacheKey::operator!=):
(WebCore::ShareableElementDataCacheEntry::ShareableElementDataCacheEntry):
(ShareableElementDataCacheEntry):
(WebCore::DocumentSharedObjectPool::cachedShareableElementDataWithAttributes):
* dom/DocumentSharedObjectPool.h:
(DocumentSharedObjectPool):
* dom/Element.cpp:
(WebCore::Element::detachAttribute):
(WebCore::Element::removeAttribute):
(WebCore::Element::attributes):
(WebCore::Element::getAttribute):
(WebCore::Element::setAttribute):
(WebCore::Element::setSynchronizedLazyAttribute):
(WebCore::Element::setAttributeInternal):
(WebCore::Element::attributeChanged):
(WebCore::Element::classAttributeChanged):
(WebCore::Element::shouldInvalidateDistributionWhenAttributeChanged):
(WebCore::Element::parserSetAttributes):
(WebCore::Element::hasAttributes):
(WebCore::Element::hasEquivalentAttributes):
(WebCore::Element::setAttributeNode):
(WebCore::Element::removeAttributeNode):
(WebCore::Element::removeAttributeInternal):
(WebCore::Element::addAttributeInternal):
(WebCore::Element::getAttributeNode):
(WebCore::Element::getAttributeNodeNS):
(WebCore::Element::hasAttribute):
(WebCore::Element::hasAttributeNS):
(WebCore::Element::computeInheritedLanguage):
(WebCore::Element::getURLAttribute):
(WebCore::Element::getNonEmptyURLAttribute):
(WebCore::Element::cloneAttributesFromElement):
(WebCore::Element::createUniqueElementData):
(WebCore::Element::reportMemoryUsage):
(WebCore::ElementData::deref):
(WebCore::ElementData::ElementData):
(WebCore::sizeForShareableElementDataWithAttributeCount):
(WebCore::ElementData::createShareableWithAttributes):
(WebCore::ElementData::createUnique):
(WebCore::ShareableElementData::ShareableElementData):
(WebCore::ShareableElementData::~ShareableElementData):
(WebCore::UniqueElementData::UniqueElementData):
(WebCore::ElementData::makeMutableCopy):
(WebCore::ElementData::makeImmutableCopy):
(WebCore::ElementData::setPresentationAttributeStyle):
(WebCore::ElementData::addAttribute):
(WebCore::ElementData::removeAttribute):
(WebCore::ElementData::isEquivalent):
(WebCore::ElementData::reportMemoryUsage):
(WebCore::ElementData::getAttributeItemIndexSlowCase):
* dom/Element.h:
(ElementData):
(WebCore::ElementData::isUnique):
(ShareableElementData):
(UniqueElementData):
(WebCore::Element::getAttributeItemIndex):
(WebCore::Element::elementData):
(Element):
(WebCore::Element::elementDataWithSynchronizedAttributes):
(WebCore::Element::ensureElementDataWithSynchronizedAttributes):
(WebCore::Element::fastHasAttribute):
(WebCore::Element::fastGetAttribute):
(WebCore::Element::hasAttributesWithoutUpdate):
(WebCore::Element::idForStyleResolution):
(WebCore::Element::classNames):
(WebCore::Element::attributeCount):
(WebCore::Element::attributeItem):
(WebCore::Element::getAttributeItem):
(WebCore::Element::updateInvalidAttributes):
(WebCore::Element::hasID):
(WebCore::Element::hasClass):
(WebCore::Element::ensureUniqueElementData):
(WebCore::ElementData::mutableAttributeVector):
(WebCore::ElementData::immutableAttributeArray):
(WebCore::ElementData::length):
(WebCore::ElementData::presentationAttributeStyle):
(WebCore::ElementData::getAttributeItem):
(WebCore::ElementData::getAttributeItemIndex):
(WebCore::ElementData::attributeItem):
* dom/Node.cpp:
(WebCore::Node::dumpStatistics):
(WebCore::Node::compareDocumentPosition):
* dom/StyledElement.cpp:
(WebCore::StyledElement::updateStyleAttribute):
(WebCore::StyledElement::ensureMutableInlineStyle):
(WebCore::StyledElement::attributeChanged):
(WebCore::StyledElement::inlineStyleCSSOMWrapper):
(WebCore::StyledElement::setInlineStyleFromString):
(WebCore::StyledElement::styleAttributeChanged):
(WebCore::StyledElement::inlineStyleChanged):
(WebCore::StyledElement::addSubresourceAttributeURLs):
(WebCore::StyledElement::rebuildPresentationAttributeStyle):
* dom/StyledElement.h:
(WebCore::StyledElement::inlineStyle):
(WebCore::StyledElement::invalidateStyleAttribute):
(WebCore::StyledElement::presentationAttributeStyle):
* html/ClassList.cpp:
(WebCore::ClassList::classNames):
* html/HTMLInputElement.cpp:
(WebCore::HTMLInputElement::updateType):
* html/parser/HTMLConstructionSite.cpp:
(WebCore::HTMLConstructionSite::mergeAttributesFromTokenIntoElement):
* svg/SVGElement.cpp:
(WebCore::SVGElement::updateAnimatedSVGAttribute):
* svg/SVGElement.h:
(WebCore::SVGElement::invalidateSVGAttributes):
* xml/parser/XMLDocumentParserQt.cpp:
(WebCore::XMLDocumentParser::XMLDocumentParser):

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

16 files changed:
Source/WebCore/ChangeLog
Source/WebCore/css/StyleResolver.cpp
Source/WebCore/dom/Attr.cpp
Source/WebCore/dom/DocumentSharedObjectPool.cpp
Source/WebCore/dom/DocumentSharedObjectPool.h
Source/WebCore/dom/Element.cpp
Source/WebCore/dom/Element.h
Source/WebCore/dom/Node.cpp
Source/WebCore/dom/StyledElement.cpp
Source/WebCore/dom/StyledElement.h
Source/WebCore/html/ClassList.cpp
Source/WebCore/html/HTMLInputElement.cpp
Source/WebCore/html/parser/HTMLConstructionSite.cpp
Source/WebCore/svg/SVGElement.cpp
Source/WebCore/svg/SVGElement.h
Source/WebCore/xml/parser/XMLDocumentParserQt.cpp

index 1fb8d4b..ac52ab8 100644 (file)
@@ -1,3 +1,147 @@
+2013-02-13  Andreas Kling  <akling@apple.com>
+
+        Better names for ElementAttributeData & subclasses.
+        <http://webkit.org/b/109529>
+
+        Reviewed by Antti Koivisto.
+
+        - ElementAttributeData => ElementData
+
+            Because ElementAttributeData won't be a good name once we move some non-attribute related
+            things to this structure.
+
+        - ImmutableElementAttributeData => ShareableElementData
+
+            These objects can be shared with other Elements that have the same attribute name/value pairs.
+
+        - MutableElementAttributeData => UniqueElementData
+
+            These objects contain data that is unique to a specific Element, and cannot be shared with
+            other Elements. This is what's important about it, not that its underlying storage is mutable.
+
+        - attributeData() -> elementData()
+        - updatedAttributeData() -> elementDataWithSynchronizedAttributes()
+        - ensureUpdatedAttributeData() -> ensureElementDataWithSynchronizedAttributes()
+        - mutableAttributeData() -> ensureUniqueElementData()
+
+            Ride-along renames. Much less vague than previous names IMO.
+
+        * css/StyleResolver.cpp:
+        (WebCore::StyleResolver::canShareStyleWithControl):
+        (WebCore::StyleResolver::sharingCandidateHasIdenticalStyleAffectingAttributes):
+        * dom/Attr.cpp:
+        (WebCore::Attr::elementAttribute):
+        * dom/DocumentSharedObjectPool.cpp:
+        (WebCore::ShareableElementDataCacheKey::ShareableElementDataCacheKey):
+        (WebCore::ShareableElementDataCacheKey::operator!=):
+        (WebCore::ShareableElementDataCacheEntry::ShareableElementDataCacheEntry):
+        (ShareableElementDataCacheEntry):
+        (WebCore::DocumentSharedObjectPool::cachedShareableElementDataWithAttributes):
+        * dom/DocumentSharedObjectPool.h:
+        (DocumentSharedObjectPool):
+        * dom/Element.cpp:
+        (WebCore::Element::detachAttribute):
+        (WebCore::Element::removeAttribute):
+        (WebCore::Element::attributes):
+        (WebCore::Element::getAttribute):
+        (WebCore::Element::setAttribute):
+        (WebCore::Element::setSynchronizedLazyAttribute):
+        (WebCore::Element::setAttributeInternal):
+        (WebCore::Element::attributeChanged):
+        (WebCore::Element::classAttributeChanged):
+        (WebCore::Element::shouldInvalidateDistributionWhenAttributeChanged):
+        (WebCore::Element::parserSetAttributes):
+        (WebCore::Element::hasAttributes):
+        (WebCore::Element::hasEquivalentAttributes):
+        (WebCore::Element::setAttributeNode):
+        (WebCore::Element::removeAttributeNode):
+        (WebCore::Element::removeAttributeInternal):
+        (WebCore::Element::addAttributeInternal):
+        (WebCore::Element::getAttributeNode):
+        (WebCore::Element::getAttributeNodeNS):
+        (WebCore::Element::hasAttribute):
+        (WebCore::Element::hasAttributeNS):
+        (WebCore::Element::computeInheritedLanguage):
+        (WebCore::Element::getURLAttribute):
+        (WebCore::Element::getNonEmptyURLAttribute):
+        (WebCore::Element::cloneAttributesFromElement):
+        (WebCore::Element::createUniqueElementData):
+        (WebCore::Element::reportMemoryUsage):
+        (WebCore::ElementData::deref):
+        (WebCore::ElementData::ElementData):
+        (WebCore::sizeForShareableElementDataWithAttributeCount):
+        (WebCore::ElementData::createShareableWithAttributes):
+        (WebCore::ElementData::createUnique):
+        (WebCore::ShareableElementData::ShareableElementData):
+        (WebCore::ShareableElementData::~ShareableElementData):
+        (WebCore::UniqueElementData::UniqueElementData):
+        (WebCore::ElementData::makeMutableCopy):
+        (WebCore::ElementData::makeImmutableCopy):
+        (WebCore::ElementData::setPresentationAttributeStyle):
+        (WebCore::ElementData::addAttribute):
+        (WebCore::ElementData::removeAttribute):
+        (WebCore::ElementData::isEquivalent):
+        (WebCore::ElementData::reportMemoryUsage):
+        (WebCore::ElementData::getAttributeItemIndexSlowCase):
+        * dom/Element.h:
+        (ElementData):
+        (WebCore::ElementData::isUnique):
+        (ShareableElementData):
+        (UniqueElementData):
+        (WebCore::Element::getAttributeItemIndex):
+        (WebCore::Element::elementData):
+        (Element):
+        (WebCore::Element::elementDataWithSynchronizedAttributes):
+        (WebCore::Element::ensureElementDataWithSynchronizedAttributes):
+        (WebCore::Element::fastHasAttribute):
+        (WebCore::Element::fastGetAttribute):
+        (WebCore::Element::hasAttributesWithoutUpdate):
+        (WebCore::Element::idForStyleResolution):
+        (WebCore::Element::classNames):
+        (WebCore::Element::attributeCount):
+        (WebCore::Element::attributeItem):
+        (WebCore::Element::getAttributeItem):
+        (WebCore::Element::updateInvalidAttributes):
+        (WebCore::Element::hasID):
+        (WebCore::Element::hasClass):
+        (WebCore::Element::ensureUniqueElementData):
+        (WebCore::ElementData::mutableAttributeVector):
+        (WebCore::ElementData::immutableAttributeArray):
+        (WebCore::ElementData::length):
+        (WebCore::ElementData::presentationAttributeStyle):
+        (WebCore::ElementData::getAttributeItem):
+        (WebCore::ElementData::getAttributeItemIndex):
+        (WebCore::ElementData::attributeItem):
+        * dom/Node.cpp:
+        (WebCore::Node::dumpStatistics):
+        (WebCore::Node::compareDocumentPosition):
+        * dom/StyledElement.cpp:
+        (WebCore::StyledElement::updateStyleAttribute):
+        (WebCore::StyledElement::ensureMutableInlineStyle):
+        (WebCore::StyledElement::attributeChanged):
+        (WebCore::StyledElement::inlineStyleCSSOMWrapper):
+        (WebCore::StyledElement::setInlineStyleFromString):
+        (WebCore::StyledElement::styleAttributeChanged):
+        (WebCore::StyledElement::inlineStyleChanged):
+        (WebCore::StyledElement::addSubresourceAttributeURLs):
+        (WebCore::StyledElement::rebuildPresentationAttributeStyle):
+        * dom/StyledElement.h:
+        (WebCore::StyledElement::inlineStyle):
+        (WebCore::StyledElement::invalidateStyleAttribute):
+        (WebCore::StyledElement::presentationAttributeStyle):
+        * html/ClassList.cpp:
+        (WebCore::ClassList::classNames):
+        * html/HTMLInputElement.cpp:
+        (WebCore::HTMLInputElement::updateType):
+        * html/parser/HTMLConstructionSite.cpp:
+        (WebCore::HTMLConstructionSite::mergeAttributesFromTokenIntoElement):
+        * svg/SVGElement.cpp:
+        (WebCore::SVGElement::updateAnimatedSVGAttribute):
+        * svg/SVGElement.h:
+        (WebCore::SVGElement::invalidateSVGAttributes):
+        * xml/parser/XMLDocumentParserQt.cpp:
+        (WebCore::XMLDocumentParser::XMLDocumentParser):
+
 2013-02-13  Christian Biesinger  <cbiesinger@chromium.org>
 
         Crash when encountering <object style="resize:both;">
index 1716ba9..53752f5 100644 (file)
@@ -907,7 +907,7 @@ bool StyleResolver::canShareStyleWithControl(StyledElement* element) const
     if (!thisInputElement || !otherInputElement)
         return false;
 
-    if (thisInputElement->attributeData() != otherInputElement->attributeData()) {
+    if (thisInputElement->elementData() != otherInputElement->elementData()) {
         if (thisInputElement->fastGetAttribute(typeAttr) != otherInputElement->fastGetAttribute(typeAttr))
             return false;
         if (thisInputElement->fastGetAttribute(readonlyAttr) != otherInputElement->fastGetAttribute(readonlyAttr))
@@ -957,7 +957,7 @@ static inline bool elementHasDirectionAuto(Element* element)
 bool StyleResolver::sharingCandidateHasIdenticalStyleAffectingAttributes(StyledElement* sharingCandidate) const
 {
     const State& state = m_state;
-    if (state.element()->attributeData() == sharingCandidate->attributeData())
+    if (state.element()->elementData() == sharingCandidate->elementData())
         return true;
     if (state.element()->fastGetAttribute(XMLNames::langAttr) != sharingCandidate->fastGetAttribute(XMLNames::langAttr))
         return false;
index 0cc1b33..b1301ba 100644 (file)
@@ -210,7 +210,7 @@ const AtomicString& Attr::value() const
 Attribute& Attr::elementAttribute()
 {
     ASSERT(m_element);
-    ASSERT(m_element->attributeData());
+    ASSERT(m_element->elementData());
     return *m_element->getAttributeItem(qualifiedName());
 }
 
index b169416..0af630c 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2012 Apple Inc. All Rights Reserved.
+ * Copyright (C) 2012, 2013 Apple Inc. All Rights Reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
 
 namespace WebCore {
 
-class ImmutableElementAttributeDataCacheKey {
+class ShareableElementDataCacheKey {
 public:
-    ImmutableElementAttributeDataCacheKey(const Attribute* attributes, unsigned attributeCount)
+    ShareableElementDataCacheKey(const Attribute* attributes, unsigned attributeCount)
         : m_attributes(attributes)
         , m_attributeCount(attributeCount)
     { }
 
-    bool operator!=(const ImmutableElementAttributeDataCacheKey& other) const
+    bool operator!=(const ShareableElementDataCacheKey& other) const
     {
         if (m_attributeCount != other.m_attributeCount)
             return true;
@@ -55,40 +55,40 @@ private:
     unsigned m_attributeCount;
 };
 
-class ImmutableElementAttributeDataCacheEntry {
+class ShareableElementDataCacheEntry {
 public:
-    ImmutableElementAttributeDataCacheEntry(const ImmutableElementAttributeDataCacheKey& k, PassRefPtr<ElementAttributeData> v)
+    ShareableElementDataCacheEntry(const ShareableElementDataCacheKey& k, PassRefPtr<ElementData> v)
         : key(k)
         , value(v)
     { }
 
-    ImmutableElementAttributeDataCacheKey key;
-    RefPtr<ElementAttributeData> value;
+    ShareableElementDataCacheKey key;
+    RefPtr<ElementData> value;
 };
 
-PassRefPtr<ElementAttributeData> DocumentSharedObjectPool::cachedImmutableElementAttributeData(const Vector<Attribute>& attributes)
+PassRefPtr<ElementData> DocumentSharedObjectPool::cachedShareableElementDataWithAttributes(const Vector<Attribute>& attributes)
 {
     ASSERT(!attributes.isEmpty());
 
-    ImmutableElementAttributeDataCacheKey cacheKey(attributes.data(), attributes.size());
+    ShareableElementDataCacheKey cacheKey(attributes.data(), attributes.size());
     unsigned cacheHash = cacheKey.hash();
 
-    ImmutableElementAttributeDataCache::iterator cacheIterator = m_immutableElementAttributeDataCache.add(cacheHash, nullptr).iterator;
+    ShareableElementDataCache::iterator cacheIterator = m_shareableElementDataCache.add(cacheHash, nullptr).iterator;
     if (cacheIterator->value && cacheIterator->value->key != cacheKey)
         cacheHash = 0;
 
-    RefPtr<ElementAttributeData> attributeData;
+    RefPtr<ElementData> elementData;
     if (cacheHash && cacheIterator->value)
-        attributeData = cacheIterator->value->value;
+        elementData = cacheIterator->value->value;
     else
-        attributeData = ElementAttributeData::createImmutable(attributes);
+        elementData = ElementData::createShareableWithAttributes(attributes);
 
     if (!cacheHash || cacheIterator->value)
-        return attributeData.release();
+        return elementData.release();
 
-    cacheIterator->value = adoptPtr(new ImmutableElementAttributeDataCacheEntry(ImmutableElementAttributeDataCacheKey(attributeData->immutableAttributeArray(), attributeData->length()), attributeData));
+    cacheIterator->value = adoptPtr(new ShareableElementDataCacheEntry(ShareableElementDataCacheKey(elementData->immutableAttributeArray(), elementData->length()), elementData));
 
-    return attributeData.release();
+    return elementData.release();
 }
 
 DocumentSharedObjectPool::DocumentSharedObjectPool()
index 540c913..0ef056c 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2012 Apple Inc. All Rights Reserved.
+ * Copyright (C) 2012, 2013 Apple Inc. All Rights Reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
 namespace WebCore {
 
 class Attribute;
-class ElementAttributeData;
-class ImmutableElementAttributeDataCacheEntry;
+class ElementData;
+class ShareableElementDataCacheEntry;
 
 class DocumentSharedObjectPool {
 public:
     static PassOwnPtr<DocumentSharedObjectPool> create() { return adoptPtr(new DocumentSharedObjectPool); }
     ~DocumentSharedObjectPool();
 
-    PassRefPtr<ElementAttributeData> cachedImmutableElementAttributeData(const Vector<Attribute>&);
+    PassRefPtr<ElementData> cachedShareableElementDataWithAttributes(const Vector<Attribute>&);
 
 private:
     DocumentSharedObjectPool();
 
-    typedef HashMap<unsigned, OwnPtr<ImmutableElementAttributeDataCacheEntry>, AlreadyHashed> ImmutableElementAttributeDataCache;
-    ImmutableElementAttributeDataCache m_immutableElementAttributeDataCache;
+    typedef HashMap<unsigned, OwnPtr<ShareableElementDataCacheEntry>, AlreadyHashed> ShareableElementDataCache;
+    ShareableElementDataCache m_shareableElementDataCache;
 };
 
 }
index 950518d..c75271c 100644 (file)
@@ -276,9 +276,9 @@ PassRefPtr<Element> Element::cloneElementWithoutAttributesAndChildren()
 
 PassRefPtr<Attr> Element::detachAttribute(size_t index)
 {
-    ASSERT(attributeData());
+    ASSERT(elementData());
 
-    const Attribute* attribute = attributeData()->attributeItem(index);
+    const Attribute* attribute = elementData()->attributeItem(index);
     ASSERT(attribute);
 
     RefPtr<Attr> attrNode = attrIfExists(attribute->name());
@@ -293,10 +293,10 @@ PassRefPtr<Attr> Element::detachAttribute(size_t index)
 
 void Element::removeAttribute(const QualifiedName& name)
 {
-    if (!attributeData())
+    if (!elementData())
         return;
 
-    size_t index = attributeData()->getAttributeItemIndex(name);
+    size_t index = elementData()->getAttributeItemIndex(name);
     if (index == notFound)
         return;
 
@@ -313,7 +313,7 @@ void Element::setBooleanAttribute(const QualifiedName& name, bool value)
 
 NamedNodeMap* Element::attributes() const
 {
-    ensureUpdatedAttributeData();
+    ensureElementDataWithSynchronizedAttributes();
     ElementRareData* rareData = const_cast<Element*>(this)->ensureElementRareData();
     if (NamedNodeMap* attributeMap = rareData->attributeMap())
         return attributeMap;
@@ -334,14 +334,14 @@ bool Element::hasAttribute(const QualifiedName& name) const
 
 const AtomicString& Element::getAttribute(const QualifiedName& name) const
 {
-    if (!attributeData())
+    if (!elementData())
         return nullAtom;
 
-    if (UNLIKELY(name == styleAttr && attributeData()->m_styleAttributeIsDirty))
+    if (UNLIKELY(name == styleAttr && elementData()->m_styleAttributeIsDirty))
         updateStyleAttribute();
 
 #if ENABLE(SVG)
-    if (UNLIKELY(attributeData()->m_animatedSVGAttributesAreDirty))
+    if (UNLIKELY(elementData()->m_animatedSVGAttributesAreDirty))
         updateAnimatedSVGAttribute(name);
 #endif
 
@@ -706,23 +706,23 @@ static inline bool shouldIgnoreAttributeCase(const Element* e)
 
 const AtomicString& Element::getAttribute(const AtomicString& name) const
 {
-    if (!attributeData())
+    if (!elementData())
         return nullAtom;
 
     bool ignoreCase = shouldIgnoreAttributeCase(this);
 
     // Update the 'style' attribute if it's invalid and being requested:
-    if (attributeData()->m_styleAttributeIsDirty && equalPossiblyIgnoringCase(name, styleAttr.localName(), ignoreCase))
+    if (elementData()->m_styleAttributeIsDirty && equalPossiblyIgnoringCase(name, styleAttr.localName(), ignoreCase))
         updateStyleAttribute();
 
 #if ENABLE(SVG)
-    if (attributeData()->m_animatedSVGAttributesAreDirty) {
+    if (elementData()->m_animatedSVGAttributesAreDirty) {
         // We're not passing a namespace argument on purpose. SVGNames::*Attr are defined w/o namespaces as well.
         updateAnimatedSVGAttribute(QualifiedName(nullAtom, name, nullAtom));
     }
 #endif
 
-    if (const Attribute* attribute = attributeData()->getAttributeItem(name, ignoreCase))
+    if (const Attribute* attribute = elementData()->getAttributeItem(name, ignoreCase))
         return attribute->value();
     return nullAtom;
 }
@@ -741,19 +741,19 @@ void Element::setAttribute(const AtomicString& name, const AtomicString& value,
 
     const AtomicString& localName = shouldIgnoreAttributeCase(this) ? name.lower() : name;
 
-    size_t index = ensureUpdatedAttributeData()->getAttributeItemIndex(localName, false);
+    size_t index = ensureElementDataWithSynchronizedAttributes()->getAttributeItemIndex(localName, false);
     const QualifiedName& qName = index != notFound ? attributeItem(index)->name() : QualifiedName(nullAtom, localName, nullAtom);
     setAttributeInternal(index, qName, value, NotInSynchronizationOfLazyAttribute);
 }
 
 void Element::setAttribute(const QualifiedName& name, const AtomicString& value)
 {
-    setAttributeInternal(ensureUpdatedAttributeData()->getAttributeItemIndex(name), name, value, NotInSynchronizationOfLazyAttribute);
+    setAttributeInternal(ensureElementDataWithSynchronizedAttributes()->getAttributeItemIndex(name), name, value, NotInSynchronizationOfLazyAttribute);
 }
 
 void Element::setSynchronizedLazyAttribute(const QualifiedName& name, const AtomicString& value)
 {
-    setAttributeInternal(mutableAttributeData()->getAttributeItemIndex(name), name, value, InSynchronizationOfLazyAttribute);
+    setAttributeInternal(ensureUniqueElementData()->getAttributeItemIndex(name), name, value, InSynchronizationOfLazyAttribute);
 }
 
 inline void Element::setAttributeInternal(size_t index, const QualifiedName& name, const AtomicString& newValue, SynchronizationOfLazyAttribute inSynchronizationOfLazyAttribute)
@@ -774,12 +774,12 @@ inline void Element::setAttributeInternal(size_t index, const QualifiedName& nam
 
     if (newValue != attributeItem(index)->value()) {
         // If there is an Attr node hooked to this attribute, the Attr::setValue() call below
-        // will write into the ElementAttributeData.
+        // will write into the ElementData.
         // FIXME: Refactor this so it makes some sense.
         if (RefPtr<Attr> attrNode = inSynchronizationOfLazyAttribute ? 0 : attrIfExists(name))
             attrNode->setValue(newValue);
         else
-            mutableAttributeData()->attributeItem(index)->setValue(newValue);
+            ensureUniqueElementData()->attributeItem(index)->setValue(newValue);
     }
 
     if (!inSynchronizationOfLazyAttribute)
@@ -819,10 +819,10 @@ void Element::attributeChanged(const QualifiedName& name, const AtomicString& ne
     bool shouldInvalidateStyle = false;
 
     if (isIdAttributeName(name)) {
-        AtomicString oldId = attributeData()->idForStyleResolution();
+        AtomicString oldId = elementData()->idForStyleResolution();
         AtomicString newId = makeIdForStyleResolution(newValue, document()->inQuirksMode());
         if (newId != oldId) {
-            attributeData()->setIdForStyleResolution(newId);
+            elementData()->setIdForStyleResolution(newId);
             shouldInvalidateStyle = testShouldInvalidateStyle && checkNeedsStyleInvalidationForIdChange(oldId, newId, styleResolver);
         }
     } else if (name == classAttr)
@@ -922,14 +922,14 @@ void Element::classAttributeChanged(const AtomicString& newClassString)
 
     if (classStringHasClassName(newClassString)) {
         const bool shouldFoldCase = document()->inQuirksMode();
-        const SpaceSplitString oldClasses = attributeData()->classNames();
-        attributeData()->setClass(newClassString, shouldFoldCase);
-        const SpaceSplitString& newClasses = attributeData()->classNames();
+        const SpaceSplitString oldClasses = elementData()->classNames();
+        elementData()->setClass(newClassString, shouldFoldCase);
+        const SpaceSplitString& newClasses = elementData()->classNames();
         shouldInvalidateStyle = testShouldInvalidateStyle && checkSelectorForClassChange(oldClasses, newClasses, *styleResolver);
     } else {
-        const SpaceSplitString& oldClasses = attributeData()->classNames();
+        const SpaceSplitString& oldClasses = elementData()->classNames();
         shouldInvalidateStyle = testShouldInvalidateStyle && checkSelectorForClassChange(oldClasses, *styleResolver);
-        attributeData()->clearClass();
+        elementData()->clearClass();
     }
 
     if (hasRareData())
@@ -945,7 +945,7 @@ bool Element::shouldInvalidateDistributionWhenAttributeChanged(ElementShadow* el
     const SelectRuleFeatureSet& featureSet = elementShadow->distributor().ensureSelectFeatureSet(elementShadow);
 
     if (isIdAttributeName(name)) {
-        AtomicString oldId = attributeData()->idForStyleResolution();
+        AtomicString oldId = elementData()->idForStyleResolution();
         AtomicString newId = makeIdForStyleResolution(newValue, document()->inQuirksMode());
         if (newId != oldId) {
             if (!oldId.isEmpty() && featureSet.hasSelectorForId(oldId))
@@ -959,12 +959,12 @@ bool Element::shouldInvalidateDistributionWhenAttributeChanged(ElementShadow* el
         const AtomicString& newClassString = newValue;
         if (classStringHasClassName(newClassString)) {
             const bool shouldFoldCase = document()->inQuirksMode();
-            const SpaceSplitString& oldClasses = attributeData()->classNames();
+            const SpaceSplitString& oldClasses = elementData()->classNames();
             const SpaceSplitString newClasses(newClassString, shouldFoldCase);
             if (checkSelectorForClassChange(oldClasses, newClasses, featureSet))
                 return true;
         } else {
-            const SpaceSplitString& oldClasses = attributeData()->classNames();
+            const SpaceSplitString& oldClasses = elementData()->classNames();
             if (checkSelectorForClassChange(oldClasses, featureSet))
                 return true;
         }
@@ -995,7 +995,7 @@ void Element::parserSetAttributes(const Vector<Attribute>& attributeVector, Frag
     ASSERT(!inDocument());
     ASSERT(!parentNode());
 
-    ASSERT(!m_attributeData);
+    ASSERT(!m_elementData);
 
     if (attributeVector.isEmpty())
         return;
@@ -1020,12 +1020,12 @@ void Element::parserSetAttributes(const Vector<Attribute>& attributeVector, Frag
     }
 
     if (document() && document()->sharedObjectPool())
-        m_attributeData = document()->sharedObjectPool()->cachedImmutableElementAttributeData(filteredAttributes);
+        m_elementData = document()->sharedObjectPool()->cachedShareableElementDataWithAttributes(filteredAttributes);
     else
-        m_attributeData = ElementAttributeData::createImmutable(filteredAttributes);
+        m_elementData = ElementData::createShareableWithAttributes(filteredAttributes);
 
     // Iterate over the set of attributes we already have on the stack in case
-    // attributeChanged mutates m_attributeData.
+    // attributeChanged mutates m_elementData.
     // FIXME: Find a way so we don't have to do this.
     for (unsigned i = 0; i < filteredAttributes.size(); ++i)
         attributeChanged(filteredAttributes[i].name(), filteredAttributes[i].value());
@@ -1034,19 +1034,19 @@ void Element::parserSetAttributes(const Vector<Attribute>& attributeVector, Frag
 bool Element::hasAttributes() const
 {
     updateInvalidAttributes();
-    return attributeData() && attributeData()->length();
+    return elementData() && elementData()->length();
 }
 
 bool Element::hasEquivalentAttributes(const Element* other) const
 {
-    const ElementAttributeData* attributeData = updatedAttributeData();
-    const ElementAttributeData* otherAttributeData = other->updatedAttributeData();
-    if (attributeData == otherAttributeData)
+    const ElementData* elementData = elementDataWithSynchronizedAttributes();
+    const ElementData* otherElementData = other->elementDataWithSynchronizedAttributes();
+    if (elementData == otherElementData)
         return true;
-    if (attributeData)
-        return attributeData->isEquivalent(otherAttributeData);
-    if (otherAttributeData)
-        return otherAttributeData->isEquivalent(attributeData);
+    if (elementData)
+        return elementData->isEquivalent(otherElementData);
+    if (otherElementData)
+        return otherElementData->isEquivalent(elementData);
     return true;
 }
 
@@ -1687,14 +1687,14 @@ PassRefPtr<Attr> Element::setAttributeNode(Attr* attrNode, ExceptionCode& ec)
     }
 
     updateInvalidAttributes();
-    ElementAttributeData* attributeData = mutableAttributeData();
+    ElementData* elementData = ensureUniqueElementData();
 
-    size_t index = attributeData->getAttributeItemIndex(attrNode->qualifiedName());
+    size_t index = elementData->getAttributeItemIndex(attrNode->qualifiedName());
     if (index != notFound) {
         if (oldAttrNode)
-            detachAttrNodeFromElementWithValue(oldAttrNode.get(), attributeData->attributeItem(index)->value());
+            detachAttrNodeFromElementWithValue(oldAttrNode.get(), elementData->attributeItem(index)->value());
         else
-            oldAttrNode = Attr::create(document(), attrNode->qualifiedName(), attributeData->attributeItem(index)->value());
+            oldAttrNode = Attr::create(document(), attrNode->qualifiedName(), elementData->attributeItem(index)->value());
     }
 
     setAttributeInternal(index, attrNode->qualifiedName(), attrNode->value(), NotInSynchronizationOfLazyAttribute);
@@ -1723,10 +1723,10 @@ PassRefPtr<Attr> Element::removeAttributeNode(Attr* attr, ExceptionCode& ec)
 
     ASSERT(document() == attr->document());
 
-    const ElementAttributeData* attributeData = updatedAttributeData();
-    ASSERT(attributeData);
+    const ElementData* elementData = elementDataWithSynchronizedAttributes();
+    ASSERT(elementData);
 
-    size_t index = attributeData->getAttributeItemIndex(attr->qualifiedName());
+    size_t index = elementData->getAttributeItemIndex(attr->qualifiedName());
     if (index == notFound) {
         ec = NOT_FOUND_ERR;
         return 0;
@@ -1765,10 +1765,10 @@ void Element::removeAttributeInternal(size_t index, SynchronizationOfLazyAttribu
 {
     ASSERT_WITH_SECURITY_IMPLICATION(index < attributeCount());
 
-    ElementAttributeData* attributeData = mutableAttributeData();
+    ElementData* elementData = ensureUniqueElementData();
 
-    QualifiedName name = attributeData->attributeItem(index)->name();
-    AtomicString valueBeingRemoved = attributeData->attributeItem(index)->value();
+    QualifiedName name = elementData->attributeItem(index)->name();
+    AtomicString valueBeingRemoved = elementData->attributeItem(index)->value();
 
     if (!inSynchronizationOfLazyAttribute) {
         if (!valueBeingRemoved.isNull())
@@ -1776,9 +1776,9 @@ void Element::removeAttributeInternal(size_t index, SynchronizationOfLazyAttribu
     }
 
     if (RefPtr<Attr> attrNode = attrIfExists(name))
-        detachAttrNodeFromElementWithValue(attrNode.get(), attributeData->attributeItem(index)->value());
+        detachAttrNodeFromElementWithValue(attrNode.get(), elementData->attributeItem(index)->value());
 
-    attributeData->removeAttribute(index);
+    elementData->removeAttribute(index);
 
     if (!inSynchronizationOfLazyAttribute)
         didRemoveAttribute(name);
@@ -1788,20 +1788,20 @@ void Element::addAttributeInternal(const QualifiedName& name, const AtomicString
 {
     if (!inSynchronizationOfLazyAttribute)
         willModifyAttribute(name, nullAtom, value);
-    mutableAttributeData()->addAttribute(Attribute(name, value));
+    ensureUniqueElementData()->addAttribute(Attribute(name, value));
     if (!inSynchronizationOfLazyAttribute)
         didAddAttribute(name, value);
 }
 
 void Element::removeAttribute(const AtomicString& name)
 {
-    if (!attributeData())
+    if (!elementData())
         return;
 
     AtomicString localName = shouldIgnoreAttributeCase(this) ? name.lower() : name;
-    size_t index = attributeData()->getAttributeItemIndex(localName, false);
+    size_t index = elementData()->getAttributeItemIndex(localName, false);
     if (index == notFound) {
-        if (UNLIKELY(localName == styleAttr) && attributeData()->m_styleAttributeIsDirty && isStyledElement())
+        if (UNLIKELY(localName == styleAttr) && elementData()->m_styleAttributeIsDirty && isStyledElement())
             static_cast<StyledElement*>(this)->removeAllInlineStyleProperties();
         return;
     }
@@ -1816,10 +1816,10 @@ void Element::removeAttributeNS(const AtomicString& namespaceURI, const AtomicSt
 
 PassRefPtr<Attr> Element::getAttributeNode(const AtomicString& name)
 {
-    const ElementAttributeData* attributeData = updatedAttributeData();
-    if (!attributeData)
+    const ElementData* elementData = elementDataWithSynchronizedAttributes();
+    if (!elementData)
         return 0;
-    const Attribute* attribute = attributeData->getAttributeItem(name, shouldIgnoreAttributeCase(this));
+    const Attribute* attribute = elementData->getAttributeItem(name, shouldIgnoreAttributeCase(this));
     if (!attribute)
         return 0;
     return ensureAttr(attribute->name());
@@ -1827,10 +1827,10 @@ PassRefPtr<Attr> Element::getAttributeNode(const AtomicString& name)
 
 PassRefPtr<Attr> Element::getAttributeNodeNS(const AtomicString& namespaceURI, const AtomicString& localName)
 {
-    const ElementAttributeData* attributeData = updatedAttributeData();
-    if (!attributeData)
+    const ElementData* elementData = elementDataWithSynchronizedAttributes();
+    if (!elementData)
         return 0;
-    const Attribute* attribute = attributeData->getAttributeItem(QualifiedName(nullAtom, localName, namespaceURI));
+    const Attribute* attribute = elementData->getAttributeItem(QualifiedName(nullAtom, localName, namespaceURI));
     if (!attribute)
         return 0;
     return ensureAttr(attribute->name());
@@ -1838,21 +1838,21 @@ PassRefPtr<Attr> Element::getAttributeNodeNS(const AtomicString& namespaceURI, c
 
 bool Element::hasAttribute(const AtomicString& name) const
 {
-    if (!attributeData())
+    if (!elementData())
         return false;
 
     // This call to String::lower() seems to be required but
     // there may be a way to remove it.
     AtomicString localName = shouldIgnoreAttributeCase(this) ? name.lower() : name;
-    return updatedAttributeData()->getAttributeItem(localName, false);
+    return elementDataWithSynchronizedAttributes()->getAttributeItem(localName, false);
 }
 
 bool Element::hasAttributeNS(const AtomicString& namespaceURI, const AtomicString& localName) const
 {
-    const ElementAttributeData* attributeData = updatedAttributeData();
-    if (!attributeData)
+    const ElementData* elementData = elementDataWithSynchronizedAttributes();
+    if (!elementData)
         return false;
-    return attributeData->getAttributeItem(QualifiedName(nullAtom, localName, namespaceURI));
+    return elementData->getAttributeItem(QualifiedName(nullAtom, localName, namespaceURI));
 }
 
 CSSStyleDeclaration *Element::style()
@@ -2159,11 +2159,11 @@ AtomicString Element::computeInheritedLanguage() const
     // The language property is inherited, so we iterate over the parents to find the first language.
     do {
         if (n->isElementNode()) {
-            if (const ElementAttributeData* attributeData = static_cast<const Element*>(n)->attributeData()) {
+            if (const ElementData* elementData = static_cast<const Element*>(n)->elementData()) {
                 // Spec: xml:lang takes precedence -- http://www.w3.org/TR/xhtml1/#C_7
-                if (const Attribute* attribute = attributeData->getAttributeItem(XMLNames::langAttr))
+                if (const Attribute* attribute = elementData->getAttributeItem(XMLNames::langAttr))
                     value = attribute->value();
-                else if (const Attribute* attribute = attributeData->getAttributeItem(HTMLNames::langAttr))
+                else if (const Attribute* attribute = elementData->getAttributeItem(HTMLNames::langAttr))
                     value = attribute->value();
             }
         } else if (n->isDocumentNode()) {
@@ -2327,7 +2327,7 @@ DOMStringMap* Element::dataset()
 KURL Element::getURLAttribute(const QualifiedName& name) const
 {
 #if !ASSERT_DISABLED
-    if (attributeData()) {
+    if (elementData()) {
         if (const Attribute* attribute = getAttributeItem(name))
             ASSERT(isURLAttribute(*attribute));
     }
@@ -2338,7 +2338,7 @@ KURL Element::getURLAttribute(const QualifiedName& name) const
 KURL Element::getNonEmptyURLAttribute(const QualifiedName& name) const
 {
 #if !ASSERT_DISABLED
-    if (attributeData()) {
+    if (elementData()) {
         if (const Attribute* attribute = getAttributeItem(name))
             ASSERT(isURLAttribute(*attribute));
     }
@@ -2745,8 +2745,8 @@ void Element::cloneAttributesFromElement(const Element& other)
         detachAllAttrNodesFromElement();
 
     other.updateInvalidAttributes();
-    if (!other.m_attributeData) {
-        m_attributeData.clear();
+    if (!other.m_elementData) {
+        m_elementData.clear();
         return;
     }
 
@@ -2762,20 +2762,20 @@ void Element::cloneAttributesFromElement(const Element& other)
     if (!oldName.isNull() || !newName.isNull())
         updateName(oldName, newName);
 
-    // If 'other' has a mutable ElementAttributeData, convert it to an immutable one so we can share it between both elements.
+    // If 'other' has a mutable ElementData, convert it to an immutable one so we can share it between both elements.
     // We can only do this if there is no CSSOM wrapper for other's inline style, and there are no presentation attributes.
-    if (other.m_attributeData->isMutable()
-        && !other.m_attributeData->presentationAttributeStyle()
-        && (!other.m_attributeData->inlineStyle() || !other.m_attributeData->inlineStyle()->hasCSSOMWrapper()))
-        const_cast<Element&>(other).m_attributeData = other.m_attributeData->makeImmutableCopy();
+    if (other.m_elementData->isUnique()
+        && !other.m_elementData->presentationAttributeStyle()
+        && (!other.m_elementData->inlineStyle() || !other.m_elementData->inlineStyle()->hasCSSOMWrapper()))
+        const_cast<Element&>(other).m_elementData = other.m_elementData->makeShareableCopy();
 
-    if (!other.m_attributeData->isMutable())
-        m_attributeData = other.m_attributeData;
+    if (!other.m_elementData->isUnique())
+        m_elementData = other.m_elementData;
     else
-        m_attributeData = other.m_attributeData->makeMutableCopy();
+        m_elementData = other.m_elementData->makeUniqueCopy();
 
-    for (unsigned i = 0; i < m_attributeData->length(); ++i) {
-        const Attribute* attribute = const_cast<const ElementAttributeData*>(m_attributeData.get())->attributeItem(i);
+    for (unsigned i = 0; i < m_elementData->length(); ++i) {
+        const Attribute* attribute = const_cast<const ElementData*>(m_elementData.get())->attributeItem(i);
         attributeChanged(attribute->name(), attribute->value());
     }
 }
@@ -2786,12 +2786,12 @@ void Element::cloneDataFromElement(const Element& other)
     copyNonAttributePropertiesFromElement(other);
 }
 
-void Element::createMutableAttributeData()
+void Element::createUniqueElementData()
 {
-    if (!m_attributeData)
-        m_attributeData = ElementAttributeData::create();
+    if (!m_elementData)
+        m_elementData = ElementData::createUnique();
     else
-        m_attributeData = m_attributeData->makeMutableCopy();
+        m_elementData = m_elementData->makeUniqueCopy();
 }
 
 void Element::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
@@ -2799,7 +2799,7 @@ void Element::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
     MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::DOM);
     ContainerNode::reportMemoryUsage(memoryObjectInfo);
     info.addMember(m_tagName, "tagName");
-    info.addMember(m_attributeData, "attributeData");
+    info.addMember(m_elementData, "elementData");
 }
 
 #if ENABLE(SVG)
@@ -2819,19 +2819,19 @@ void Element::clearHasPendingResources()
 }
 #endif
 
-void ElementAttributeData::deref()
+void ElementData::deref()
 {
     if (!derefBase())
         return;
 
-    if (m_isMutable)
-        delete static_cast<MutableElementAttributeData*>(this);
+    if (m_isUnique)
+        delete static_cast<UniqueElementData*>(this);
     else
-        delete static_cast<ImmutableElementAttributeData*>(this);
+        delete static_cast<ShareableElementData*>(this);
 }
 
-ElementAttributeData::ElementAttributeData()
-    : m_isMutable(true)
+ElementData::ElementData()
+    : m_isUnique(true)
     , m_arraySize(0)
     , m_presentationAttributeStyleIsDirty(false)
     , m_styleAttributeIsDirty(false)
@@ -2841,8 +2841,8 @@ ElementAttributeData::ElementAttributeData()
 {
 }
 
-ElementAttributeData::ElementAttributeData(unsigned arraySize)
-    : m_isMutable(false)
+ElementData::ElementData(unsigned arraySize)
+    : m_isUnique(false)
     , m_arraySize(arraySize)
     , m_presentationAttributeStyleIsDirty(false)
     , m_styleAttributeIsDirty(false)
@@ -2852,44 +2852,44 @@ ElementAttributeData::ElementAttributeData(unsigned arraySize)
 {
 }
 
-struct SameSizeAsElementAttributeData : public RefCounted<SameSizeAsElementAttributeData> {
+struct SameSizeAsElementData : public RefCounted<SameSizeAsElementData> {
     unsigned bitfield;
     void* refPtrs[3];
 };
 
-COMPILE_ASSERT(sizeof(ElementAttributeData) == sizeof(SameSizeAsElementAttributeData), element_attribute_data_should_stay_small);
+COMPILE_ASSERT(sizeof(ElementData) == sizeof(SameSizeAsElementData), element_attribute_data_should_stay_small);
 
-static size_t sizeForImmutableElementAttributeDataWithAttributeCount(unsigned count)
+static size_t sizeForShareableElementDataWithAttributeCount(unsigned count)
 {
-    return sizeof(ImmutableElementAttributeData) - sizeof(void*) + sizeof(Attribute) * count;
+    return sizeof(ShareableElementData) - sizeof(void*) + sizeof(Attribute) * count;
 }
 
-PassRefPtr<ElementAttributeData> ElementAttributeData::createImmutable(const Vector<Attribute>& attributes)
+PassRefPtr<ElementData> ElementData::createShareableWithAttributes(const Vector<Attribute>& attributes)
 {
-    void* slot = WTF::fastMalloc(sizeForImmutableElementAttributeDataWithAttributeCount(attributes.size()));
-    return adoptRef(new (slot) ImmutableElementAttributeData(attributes));
+    void* slot = WTF::fastMalloc(sizeForShareableElementDataWithAttributeCount(attributes.size()));
+    return adoptRef(new (slot) ShareableElementData(attributes));
 }
 
-PassRefPtr<ElementAttributeData> ElementAttributeData::create()
+PassRefPtr<ElementData> ElementData::createUnique()
 {
-    return adoptRef(new MutableElementAttributeData);
+    return adoptRef(new UniqueElementData);
 }
 
-ImmutableElementAttributeData::ImmutableElementAttributeData(const Vector<Attribute>& attributes)
-    : ElementAttributeData(attributes.size())
+ShareableElementData::ShareableElementData(const Vector<Attribute>& attributes)
+    : ElementData(attributes.size())
 {
     for (unsigned i = 0; i < m_arraySize; ++i)
         new (&reinterpret_cast<Attribute*>(&m_attributeArray)[i]) Attribute(attributes[i]);
 }
 
-ImmutableElementAttributeData::~ImmutableElementAttributeData()
+ShareableElementData::~ShareableElementData()
 {
     for (unsigned i = 0; i < m_arraySize; ++i)
         (reinterpret_cast<Attribute*>(&m_attributeArray)[i]).~Attribute();
 }
 
-ImmutableElementAttributeData::ImmutableElementAttributeData(const MutableElementAttributeData& other)
-    : ElementAttributeData(other, false)
+ShareableElementData::ShareableElementData(const UniqueElementData& other)
+    : ElementData(other, false)
 {
     ASSERT(!other.m_presentationAttributeStyle);
 
@@ -2902,9 +2902,9 @@ ImmutableElementAttributeData::ImmutableElementAttributeData(const MutableElemen
         new (&reinterpret_cast<Attribute*>(&m_attributeArray)[i]) Attribute(*other.attributeItem(i));
 }
 
-ElementAttributeData::ElementAttributeData(const ElementAttributeData& other, bool isMutable)
-    : m_isMutable(isMutable)
-    , m_arraySize(isMutable ? 0 : other.length())
+ElementData::ElementData(const ElementData& other, bool isUnique)
+    : m_isUnique(isUnique)
+    , m_arraySize(isUnique ? 0 : other.length())
     , m_presentationAttributeStyleIsDirty(other.m_presentationAttributeStyleIsDirty)
     , m_styleAttributeIsDirty(other.m_styleAttributeIsDirty)
 #if ENABLE(SVG)
@@ -2916,22 +2916,22 @@ ElementAttributeData::ElementAttributeData(const ElementAttributeData& other, bo
     // NOTE: The inline style is copied by the subclass copy constructor since we don't know what to do with it here.
 }
 
-MutableElementAttributeData::MutableElementAttributeData()
+UniqueElementData::UniqueElementData()
 {
 }
 
-MutableElementAttributeData::MutableElementAttributeData(const MutableElementAttributeData& other)
-    : ElementAttributeData(other, true)
+UniqueElementData::UniqueElementData(const UniqueElementData& other)
+    : ElementData(other, true)
     , m_presentationAttributeStyle(other.m_presentationAttributeStyle)
     , m_attributeVector(other.m_attributeVector)
 {
     m_inlineStyle = other.m_inlineStyle ? other.m_inlineStyle->copy() : 0;
 }
 
-MutableElementAttributeData::MutableElementAttributeData(const ImmutableElementAttributeData& other)
-    : ElementAttributeData(other, true)
+UniqueElementData::UniqueElementData(const ShareableElementData& other)
+    : ElementData(other, true)
 {
-    // An ImmutableElementAttributeData should never have a mutable inline StylePropertySet attached.
+    // An ShareableElementData should never have a mutable inline StylePropertySet attached.
     ASSERT(!other.m_inlineStyle || !other.m_inlineStyle->isMutable());
     m_inlineStyle = other.m_inlineStyle;
 
@@ -2940,40 +2940,40 @@ MutableElementAttributeData::MutableElementAttributeData(const ImmutableElementA
         m_attributeVector.uncheckedAppend(other.immutableAttributeArray()[i]);
 }
 
-PassRefPtr<ElementAttributeData> ElementAttributeData::makeMutableCopy() const
+PassRefPtr<ElementData> ElementData::makeUniqueCopy() const
 {
-    if (isMutable())
-        return adoptRef(new MutableElementAttributeData(static_cast<const MutableElementAttributeData&>(*this)));
-    return adoptRef(new MutableElementAttributeData(static_cast<const ImmutableElementAttributeData&>(*this)));
+    if (isUnique())
+        return adoptRef(new UniqueElementData(static_cast<const UniqueElementData&>(*this)));
+    return adoptRef(new UniqueElementData(static_cast<const ShareableElementData&>(*this)));
 }
 
-PassRefPtr<ElementAttributeData> ElementAttributeData::makeImmutableCopy() const
+PassRefPtr<ElementData> ElementData::makeShareableCopy() const
 {
-    ASSERT(isMutable());
-    void* slot = WTF::fastMalloc(sizeForImmutableElementAttributeDataWithAttributeCount(mutableAttributeVector().size()));
-    return adoptRef(new (slot) ImmutableElementAttributeData(static_cast<const MutableElementAttributeData&>(*this)));
+    ASSERT(isUnique());
+    void* slot = WTF::fastMalloc(sizeForShareableElementDataWithAttributeCount(mutableAttributeVector().size()));
+    return adoptRef(new (slot) ShareableElementData(static_cast<const UniqueElementData&>(*this)));
 }
 
-void ElementAttributeData::setPresentationAttributeStyle(PassRefPtr<StylePropertySet> style) const
+void ElementData::setPresentationAttributeStyle(PassRefPtr<StylePropertySet> style) const
 {
-    ASSERT(m_isMutable);
-    static_cast<const MutableElementAttributeData*>(this)->m_presentationAttributeStyle = style;
+    ASSERT(m_isUnique);
+    static_cast<const UniqueElementData*>(this)->m_presentationAttributeStyle = style;
 }
 
-void ElementAttributeData::addAttribute(const Attribute& attribute)
+void ElementData::addAttribute(const Attribute& attribute)
 {
-    ASSERT(isMutable());
+    ASSERT(isUnique());
     mutableAttributeVector().append(attribute);
 }
 
-void ElementAttributeData::removeAttribute(size_t index)
+void ElementData::removeAttribute(size_t index)
 {
-    ASSERT(isMutable());
+    ASSERT(isUnique());
     ASSERT_WITH_SECURITY_IMPLICATION(index < length());
     mutableAttributeVector().remove(index);
 }
 
-bool ElementAttributeData::isEquivalent(const ElementAttributeData* other) const
+bool ElementData::isEquivalent(const ElementData* other) const
 {
     if (!other)
         return isEmpty();
@@ -2992,14 +2992,14 @@ bool ElementAttributeData::isEquivalent(const ElementAttributeData* other) const
     return true;
 }
 
-void ElementAttributeData::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
+void ElementData::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
 {
-    size_t actualSize = m_isMutable ? sizeof(ElementAttributeData) : sizeForImmutableElementAttributeDataWithAttributeCount(m_arraySize);
+    size_t actualSize = m_isUnique ? sizeof(ElementData) : sizeForShareableElementDataWithAttributeCount(m_arraySize);
     MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::DOM, actualSize);
     info.addMember(m_inlineStyle, "inlineStyle");
     info.addMember(m_classNames, "classNames");
     info.addMember(m_idForStyleResolution, "idForStyleResolution");
-    if (m_isMutable) {
+    if (m_isUnique) {
         info.addMember(presentationAttributeStyle(), "presentationAttributeStyle()");
         info.addMember(mutableAttributeVector(), "mutableAttributeVector");
     }
@@ -3007,7 +3007,7 @@ void ElementAttributeData::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo)
         info.addMember(*attributeItem(i), "*attributeItem");
 }
 
-size_t ElementAttributeData::getAttributeItemIndexSlowCase(const AtomicString& name, bool shouldIgnoreAttributeCase) const
+size_t ElementData::getAttributeItemIndexSlowCase(const AtomicString& name, bool shouldIgnoreAttributeCase) const
 {
     // Continue to checking case-insensitively and/or full namespaced names if necessary:
     for (unsigned i = 0; i < length(); ++i) {
index 53d3be6..c8067a5 100644 (file)
@@ -43,20 +43,20 @@ class DOMTokenList;
 class Element;
 class ElementRareData;
 class ElementShadow;
-class ImmutableElementAttributeData;
+class ShareableElementData;
 class IntSize;
 class Locale;
-class MutableElementAttributeData;
+class UniqueElementData;
 class PseudoElement;
 class RenderRegion;
 class ShadowRoot;
 class StylePropertySet;
 
-class ElementAttributeData : public RefCounted<ElementAttributeData> {
+class ElementData : public RefCounted<ElementData> {
     WTF_MAKE_FAST_ALLOCATED;
 public:
-    static PassRefPtr<ElementAttributeData> create();
-    static PassRefPtr<ElementAttributeData> createImmutable(const Vector<Attribute>&);
+    static PassRefPtr<ElementData> createUnique();
+    static PassRefPtr<ElementData> createShareableWithAttributes(const Vector<Attribute>&);
 
     // Override RefCounted's deref() to ensure operator delete is called on
     // the appropriate subclass type.
@@ -91,19 +91,19 @@ public:
     bool hasID() const { return !m_idForStyleResolution.isNull(); }
     bool hasClass() const { return !m_classNames.isNull(); }
 
-    bool isEquivalent(const ElementAttributeData* other) const;
+    bool isEquivalent(const ElementData* other) const;
 
     void reportMemoryUsage(MemoryObjectInfo*) const;
 
-    bool isMutable() const { return m_isMutable; }
+    bool isUnique() const { return m_isUnique; }
     const Attribute* immutableAttributeArray() const;
 
 protected:
-    ElementAttributeData();
-    ElementAttributeData(unsigned arraySize);
-    ElementAttributeData(const ElementAttributeData&, bool isMutable);
+    ElementData();
+    ElementData(unsigned arraySize);
+    ElementData(const ElementData&, bool isUnique);
 
-    unsigned m_isMutable : 1;
+    unsigned m_isUnique : 1;
     unsigned m_arraySize : 28;
     mutable unsigned m_presentationAttributeStyleIsDirty : 1;
     mutable unsigned m_styleAttributeIsDirty : 1;
@@ -118,8 +118,8 @@ protected:
 private:
     friend class Element;
     friend class StyledElement;
-    friend class ImmutableElementAttributeData;
-    friend class MutableElementAttributeData;
+    friend class ShareableElementData;
+    friend class UniqueElementData;
 #if ENABLE(SVG)
     friend class SVGElement;
 #endif
@@ -128,27 +128,27 @@ private:
     const Attribute* getAttributeItem(const AtomicString& name, bool shouldIgnoreAttributeCase) const;
     size_t getAttributeItemIndexSlowCase(const AtomicString& name, bool shouldIgnoreAttributeCase) const;
 
-    PassRefPtr<ElementAttributeData> makeMutableCopy() const;
-    PassRefPtr<ElementAttributeData> makeImmutableCopy() const;
+    PassRefPtr<ElementData> makeUniqueCopy() const;
+    PassRefPtr<ElementData> makeShareableCopy() const;
 
     Vector<Attribute, 4>& mutableAttributeVector();
     const Vector<Attribute, 4>& mutableAttributeVector() const;
 };
 
-class ImmutableElementAttributeData : public ElementAttributeData {
+class ShareableElementData : public ElementData {
 public:
-    ImmutableElementAttributeData(const Vector<Attribute>&);
-    ImmutableElementAttributeData(const MutableElementAttributeData&);
-    ~ImmutableElementAttributeData();
+    ShareableElementData(const Vector<Attribute>&);
+    ShareableElementData(const UniqueElementData&);
+    ~ShareableElementData();
 
     void* m_attributeArray;
 };
 
-class MutableElementAttributeData : public ElementAttributeData {
+class UniqueElementData : public ElementData {
 public:
-    MutableElementAttributeData();
-    MutableElementAttributeData(const ImmutableElementAttributeData&);
-    MutableElementAttributeData(const MutableElementAttributeData&);
+    UniqueElementData();
+    UniqueElementData(const ShareableElementData&);
+    UniqueElementData(const UniqueElementData&);
 
     mutable RefPtr<StylePropertySet> m_presentationAttributeStyle;
     Vector<Attribute, 4> m_attributeVector;
@@ -286,8 +286,8 @@ public:
     const Attribute* attributeItem(unsigned index) const;
     const Attribute* getAttributeItem(const QualifiedName&) const;
     Attribute* getAttributeItem(const QualifiedName&);
-    size_t getAttributeItemIndex(const QualifiedName& name) const { return attributeData()->getAttributeItemIndex(name); }
-    size_t getAttributeItemIndex(const AtomicString& name, bool shouldIgnoreAttributeCase) const { return attributeData()->getAttributeItemIndex(name, shouldIgnoreAttributeCase); }
+    size_t getAttributeItemIndex(const QualifiedName& name) const { return elementData()->getAttributeItemIndex(name); }
+    size_t getAttributeItemIndex(const AtomicString& name, bool shouldIgnoreAttributeCase) const { return elementData()->getAttributeItemIndex(name, shouldIgnoreAttributeCase); }
 
     void scrollIntoView(bool alignToTop = true);
     void scrollIntoViewIfNeeded(bool centerIfNeeded = true);
@@ -371,10 +371,10 @@ public:
     // Only called by the parser immediately after element construction.
     void parserSetAttributes(const Vector<Attribute>&, FragmentScriptingPermission);
 
-    const ElementAttributeData* attributeData() const { return m_attributeData.get(); }
-    ElementAttributeData* mutableAttributeData();
-    const ElementAttributeData* updatedAttributeData() const;
-    const ElementAttributeData* ensureUpdatedAttributeData() const;
+    const ElementData* elementData() const { return m_elementData.get(); }
+    ElementData* ensureUniqueElementData();
+    const ElementData* elementDataWithSynchronizedAttributes() const;
+    const ElementData* ensureElementDataWithSynchronizedAttributes() const;
 
     // Clones attributes only.
     void cloneAttributesFromElement(const Element&);
@@ -705,7 +705,7 @@ private:
 
     void unregisterNamedFlowContentNode();
 
-    void createMutableAttributeData();
+    void createUniqueElementData();
 
     bool shouldInvalidateDistributionWhenAttributeChanged(ElementShadow*, const QualifiedName&, const AtomicString&);
 
@@ -717,7 +717,7 @@ private:
 
     void createRendererIfNeeded();
 
-    RefPtr<ElementAttributeData> m_attributeData;
+    RefPtr<ElementData> m_elementData;
 };
     
 inline Element* toElement(Node* node)
@@ -777,18 +777,18 @@ inline Element* Element::nextElementSibling() const
     return static_cast<Element*>(n);
 }
 
-inline const ElementAttributeData* Element::updatedAttributeData() const
+inline const ElementData* Element::elementDataWithSynchronizedAttributes() const
 {
     updateInvalidAttributes();
-    return attributeData();
+    return elementData();
 }
 
-inline const ElementAttributeData* Element::ensureUpdatedAttributeData() const
+inline const ElementData* Element::ensureElementDataWithSynchronizedAttributes() const
 {
     updateInvalidAttributes();
-    if (attributeData())
-        return attributeData();
-    return const_cast<Element*>(this)->mutableAttributeData();
+    if (elementData())
+        return elementData();
+    return const_cast<Element*>(this)->ensureUniqueElementData();
 }
 
 inline void Element::updateName(const AtomicString& oldName, const AtomicString& newName)
@@ -831,13 +831,13 @@ inline void Element::updateId(TreeScope* scope, const AtomicString& oldId, const
 inline bool Element::fastHasAttribute(const QualifiedName& name) const
 {
     ASSERT(fastAttributeLookupAllowed(name));
-    return attributeData() && getAttributeItem(name);
+    return elementData() && getAttributeItem(name);
 }
 
 inline const AtomicString& Element::fastGetAttribute(const QualifiedName& name) const
 {
     ASSERT(fastAttributeLookupAllowed(name));
-    if (attributeData()) {
+    if (elementData()) {
         if (const Attribute* attribute = getAttributeItem(name))
             return attribute->value();
     }
@@ -846,13 +846,13 @@ inline const AtomicString& Element::fastGetAttribute(const QualifiedName& name)
 
 inline bool Element::hasAttributesWithoutUpdate() const
 {
-    return attributeData() && !attributeData()->isEmpty();
+    return elementData() && !elementData()->isEmpty();
 }
 
 inline const AtomicString& Element::idForStyleResolution() const
 {
     ASSERT(hasID());
-    return attributeData()->idForStyleResolution();
+    return elementData()->idForStyleResolution();
 }
 
 inline bool Element::isIdAttributeName(const QualifiedName& attributeName) const
@@ -882,63 +882,63 @@ inline void Element::setIdAttribute(const AtomicString& value)
 inline const SpaceSplitString& Element::classNames() const
 {
     ASSERT(hasClass());
-    ASSERT(attributeData());
-    return attributeData()->classNames();
+    ASSERT(elementData());
+    return elementData()->classNames();
 }
 
 inline size_t Element::attributeCount() const
 {
-    ASSERT(attributeData());
-    return attributeData()->length();
+    ASSERT(elementData());
+    return elementData()->length();
 }
 
 inline const Attribute* Element::attributeItem(unsigned index) const
 {
-    ASSERT(attributeData());
-    return attributeData()->attributeItem(index);
+    ASSERT(elementData());
+    return elementData()->attributeItem(index);
 }
 
 inline const Attribute* Element::getAttributeItem(const QualifiedName& name) const
 {
-    ASSERT(attributeData());
-    return attributeData()->getAttributeItem(name);
+    ASSERT(elementData());
+    return elementData()->getAttributeItem(name);
 }
 
 inline Attribute* Element::getAttributeItem(const QualifiedName& name)
 {
-    ASSERT(attributeData());
-    return mutableAttributeData()->getAttributeItem(name);
+    ASSERT(elementData());
+    return ensureUniqueElementData()->getAttributeItem(name);
 }
 
 inline void Element::updateInvalidAttributes() const
 {
-    if (!attributeData())
+    if (!elementData())
         return;
 
-    if (attributeData()->m_styleAttributeIsDirty)
+    if (elementData()->m_styleAttributeIsDirty)
         updateStyleAttribute();
 
 #if ENABLE(SVG)
-    if (attributeData()->m_animatedSVGAttributesAreDirty)
+    if (elementData()->m_animatedSVGAttributesAreDirty)
         updateAnimatedSVGAttribute(anyQName());
 #endif
 }
 
 inline bool Element::hasID() const
 {
-    return attributeData() && attributeData()->hasID();
+    return elementData() && elementData()->hasID();
 }
 
 inline bool Element::hasClass() const
 {
-    return attributeData() && attributeData()->hasClass();
+    return elementData() && elementData()->hasClass();
 }
 
-inline ElementAttributeData* Element::mutableAttributeData()
+inline ElementData* Element::ensureUniqueElementData()
 {
-    if (!attributeData() || !attributeData()->isMutable())
-        createMutableAttributeData();
-    return m_attributeData.get();
+    if (!elementData() || !elementData()->isUnique())
+        createUniqueElementData();
+    return m_elementData.get();
 }
 
 // Put here to make them inline.
@@ -975,39 +975,39 @@ inline bool isShadowHost(const Node* node)
 {
     return node && node->isElementNode() && toElement(node)->shadow();
 }
-inline Vector<Attribute, 4>& ElementAttributeData::mutableAttributeVector()
+inline Vector<Attribute, 4>& ElementData::mutableAttributeVector()
 {
-    ASSERT(m_isMutable);
-    return static_cast<MutableElementAttributeData*>(this)->m_attributeVector;
+    ASSERT(m_isUnique);
+    return static_cast<UniqueElementData*>(this)->m_attributeVector;
 }
 
-inline const Vector<Attribute, 4>& ElementAttributeData::mutableAttributeVector() const
+inline const Vector<Attribute, 4>& ElementData::mutableAttributeVector() const
 {
-    ASSERT(m_isMutable);
-    return static_cast<const MutableElementAttributeData*>(this)->m_attributeVector;
+    ASSERT(m_isUnique);
+    return static_cast<const UniqueElementData*>(this)->m_attributeVector;
 }
 
-inline const Attribute* ElementAttributeData::immutableAttributeArray() const
+inline const Attribute* ElementData::immutableAttributeArray() const
 {
-    ASSERT(!m_isMutable);
-    return reinterpret_cast<const Attribute*>(&static_cast<const ImmutableElementAttributeData*>(this)->m_attributeArray);
+    ASSERT(!m_isUnique);
+    return reinterpret_cast<const Attribute*>(&static_cast<const ShareableElementData*>(this)->m_attributeArray);
 }
 
-inline size_t ElementAttributeData::length() const
+inline size_t ElementData::length() const
 {
-    if (isMutable())
+    if (isUnique())
         return mutableAttributeVector().size();
     return m_arraySize;
 }
 
-inline const StylePropertySet* ElementAttributeData::presentationAttributeStyle() const
+inline const StylePropertySet* ElementData::presentationAttributeStyle() const
 {
-    if (!m_isMutable)
+    if (!m_isUnique)
         return 0;
-    return static_cast<const MutableElementAttributeData*>(this)->m_presentationAttributeStyle.get();
+    return static_cast<const UniqueElementData*>(this)->m_presentationAttributeStyle.get();
 }
 
-inline Attribute* ElementAttributeData::getAttributeItem(const AtomicString& name, bool shouldIgnoreAttributeCase)
+inline Attribute* ElementData::getAttributeItem(const AtomicString& name, bool shouldIgnoreAttributeCase)
 {
     size_t index = getAttributeItemIndex(name, shouldIgnoreAttributeCase);
     if (index != notFound)
@@ -1015,7 +1015,7 @@ inline Attribute* ElementAttributeData::getAttributeItem(const AtomicString& nam
     return 0;
 }
 
-inline const Attribute* ElementAttributeData::getAttributeItem(const AtomicString& name, bool shouldIgnoreAttributeCase) const
+inline const Attribute* ElementData::getAttributeItem(const AtomicString& name, bool shouldIgnoreAttributeCase) const
 {
     size_t index = getAttributeItemIndex(name, shouldIgnoreAttributeCase);
     if (index != notFound)
@@ -1023,7 +1023,7 @@ inline const Attribute* ElementAttributeData::getAttributeItem(const AtomicStrin
     return 0;
 }
 
-inline size_t ElementAttributeData::getAttributeItemIndex(const QualifiedName& name) const
+inline size_t ElementData::getAttributeItemIndex(const QualifiedName& name) const
 {
     for (unsigned i = 0; i < length(); ++i) {
         if (attributeItem(i)->name().matches(name))
@@ -1034,7 +1034,7 @@ inline size_t ElementAttributeData::getAttributeItemIndex(const QualifiedName& n
 
 // We use a boolean parameter instead of calling shouldIgnoreAttributeCase so that the caller
 // can tune the behavior (hasAttribute is case sensitive whereas getAttribute is not).
-inline size_t ElementAttributeData::getAttributeItemIndex(const AtomicString& name, bool shouldIgnoreAttributeCase) const
+inline size_t ElementData::getAttributeItemIndex(const AtomicString& name, bool shouldIgnoreAttributeCase) const
 {
     unsigned len = length();
     bool doSlowCheck = shouldIgnoreAttributeCase;
@@ -1054,7 +1054,7 @@ inline size_t ElementAttributeData::getAttributeItemIndex(const AtomicString& na
     return notFound;
 }
 
-inline const Attribute* ElementAttributeData::getAttributeItem(const QualifiedName& name) const
+inline const Attribute* ElementData::getAttributeItem(const QualifiedName& name) const
 {
     for (unsigned i = 0; i < length(); ++i) {
         if (attributeItem(i)->name().matches(name))
@@ -1063,7 +1063,7 @@ inline const Attribute* ElementAttributeData::getAttributeItem(const QualifiedNa
     return 0;
 }
 
-inline Attribute* ElementAttributeData::getAttributeItem(const QualifiedName& name)
+inline Attribute* ElementData::getAttributeItem(const QualifiedName& name)
 {
     for (unsigned i = 0; i < length(); ++i) {
         if (attributeItem(i)->name().matches(name))
@@ -1072,15 +1072,15 @@ inline Attribute* ElementAttributeData::getAttributeItem(const QualifiedName& na
     return 0;
 }
 
-inline const Attribute* ElementAttributeData::attributeItem(unsigned index) const
+inline const Attribute* ElementData::attributeItem(unsigned index) const
 {
     ASSERT_WITH_SECURITY_IMPLICATION(index < length());
-    if (m_isMutable)
+    if (m_isUnique)
         return &mutableAttributeVector().at(index);
     return &immutableAttributeArray()[index];
 }
 
-inline Attribute* ElementAttributeData::attributeItem(unsigned index)
+inline Attribute* ElementData::attributeItem(unsigned index)
 {
     ASSERT_WITH_SECURITY_IMPLICATION(index < length());
     return &mutableAttributeVector().at(index);
index 11fd98b..82017a8 100644 (file)
@@ -205,11 +205,11 @@ void Node::dumpStatistics()
                 if (!result.isNewEntry)
                     result.iterator->value++;
 
-                if (ElementAttributeData* attributeData = element->attributeData()) {
-                    attributes += attributeData->length();
+                if (ElementData* elementData = element->elementData()) {
+                    attributes += elementData->length();
                     ++elementsWithAttributeStorage;
-                    for (unsigned i = 0; i < attributeData->length(); ++i) {
-                        Attribute* attr = attributeData->attributeItem(i);
+                    for (unsigned i = 0; i < elementData->length(); ++i) {
+                        Attribute* attr = elementData->attributeItem(i);
                         if (attr->attr())
                             ++attributesWithAttr;
                     }
@@ -296,7 +296,7 @@ void Node::dumpStatistics()
     printf("Attributes:\n");
     printf("  Number of Attributes (non-Node and Node): %zu [%zu]\n", attributes, sizeof(Attribute));
     printf("  Number of Attributes with an Attr: %zu\n", attributesWithAttr);
-    printf("  Number of Elements with attribute storage: %zu [%zu]\n", elementsWithAttributeStorage, sizeof(ElementAttributeData));
+    printf("  Number of Elements with attribute storage: %zu [%zu]\n", elementsWithAttributeStorage, sizeof(ElementData));
     printf("  Number of Elements with RareData: %zu\n", elementsWithRareData);
     printf("  Number of Elements with NamedNodeMap: %zu [%zu]\n", elementsWithNamedNodeMap, sizeof(NamedNodeMap));
 #endif
@@ -1753,7 +1753,7 @@ unsigned short Node::compareDocumentPosition(Node* otherNode)
     if (attr1 && attr2 && start1 == start2 && start1) {
         // We are comparing two attributes on the same node. Crawl our attribute map and see which one we hit first.
         Element* owner1 = attr1->ownerElement();
-        owner1->updatedAttributeData(); // Force update invalid attributes.
+        owner1->elementDataWithSynchronizedAttributes(); // Force update invalid attributes.
         unsigned length = owner1->attributeCount();
         for (unsigned i = 0; i < length; ++i) {
             // If neither of the two determining nodes is a child node and nodeType is the same for both determining nodes, then an 
index 27c314a..9edb39e 100644 (file)
@@ -128,9 +128,9 @@ static PresentationAttributeCacheCleaner& presentationAttributeCacheCleaner()
 
 void StyledElement::updateStyleAttribute() const
 {
-    ASSERT(attributeData());
-    ASSERT(attributeData()->m_styleAttributeIsDirty);
-    attributeData()->m_styleAttributeIsDirty = false;
+    ASSERT(elementData());
+    ASSERT(elementData()->m_styleAttributeIsDirty);
+    elementData()->m_styleAttributeIsDirty = false;
     if (const StylePropertySet* inlineStyle = this->inlineStyle())
         const_cast<StyledElement*>(this)->setSynchronizedLazyAttribute(styleAttr, inlineStyle->asText());
 }
@@ -148,7 +148,7 @@ CSSStyleDeclaration* StyledElement::style()
 
 StylePropertySet* StyledElement::ensureMutableInlineStyle()
 {
-    RefPtr<StylePropertySet>& inlineStyle = mutableAttributeData()->m_inlineStyle;
+    RefPtr<StylePropertySet>& inlineStyle = ensureUniqueElementData()->m_inlineStyle;
     if (!inlineStyle)
         inlineStyle = StylePropertySet::create(strictToCSSParserMode(isHTMLElement() && !document()->inQuirksMode()));
     else if (!inlineStyle->isMutable())
@@ -161,7 +161,7 @@ void StyledElement::attributeChanged(const QualifiedName& name, const AtomicStri
     if (name == styleAttr)
         styleAttributeChanged(newValue);
     else if (isPresentationAttribute(name)) {
-        attributeData()->m_presentationAttributeStyleIsDirty = true;
+        elementData()->m_presentationAttributeStyleIsDirty = true;
         setNeedsStyleRecalc(InlineStyleChange);
     }
 
@@ -172,17 +172,17 @@ PropertySetCSSStyleDeclaration* StyledElement::inlineStyleCSSOMWrapper()
 {
     if (!inlineStyle() || !inlineStyle()->hasCSSOMWrapper())
         return 0;
-    PropertySetCSSStyleDeclaration* cssomWrapper = mutableAttributeData()->m_inlineStyle->cssStyleDeclaration();
+    PropertySetCSSStyleDeclaration* cssomWrapper = ensureUniqueElementData()->m_inlineStyle->cssStyleDeclaration();
     ASSERT(cssomWrapper && cssomWrapper->parentElement() == this);
     return cssomWrapper;
 }
 
 inline void StyledElement::setInlineStyleFromString(const AtomicString& newStyleString)
 {
-    RefPtr<StylePropertySet>& inlineStyle = attributeData()->m_inlineStyle;
+    RefPtr<StylePropertySet>& inlineStyle = elementData()->m_inlineStyle;
 
     // Avoid redundant work if we're using shared attribute data with already parsed inline style.
-    if (inlineStyle && !attributeData()->isMutable())
+    if (inlineStyle && !elementData()->isUnique())
         return;
 
     // We reconstruct the property set instead of mutating if there is no CSSOM wrapper.
@@ -205,11 +205,11 @@ void StyledElement::styleAttributeChanged(const AtomicString& newStyleString)
     if (newStyleString.isNull()) {
         if (PropertySetCSSStyleDeclaration* cssomWrapper = inlineStyleCSSOMWrapper())
             cssomWrapper->clearParentElement();
-        mutableAttributeData()->m_inlineStyle.clear();
+        ensureUniqueElementData()->m_inlineStyle.clear();
     } else if (document()->contentSecurityPolicy()->allowInlineStyle(document()->url(), startLineNumber))
         setInlineStyleFromString(newStyleString);
 
-    attributeData()->m_styleAttributeIsDirty = false;
+    elementData()->m_styleAttributeIsDirty = false;
 
     setNeedsStyleRecalc(InlineStyleChange);
     InspectorInstrumentation::didInvalidateStyleAttr(document(), this);
@@ -218,8 +218,8 @@ void StyledElement::styleAttributeChanged(const AtomicString& newStyleString)
 void StyledElement::inlineStyleChanged()
 {
     setNeedsStyleRecalc(InlineStyleChange);
-    ASSERT(attributeData());
-    attributeData()->m_styleAttributeIsDirty = true;
+    ASSERT(elementData());
+    elementData()->m_styleAttributeIsDirty = true;
     InspectorInstrumentation::didInvalidateStyleAttr(document(), this);
 }
     
@@ -265,7 +265,7 @@ void StyledElement::removeAllInlineStyleProperties()
 
 void StyledElement::addSubresourceAttributeURLs(ListHashSet<KURL>& urls) const
 {
-    if (const StylePropertySet* inlineStyle = attributeData() ? attributeData()->inlineStyle() : 0)
+    if (const StylePropertySet* inlineStyle = elementData() ? elementData()->inlineStyle() : 0)
         inlineStyle->addSubresourceStyleURLs(urls, document()->elementSheet()->contents());
 }
 
@@ -340,11 +340,11 @@ void StyledElement::rebuildPresentationAttributeStyle()
         }
     }
 
-    // ImmutableElementAttributeData doesn't store presentation attribute style, so make sure we have a MutableElementAttributeData.
-    ElementAttributeData* attributeData = mutableAttributeData();
+    // ShareableElementData doesn't store presentation attribute style, so make sure we have a UniqueElementData.
+    ElementData* elementData = ensureUniqueElementData();
 
-    attributeData->m_presentationAttributeStyleIsDirty = false;
-    attributeData->setPresentationAttributeStyle(style->isEmpty() ? 0 : style);
+    elementData->m_presentationAttributeStyleIsDirty = false;
+    elementData->setPresentationAttributeStyle(style->isEmpty() ? 0 : style);
 
     if (!cacheHash || cacheIterator->value)
         return;
index e41aaef..bf06239 100644 (file)
@@ -40,7 +40,7 @@ public:
     virtual const StylePropertySet* additionalPresentationAttributeStyle() { return 0; }
     void invalidateStyleAttribute();
 
-    const StylePropertySet* inlineStyle() const { return attributeData() ? attributeData()->m_inlineStyle.get() : 0; }
+    const StylePropertySet* inlineStyle() const { return elementData() ? elementData()->m_inlineStyle.get() : 0; }
     StylePropertySet* ensureMutableInlineStyle();
     
     // Unlike StylePropertySet setters, these implement invalidation.
@@ -86,17 +86,17 @@ private:
 
 inline void StyledElement::invalidateStyleAttribute()
 {
-    ASSERT(attributeData());
-    attributeData()->m_styleAttributeIsDirty = true;
+    ASSERT(elementData());
+    elementData()->m_styleAttributeIsDirty = true;
 }
 
 inline const StylePropertySet* StyledElement::presentationAttributeStyle()
 {
-    if (!attributeData())
+    if (!elementData())
         return 0;
-    if (attributeData()->m_presentationAttributeStyleIsDirty)
+    if (elementData()->m_presentationAttributeStyleIsDirty)
         rebuildPresentationAttributeStyle();
-    return attributeData()->presentationAttributeStyle();
+    return elementData()->presentationAttributeStyle();
 }
 
 } //namespace
index 75bc343..3b57560 100644 (file)
@@ -68,7 +68,7 @@ const SpaceSplitString& ClassList::classNames() const
             m_classNamesForQuirksMode = adoptPtr(new SpaceSplitString(value(), false));
         return *m_classNamesForQuirksMode.get();
     }
-    return m_element->attributeData()->classNames();
+    return m_element->elementData()->classNames();
 }
 
 } // namespace WebCore
index 701576b..1a97bf6 100644 (file)
@@ -515,7 +515,7 @@ void HTMLInputElement::updateType()
         registerForSuspensionCallbackIfNeeded();
 
     if (didRespectHeightAndWidth != m_inputType->shouldRespectHeightAndWidthAttributes()) {
-        ASSERT(attributeData());
+        ASSERT(elementData());
         if (Attribute* height = getAttributeItem(heightAttr))
             attributeChanged(heightAttr, height->value());
         if (Attribute* width = getAttributeItem(widthAttr))
index be1c535..9c04dbf 100644 (file)
@@ -211,7 +211,7 @@ void HTMLConstructionSite::mergeAttributesFromTokenIntoElement(AtomicHTMLToken*
 
     for (unsigned i = 0; i < token->attributes().size(); ++i) {
         const Attribute& tokenAttribute = token->attributes().at(i);
-        if (!element->attributeData() || !element->getAttributeItem(tokenAttribute.name()))
+        if (!element->elementData() || !element->getAttributeItem(tokenAttribute.name()))
             element->setAttribute(tokenAttribute.name(), tokenAttribute.value());
     }
 }
index a7e3f89..b48adef 100644 (file)
@@ -544,13 +544,13 @@ void SVGElement::attributeChanged(const QualifiedName& name, const AtomicString&
 
 void SVGElement::updateAnimatedSVGAttribute(const QualifiedName& name) const
 {
-    if (!attributeData() || !attributeData()->m_animatedSVGAttributesAreDirty)
+    if (!elementData() || !elementData()->m_animatedSVGAttributesAreDirty)
         return;
 
     SVGElement* nonConstThis = const_cast<SVGElement*>(this);
     if (name == anyQName()) {
         nonConstThis->localAttributeToPropertyMap().synchronizeProperties(nonConstThis);
-        attributeData()->m_animatedSVGAttributesAreDirty = false;
+        elementData()->m_animatedSVGAttributesAreDirty = false;
     } else
         nonConstThis->localAttributeToPropertyMap().synchronizeProperty(nonConstThis, name);
 }
index 8f8900b..a009f42 100644 (file)
@@ -79,7 +79,7 @@ public:
 
     virtual AffineTransform* supplementalTransform() { return 0; }
 
-    void invalidateSVGAttributes() { mutableAttributeData()->m_animatedSVGAttributesAreDirty = true; }
+    void invalidateSVGAttributes() { ensureUniqueElementData()->m_animatedSVGAttributesAreDirty = true; }
 
     const HashSet<SVGElementInstance*>& instancesForElement() const;
 
index ac9044c..6ac4d91 100644 (file)
@@ -146,7 +146,7 @@ XMLDocumentParser::XMLDocumentParser(DocumentFragment* fragment, Element* parent
 
     QXmlStreamNamespaceDeclarations namespaces;
     for (Element* element = elemStack.last(); !elemStack.isEmpty(); elemStack.removeLast()) {
-        if (const ElementAttributeData* attrs = element->updatedAttributeData()) {
+        if (const ElementData* attrs = element->elementDataWithSynchronizedAttributes()) {
             for (unsigned i = 0; i < attrs->length(); i++) {
                 const Attribute* attr = attrs->attributeItem(i);
                 if (attr->localName() == "xmlns")