Changeset 151071 in webkit
- Timestamp:
- Jun 1, 2013 3:20:25 AM (11 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r151069 r151071 1 2013-06-01 Andreas Kling <akling@apple.com> 2 3 Move Node::hasName() to Element. 4 <http://webkit.org/b/117107> 5 6 Reviewed by Antti Koivisto. 7 8 A Node can't have attributes, and thus can't have a name. 9 Use a bit on ElementData instead of (half) a Node flag to track whether we have a name. 10 11 * dom/Element.cpp: 12 (WebCore::Element::attributeChanged): 13 (WebCore::ElementData::ElementData): 14 * dom/Element.h: 15 (WebCore::ElementData::hasName): 16 (WebCore::Element::hasName): 17 * dom/Node.h: 18 (WebCore::Node::isEditingText): 19 1 20 2013-06-01 Andreas Kling <akling@apple.com> 2 21 -
trunk/Source/WebCore/dom/Element.cpp
r150876 r151071 1028 1028 classAttributeChanged(newValue); 1029 1029 else if (name == HTMLNames::nameAttr) 1030 setHasName(!newValue.isNull());1030 elementData()->m_hasNameAttribute = newValue.isNull(); 1031 1031 else if (name == HTMLNames::pseudoAttr) 1032 1032 shouldInvalidateStyle |= testShouldInvalidateStyle && isInShadowTree(); … … 3194 3194 : m_isUnique(true) 3195 3195 , m_arraySize(0) 3196 , m_hasNameAttribute(false) 3196 3197 , m_presentationAttributeStyleIsDirty(false) 3197 3198 , m_styleAttributeIsDirty(false) … … 3205 3206 : m_isUnique(false) 3206 3207 , m_arraySize(arraySize) 3208 , m_hasNameAttribute(false) 3207 3209 , m_presentationAttributeStyleIsDirty(false) 3208 3210 , m_styleAttributeIsDirty(false) … … 3266 3268 : m_isUnique(isUnique) 3267 3269 , m_arraySize(isUnique ? 0 : other.length()) 3270 , m_hasNameAttribute(other.m_hasNameAttribute) 3268 3271 , m_presentationAttributeStyleIsDirty(other.m_presentationAttributeStyleIsDirty) 3269 3272 , m_styleAttributeIsDirty(other.m_styleAttributeIsDirty) -
trunk/Source/WebCore/dom/Element.h
r151069 r151071 84 84 bool hasID() const { return !m_idForStyleResolution.isNull(); } 85 85 bool hasClass() const { return !m_classNames.isNull(); } 86 bool hasName() const { return m_hasNameAttribute; } 86 87 87 88 bool isEquivalent(const ElementData* other) const; … … 95 96 96 97 unsigned m_isUnique : 1; 97 unsigned m_arraySize : 28; 98 unsigned m_arraySize : 27; 99 mutable unsigned m_hasNameAttribute : 1; 98 100 mutable unsigned m_presentationAttributeStyleIsDirty : 1; 99 101 mutable unsigned m_styleAttributeIsDirty : 1; … … 628 630 bool hasID() const; 629 631 bool hasClass() const; 632 bool hasName() const; 630 633 const SpaceSplitString& classNames() const; 631 634 … … 909 912 } 910 913 914 inline bool Element::hasName() const 915 { 916 return elementData() && elementData()->hasName(); 917 } 918 911 919 inline UniqueElementData* Element::ensureUniqueElementData() 912 920 { -
trunk/Source/WebCore/dom/Node.h
r151069 r151071 328 328 virtual void startLoadingDynamicSheet() { ASSERT_NOT_REACHED(); } 329 329 330 bool hasName() const { return !isTextNode() && getFlag(HasNameOrIsEditingTextFlag); }331 332 330 bool isUserActionElement() const { return getFlag(IsUserActionElement); } 333 331 void setUserActionElement(bool flag) { setFlag(flag, IsUserActionElement); } … … 339 337 bool childNeedsStyleRecalc() const { return getFlag(ChildNeedsStyleRecalcFlag); } 340 338 bool isLink() const { return getFlag(IsLinkFlag); } 341 bool isEditingText() const { return isTextNode() && getFlag(HasNameOrIsEditingTextFlag); } 342 343 void setHasName(bool f) { ASSERT(!isTextNode()); setFlag(f, HasNameOrIsEditingTextFlag); } 339 bool isEditingText() const { return getFlag(IsEditingTextFlag); } 340 344 341 void setChildNeedsStyleRecalc() { setFlag(ChildNeedsStyleRecalcFlag); } 345 342 void clearChildNeedsStyleRecalc() { clearFlag(ChildNeedsStyleRecalcFlag); } … … 662 659 SelfOrAncestorHasDirAutoFlag = 1 << 17, 663 660 664 HasNameOrIsEditingTextFlag = 1 << 18,661 IsEditingTextFlag = 1 << 18, 665 662 666 663 InNamedFlowFlag = 1 << 19, … … 696 693 CreateDocument = CreateContainer | InDocumentFlag, 697 694 CreateInsertionPoint = CreateHTMLElement | NeedsShadowTreeWalkerFlag, 698 CreateEditingText = CreateText | HasNameOrIsEditingTextFlag,695 CreateEditingText = CreateText | IsEditingTextFlag, 699 696 }; 700 697 Node(Document*, ConstructionType);
Note: See TracChangeset
for help on using the changeset viewer.