Changeset 142714 in webkit


Ignore:
Timestamp:
Feb 12, 2013 8:27:41 PM (11 years ago)
Author:
akling@apple.com
Message:

Remove Element::ensureAttributeData().
<http://webkit.org/b/109643>

Reviewed by Anders Carlsson.

  • dom/Element.h:
  • dom/Element.cpp:

(WebCore::Element::classAttributeChanged):
(WebCore::Element::shouldInvalidateDistributionWhenAttributeChanged):

Use attributeData() instead of ensureAttributeData(), it's already guaranteed to exist in
both these functions as they are called in response to attribute changes.

  • svg/SVGElement.h:

(WebCore::SVGElement::invalidateSVGAttributes):

Use mutableAttributeData() instead of ensureAttributeData() when invalidating animated
SVG attributes. While I can't find any bugs caused by this, an element with property animations
shouldn't share attribute data with other elements.

Location:
trunk/Source/WebCore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r142713 r142714  
     12013-02-12  Andreas Kling  <akling@apple.com>
     2
     3        Remove Element::ensureAttributeData().
     4        <http://webkit.org/b/109643>
     5
     6        Reviewed by Anders Carlsson.
     7
     8        * dom/Element.h:
     9        * dom/Element.cpp:
     10        (WebCore::Element::classAttributeChanged):
     11        (WebCore::Element::shouldInvalidateDistributionWhenAttributeChanged):
     12
     13            Use attributeData() instead of ensureAttributeData(), it's already guaranteed to exist in
     14            both these functions as they are called in response to attribute changes.
     15
     16        * svg/SVGElement.h:
     17        (WebCore::SVGElement::invalidateSVGAttributes):
     18
     19            Use mutableAttributeData() instead of ensureAttributeData() when invalidating animated
     20            SVG attributes. While I can't find any bugs caused by this, an element with property animations
     21            shouldn't share attribute data with other elements.
     22
    1232013-02-12  Hayato Ito  <hayato@chromium.org>
    224
  • trunk/Source/WebCore/dom/Element.cpp

    r142698 r142714  
    922922
    923923    if (classStringHasClassName(newClassString)) {
    924         const ElementAttributeData* attributeData = ensureAttributeData();
    925924        const bool shouldFoldCase = document()->inQuirksMode();
    926         const SpaceSplitString oldClasses = attributeData->classNames();
    927 
    928         attributeData->setClass(newClassString, shouldFoldCase);
    929 
    930         const SpaceSplitString& newClasses = attributeData->classNames();
     925        const SpaceSplitString oldClasses = attributeData()->classNames();
     926        attributeData()->setClass(newClassString, shouldFoldCase);
     927        const SpaceSplitString& newClasses = attributeData()->classNames();
    931928        shouldInvalidateStyle = testShouldInvalidateStyle && checkSelectorForClassChange(oldClasses, newClasses, *styleResolver);
    932     } else if (const ElementAttributeData* attributeData = this->attributeData()) {
    933         const SpaceSplitString& oldClasses = attributeData->classNames();
     929    } else {
     930        const SpaceSplitString& oldClasses = attributeData()->classNames();
    934931        shouldInvalidateStyle = testShouldInvalidateStyle && checkSelectorForClassChange(oldClasses, *styleResolver);
    935 
    936         attributeData->clearClass();
     932        attributeData()->clearClass();
    937933    }
    938934
     
    963959        const AtomicString& newClassString = newValue;
    964960        if (classStringHasClassName(newClassString)) {
    965             const ElementAttributeData* attributeData = ensureAttributeData();
    966961            const bool shouldFoldCase = document()->inQuirksMode();
    967             const SpaceSplitString& oldClasses = attributeData->classNames();
     962            const SpaceSplitString& oldClasses = attributeData()->classNames();
    968963            const SpaceSplitString newClasses(newClassString, shouldFoldCase);
    969964            if (checkSelectorForClassChange(oldClasses, newClasses, featureSet))
    970965                return true;
    971         } else if (const ElementAttributeData* attributeData = this->attributeData()) {
    972             const SpaceSplitString& oldClasses = attributeData->classNames();
     966        } else {
     967            const SpaceSplitString& oldClasses = attributeData()->classNames();
    973968            if (checkSelectorForClassChange(oldClasses, featureSet))
    974969                return true;
  • trunk/Source/WebCore/dom/Element.h

    r142698 r142714  
    374374    const ElementAttributeData* attributeData() const { return m_attributeData.get(); }
    375375    ElementAttributeData* mutableAttributeData();
    376     const ElementAttributeData* ensureAttributeData();
    377376    const ElementAttributeData* updatedAttributeData() const;
    378377    const ElementAttributeData* ensureUpdatedAttributeData() const;
     
    785784}
    786785
    787 inline const ElementAttributeData* Element::ensureAttributeData()
    788 {
    789     if (attributeData())
    790         return attributeData();
    791     return mutableAttributeData();
    792 }
    793 
    794786inline const ElementAttributeData* Element::ensureUpdatedAttributeData() const
    795787{
  • trunk/Source/WebCore/svg/SVGElement.h

    r141516 r142714  
    8080    virtual AffineTransform* supplementalTransform() { return 0; }
    8181
    82     void invalidateSVGAttributes() { ensureAttributeData()->m_animatedSVGAttributesAreDirty = true; }
     82    void invalidateSVGAttributes() { mutableAttributeData()->m_animatedSVGAttributesAreDirty = true; }
    8383
    8484    const HashSet<SVGElementInstance*>& instancesForElement() const;
Note: See TracChangeset for help on using the changeset viewer.