Changeset 135816 in webkit
- Timestamp:
- Nov 26, 2012 9:13:40 PM (11 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r135815 r135816 1 2012-11-26 Andreas Kling <akling@apple.com> 2 3 Node: Move AreSVGAttributesValidFlag to ElementAttributeData. 4 <http://webkit.org/b/103349> 5 6 Reviewed by Anders Carlsson. 7 8 Moved AreSVGAttributesValidFlag to ElementAttributeData and change it to use "dirty" semantics. 9 This frees up a bit on Node, and we will always have ElementAttributeData if the animated 10 attributes are dirty anyway. 11 12 * dom/Element.cpp: 13 (WebCore::Element::getAttribute): 14 * dom/Element.h: 15 (WebCore::Element::updateInvalidAttributes): 16 * dom/ElementAttributeData.cpp: 17 (WebCore::ElementAttributeData::ElementAttributeData): 18 * dom/ElementAttributeData.h: 19 (WebCore::ElementAttributeData::ElementAttributeData): 20 (ElementAttributeData): 21 * dom/Node.h: 22 (Node): 23 * svg/SVGElement.cpp: 24 (WebCore::SVGElement::updateAnimatedSVGAttribute): 25 * svg/SVGElement.h: 26 (WebCore::SVGElement::invalidateSVGAttributes): 27 1 28 2012-11-26 Sheriff Bot <webkit.review.bot@gmail.com> 2 29 -
trunk/Source/WebCore/dom/Element.cpp
r135693 r135816 306 306 const AtomicString& Element::getAttribute(const QualifiedName& name) const 307 307 { 308 if (UNLIKELY(name == styleAttr) && attributeData() && attributeData()->m_styleAttributeIsDirty) 308 if (!attributeData()) 309 return nullAtom; 310 311 if (UNLIKELY(name == styleAttr && attributeData()->m_styleAttributeIsDirty)) 309 312 updateStyleAttribute(); 310 313 311 314 #if ENABLE(SVG) 312 if (UNLIKELY( !areSVGAttributesValid()))315 if (UNLIKELY(attributeData()->m_animatedSVGAttributesAreDirty)) 313 316 updateAnimatedSVGAttribute(name); 314 317 #endif 315 318 316 if (attributeData()) { 317 if (const Attribute* attribute = getAttributeItem(name)) 318 return attribute->value(); 319 } 319 if (const Attribute* attribute = getAttributeItem(name)) 320 return attribute->value(); 320 321 return nullAtom; 321 322 } … … 661 662 const AtomicString& Element::getAttribute(const AtomicString& name) const 662 663 { 664 if (!attributeData()) 665 return nullAtom; 666 663 667 bool ignoreCase = shouldIgnoreAttributeCase(this); 664 668 665 669 // Update the 'style' attribute if it's invalid and being requested: 666 if (attributeData() && attributeData()->m_styleAttributeIsDirty && equalPossiblyIgnoringCase(name, styleAttr.localName(), ignoreCase))670 if (attributeData()->m_styleAttributeIsDirty && equalPossiblyIgnoringCase(name, styleAttr.localName(), ignoreCase)) 667 671 updateStyleAttribute(); 668 672 669 673 #if ENABLE(SVG) 670 if ( !areSVGAttributesValid()) {674 if (attributeData()->m_animatedSVGAttributesAreDirty) { 671 675 // We're not passing a namespace argument on purpose. SVGNames::*Attr are defined w/o namespaces as well. 672 676 updateAnimatedSVGAttribute(QualifiedName(nullAtom, name, nullAtom)); … … 674 678 #endif 675 679 676 if (attributeData()) { 677 if (const Attribute* attribute = attributeData()->getAttributeItem(name, ignoreCase)) 678 return attribute->value(); 679 } 680 680 if (const Attribute* attribute = attributeData()->getAttributeItem(name, ignoreCase)) 681 return attribute->value(); 681 682 return nullAtom; 682 683 } -
trunk/Source/WebCore/dom/Element.h
r135693 r135816 744 744 inline void Element::updateInvalidAttributes() const 745 745 { 746 if (attributeData() && attributeData()->m_styleAttributeIsDirty) 746 if (!attributeData()) 747 return; 748 749 if (attributeData()->m_styleAttributeIsDirty) 747 750 updateStyleAttribute(); 748 751 749 752 #if ENABLE(SVG) 750 if ( !areSVGAttributesValid())753 if (attributeData()->m_animatedSVGAttributesAreDirty) 751 754 updateAnimatedSVGAttribute(anyQName()); 752 755 #endif -
trunk/Source/WebCore/dom/ElementAttributeData.cpp
r135428 r135816 87 87 , m_presentationAttributeStyleIsDirty(other.m_presentationAttributeStyleIsDirty) 88 88 , m_styleAttributeIsDirty(other.m_styleAttributeIsDirty) 89 #if ENABLE(SVG) 90 , m_animatedSVGAttributesAreDirty(other.m_animatedSVGAttributesAreDirty) 91 #endif 89 92 , m_classNames(other.m_classNames) 90 93 , m_idForStyleResolution(other.m_idForStyleResolution) -
trunk/Source/WebCore/dom/ElementAttributeData.h
r135421 r135816 91 91 , m_presentationAttributeStyleIsDirty(false) 92 92 , m_styleAttributeIsDirty(false) 93 #if ENABLE(SVG) 94 , m_animatedSVGAttributesAreDirty(false) 95 #endif 93 96 { } 94 97 … … 98 101 , m_presentationAttributeStyleIsDirty(false) 99 102 , m_styleAttributeIsDirty(false) 103 #if ENABLE(SVG) 104 , m_animatedSVGAttributesAreDirty(false) 105 #endif 100 106 { } 101 107 … … 103 109 104 110 unsigned m_isMutable : 1; 105 unsigned m_arraySize : 2 9;111 unsigned m_arraySize : 28; 106 112 mutable unsigned m_presentationAttributeStyleIsDirty : 1; 107 113 mutable unsigned m_styleAttributeIsDirty : 1; 114 #if ENABLE(SVG) 115 mutable unsigned m_animatedSVGAttributesAreDirty : 1; 116 #endif 108 117 109 118 mutable RefPtr<StylePropertySet> m_inlineStyle; … … 116 125 friend class ImmutableElementAttributeData; 117 126 friend class MutableElementAttributeData; 127 #if ENABLE(SVG) 128 friend class SVGElement; 129 #endif 118 130 119 131 Attribute* getAttributeItem(const AtomicString& name, bool shouldIgnoreAttributeCase); -
trunk/Source/WebCore/dom/Node.h
r135793 r135816 99 99 typedef int ExceptionCode; 100 100 101 const int nodeStyleChangeShift = 1 8;101 const int nodeStyleChangeShift = 17; 102 102 103 103 // SyntheticStyleChange means that we need to go through the entire style change logic even though … … 706 706 IsParsingChildrenFinishedFlag = 1 << 15, // Element 707 707 #if ENABLE(SVG) 708 AreSVGAttributesValidFlag = 1 << 16, // Element 709 HasSVGRareDataFlag = 1 << 17, // SVGElement 708 HasSVGRareDataFlag = 1 << 16, // SVGElement 710 709 #endif 711 710 712 711 StyleChangeMask = 1 << nodeStyleChangeShift | 1 << (nodeStyleChangeShift + 1), 713 712 714 SelfOrAncestorHasDirAutoFlag = 1 << 20, 715 716 HasNameOrIsEditingTextFlag = 1 << 21, 717 718 InNamedFlowFlag = 1 << 22, 719 HasSyntheticAttrChildNodesFlag = 1 << 23, 720 HasCustomCallbacksFlag = 1 << 24, 721 HasScopedHTMLStyleChildFlag = 1 << 25, 722 HasEventTargetDataFlag = 1 << 26, 723 V8CollectableDuringMinorGCFlag = 1 << 27, 724 IsInsertionPointFlag = 1 << 28, 725 726 #if ENABLE(SVG) 727 DefaultNodeFlags = IsParsingChildrenFinishedFlag | AreSVGAttributesValidFlag, 728 #else 729 DefaultNodeFlags = IsParsingChildrenFinishedFlag, 730 #endif 713 SelfOrAncestorHasDirAutoFlag = 1 << 19, 714 715 HasNameOrIsEditingTextFlag = 1 << 20, 716 717 InNamedFlowFlag = 1 << 21, 718 HasSyntheticAttrChildNodesFlag = 1 << 22, 719 HasCustomCallbacksFlag = 1 << 23, 720 HasScopedHTMLStyleChildFlag = 1 << 24, 721 HasEventTargetDataFlag = 1 << 25, 722 V8CollectableDuringMinorGCFlag = 1 << 26, 723 IsInsertionPointFlag = 1 << 27, 724 725 DefaultNodeFlags = IsParsingChildrenFinishedFlag 731 726 }; 732 727 733 // 3bits remaining728 // 4 bits remaining 734 729 735 730 bool getFlag(NodeFlags mask) const { return m_nodeFlags & mask; } … … 840 835 841 836 #if ENABLE(SVG) 842 bool areSVGAttributesValid() const { return getFlag(AreSVGAttributesValidFlag); }843 void setAreSVGAttributesValid() const { setFlag(AreSVGAttributesValidFlag); }844 void clearAreSVGAttributesValid() { clearFlag(AreSVGAttributesValidFlag); }845 837 bool hasSVGRareData() const { return getFlag(HasSVGRareDataFlag); } 846 838 void setHasSVGRareData() { setFlag(HasSVGRareDataFlag); } -
trunk/Source/WebCore/svg/SVGElement.cpp
r135793 r135816 567 567 void SVGElement::updateAnimatedSVGAttribute(const QualifiedName& name) const 568 568 { 569 if ( areSVGAttributesValid())569 if (!attributeData() || !attributeData()->m_animatedSVGAttributesAreDirty) 570 570 return; 571 571 … … 573 573 if (name == anyQName()) { 574 574 nonConstThis->localAttributeToPropertyMap().synchronizeProperties(nonConstThis); 575 setAreSVGAttributesValid();575 attributeData()->m_animatedSVGAttributesAreDirty = false; 576 576 } else 577 577 nonConstThis->localAttributeToPropertyMap().synchronizeProperty(nonConstThis, name); -
trunk/Source/WebCore/svg/SVGElement.h
r135069 r135816 85 85 virtual AffineTransform* supplementalTransform() { return 0; } 86 86 87 void invalidateSVGAttributes() { clearAreSVGAttributesValid(); }87 void invalidateSVGAttributes() { ensureAttributeData()->m_animatedSVGAttributesAreDirty = true; } 88 88 89 89 const HashSet<SVGElementInstance*>& instancesForElement() const;
Note: See TracChangeset
for help on using the changeset viewer.