Changeset 266776 in webkit
- Timestamp:
- Sep 9, 2020, 2:03:48 AM (5 years ago)
- Location:
- trunk/Source
- Files:
-
- 10 edited
-
WTF/ChangeLog (modified) (1 diff)
-
WTF/wtf/OptionSet.h (modified) (1 diff)
-
WebCore/ChangeLog (modified) (1 diff)
-
WebCore/dom/CharacterData.h (modified) (2 diffs)
-
WebCore/dom/Comment.cpp (modified) (1 diff)
-
WebCore/dom/Element.cpp (modified) (4 diffs)
-
WebCore/dom/Element.h (modified) (3 diffs)
-
WebCore/dom/Node.cpp (modified) (2 diffs)
-
WebCore/dom/Node.h (modified) (15 diffs)
-
WebCore/dom/ProcessingInstruction.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WTF/ChangeLog
r266713 r266776 1 2020-09-08 Ryosuke Niwa <rniwa@webkit.org> 2 3 Node flags should be an OptionSet 4 https://bugs.webkit.org/show_bug.cgi?id=216305 5 6 Reviewed by Antti Koivisto. 7 8 * wtf/OptionSet.h: 9 (WTF::OptionSet::set): Added. 10 1 11 2020-09-06 Ryosuke Niwa <rniwa@webkit.org> 2 12 -
trunk/Source/WTF/wtf/OptionSet.h
r264277 r266776 194 194 } 195 195 196 constexpr void set(OptionSet optionSet, bool value) 197 { 198 m_storage = (m_storage & ~optionSet.m_storage) | (-static_cast<StorageType>(value) & optionSet.m_storage); 199 } 200 196 201 constexpr bool hasExactlyOneBitSet() const 197 202 { -
trunk/Source/WebCore/ChangeLog
r266769 r266776 1 2020-09-08 Ryosuke Niwa <rniwa@webkit.org> 2 3 Node flags should be an OptionSet 4 https://bugs.webkit.org/show_bug.cgi?id=216305 5 6 Reviewed by Antti Koivisto. 7 8 This patch renames NodeFlags to NodeFlag and turns into an enum class and changes the type of 9 m_nodeFlags from uint32_t to OptionSet<NodeFlag> as there is no state stored there after r266769. 10 11 This patch also introduces two new NodeFlag for identifying CharacterData and DocumentFragment 12 to simplify the type check conditions for these nodes now that we have plenty of free bits. 13 14 No new tests since there should be no behavioral change. 15 16 * dom/CharacterData.h: 17 (WebCore::CharacterData::CharacterData): Sets NodeFlag::IsContainerNode via CreateCharacterData. 18 (WebCore::CharacterData::virtualIsCharacterData): Deleted. 19 * dom/Comment.cpp: 20 (WebCore::Comment::Comment): Ditto. 21 * dom/Element.cpp: 22 (WebCore::Element::setHasFocusWithin): 23 (WebCore::Element::removedFromAncestor): 24 (WebCore::Element::setContainsFullScreenElement): 25 (WebCore::Element::createElementIdentifier): 26 * dom/Element.h: 27 (WebCore::Element::hasFocusWithin const): 28 (WebCore::Element::hasPendingResources const): 29 (WebCore::Element::setHasPendingResources): 30 (WebCore::Element::clearHasPendingResources): 31 (WebCore::Element::hasCSSAnimation const): 32 (WebCore::Element::setHasCSSAnimation): 33 (WebCore::Element::clearHasCSSAnimation): 34 (WebCore::Element::containsFullScreenElement const): 35 * dom/Node.cpp: 36 (WebCore::Node::insertedIntoAncestor): 37 (WebCore::Node::removedFromAncestor): 38 * dom/Node.h: 39 (WebCore::Node::isElementNode const): 40 (WebCore::Node::isContainerNode const): 41 (WebCore::Node::isTextNode const): 42 (WebCore::Node::isHTMLElement const): 43 (WebCore::Node::isSVGElement const): 44 (WebCore::Node::isMathMLElement const): 45 (WebCore::Node::isStyledElement const): 46 (WebCore::Node::isCharacterDataNode const): Check the newly added NodeFlag::IsContainerNode. 47 (WebCore::Node::isDocumentNode const): 48 (WebCore::Node::isTreeScope const): 49 (WebCore::Node::isDocumentFragment const):: Check the newly added NodeFlag::IsDocumentFragment. 50 (WebCore::Node::isShadowRoot const): 51 (WebCore::Node::hasCustomStyleResolveCallbacks const): 52 (WebCore::Node::hasSyntheticAttrChildNodes const): 53 (WebCore::Node::setHasSyntheticAttrChildNodes): 54 (WebCore::Node::selfOrAncestorHasDirAutoAttribute const): 55 (WebCore::Node::setSelfOrAncestorHasDirAutoAttribute): 56 (WebCore::Node::isUserActionElement const): 57 (WebCore::Node::setUserActionElement): 58 (WebCore::Node::isEditingText const): Removed the check for IsTextFlag since this is no longer needed 59 after r266769 as no longer share the bit for IsEditingText with an unknown custom element. 60 (WebCore::Node::isLink const): 61 (WebCore::Node::setIsLink): 62 (WebCore::Node::hasEventTargetData const): 63 (WebCore::Node::setHasEventTargetData): 64 (WebCore::Node::isConnected const): 65 (WebCore::Node::isInShadowTree const): 66 (WebCore::Node::isInTreeScope const): 67 (WebCore::Node::flagIsText): 68 (WebCore::Node::flagIsContainer): 69 (WebCore::Node::flagIsElement): 70 (WebCore::Node::flagIsShadowRoot): 71 (WebCore::Node::flagIsHTML): 72 (WebCore::Node::flagIsLink): 73 (WebCore::Node::flagHasFocusWithin): 74 (WebCore::Node::flagIsParsingChildrenFinished): 75 (WebCore::Node::NodeFlag): Renamed from NodeFlags and made it an enum class, and introduced IsCharacterData 76 and IsDocumentFragment and removed "Flag" suffix from various flags. 77 (WebCore::Node::hasNodeFlag const): Renamed from getFlag for clarity. 78 (WebCore::Node::setNodeFlag const): Ditto from setFlag. Also merge the two versions of setFlag one of which 79 took a boolean arugment as the first argument by making this a second optional argument. 80 (WebCore::Node::clearNodeFlag const): Ditto. 81 (WebCore::Node::isParsingChildrenFinished const): 82 (WebCore::Node::setIsParsingChildrenFinished): 83 (WebCore::Node::clearIsParsingChildrenFinished): 84 (WebCore::Node::ConstructionType): This is now an alias to OptionSet<NodeFlag> instead of a separate enum. 85 (WebCore::Node::setHasCustomStyleResolveCallbacks): 86 (WebCore::Node::virtualIsCharacterData const): Deleted. 87 * dom/ProcessingInstruction.cpp: 88 (WebCore::ProcessingInstruction::ProcessingInstruction): Sets NodeFlag::IsContainerNode via CharacterData's 89 constructor's default argument value. 90 1 91 2020-09-08 Ryosuke Niwa <rniwa@webkit.org> 2 92 -
trunk/Source/WebCore/dom/CharacterData.h
r264305 r266776 47 47 48 48 protected: 49 CharacterData(Document& document, const String& text, ConstructionType type )49 CharacterData(Document& document, const String& text, ConstructionType type = CreateCharacterData) 50 50 : Node(document, type) 51 51 , m_data(!text.isNull() ? text : emptyString()) 52 52 { 53 ASSERT(type == Create Other|| type == CreateText || type == CreateEditingText);53 ASSERT(type == CreateCharacterData || type == CreateText || type == CreateEditingText); 54 54 } 55 55 … … 64 64 String nodeValue() const final; 65 65 ExceptionOr<void> setNodeValue(const String&) final; 66 bool virtualIsCharacterData() const final { return true; }67 66 void notifyParentAfterChange(ContainerNode::ChildChangeSource); 68 67 -
trunk/Source/WebCore/dom/Comment.cpp
r233122 r266776 31 31 32 32 inline Comment::Comment(Document& document, const String& text) 33 : CharacterData(document, text , CreateOther)33 : CharacterData(document, text) 34 34 { 35 35 } -
trunk/Source/WebCore/dom/Element.cpp
r266769 r266776 742 742 { 743 743 Style::PseudoClassChangeInvalidation styleInvalidation(*this, CSSSelector::PseudoClassFocusWithin); 744 set Flag(flag, HasFocusWithin);744 setNodeFlag(NodeFlag::HasFocusWithin, flag); 745 745 } 746 746 } … … 2292 2292 #endif 2293 2293 2294 if ( getFlag(HasElementIdentifierFlag)) {2294 if (hasNodeFlag(NodeFlag::HasElementIdentifier)) { 2295 2295 document().identifiedElementWasRemovedFromDocument(*this); 2296 clear Flag(HasElementIdentifierFlag);2296 clearNodeFlag(NodeFlag::HasElementIdentifier); 2297 2297 } 2298 2298 } … … 3750 3750 { 3751 3751 if (flag) 3752 set Flag(ContainsFullScreenElementFlag);3752 setNodeFlag(NodeFlag::ContainsFullScreenElement); 3753 3753 else 3754 clear Flag(ContainsFullScreenElementFlag);3754 clearNodeFlag(NodeFlag::ContainsFullScreenElement); 3755 3755 invalidateStyleAndLayerComposition(); 3756 3756 } … … 4606 4606 ElementIdentifier Element::createElementIdentifier() 4607 4607 { 4608 ASSERT(! getFlag(HasElementIdentifierFlag));4609 set Flag(HasElementIdentifierFlag);4608 ASSERT(!hasNodeFlag(NodeFlag::HasElementIdentifier)); 4609 setNodeFlag(NodeFlag::HasElementIdentifier); 4610 4610 return ElementIdentifier::generate(); 4611 4611 } -
trunk/Source/WebCore/dom/Element.h
r266714 r266776 321 321 bool focused() const { return isUserActionElement() && isUserActionElementFocused(); } 322 322 bool isBeingDragged() const { return isUserActionElement() && isUserActionElementDragged(); } 323 bool hasFocusWithin() const { return getFlag(HasFocusWithin); };323 bool hasFocusWithin() const { return hasNodeFlag(NodeFlag::HasFocusWithin); }; 324 324 325 325 virtual void setActive(bool = true, bool pause = false); … … 482 482 virtual bool childShouldCreateRenderer(const Node&) const; 483 483 484 bool hasPendingResources() const { return getFlag(HasPendingResourcesFlag); }485 void setHasPendingResources() { set Flag(HasPendingResourcesFlag); }486 void clearHasPendingResources() { clear Flag(HasPendingResourcesFlag); }484 bool hasPendingResources() const { return hasNodeFlag(NodeFlag::HasPendingResources); } 485 void setHasPendingResources() { setNodeFlag(NodeFlag::HasPendingResources); } 486 void clearHasPendingResources() { clearNodeFlag(NodeFlag::HasPendingResources); } 487 487 virtual void buildPendingResource() { }; 488 488 489 bool hasCSSAnimation() const { return getFlag(HasCSSAnimationFlag); }490 void setHasCSSAnimation() { set Flag(HasCSSAnimationFlag); }491 void clearHasCSSAnimation() { clear Flag(HasCSSAnimationFlag); }489 bool hasCSSAnimation() const { return hasNodeFlag(NodeFlag::HasCSSAnimation); } 490 void setHasCSSAnimation() { setNodeFlag(NodeFlag::HasCSSAnimation); } 491 void clearHasCSSAnimation() { clearNodeFlag(NodeFlag::HasCSSAnimation); } 492 492 493 493 KeyframeEffectStack* keyframeEffectStack() const; … … 514 514 515 515 #if ENABLE(FULLSCREEN_API) 516 bool containsFullScreenElement() const { return getFlag(ContainsFullScreenElementFlag); }516 bool containsFullScreenElement() const { return hasNodeFlag(NodeFlag::ContainsFullScreenElement); } 517 517 void setContainsFullScreenElement(bool); 518 518 void setContainsFullScreenElementOnAncestorsCrossingFrameBoundaries(bool); -
trunk/Source/WebCore/dom/Node.cpp
r266769 r266776 1299 1299 { 1300 1300 if (insertionType.connectedToDocument) 1301 set Flag(IsConnectedFlag);1301 setNodeFlag(NodeFlag::IsConnected); 1302 1302 if (parentOfInsertedTree.isInShadowTree()) 1303 set Flag(IsInShadowTreeFlag);1303 setNodeFlag(NodeFlag::IsInShadowTree); 1304 1304 1305 1305 invalidateStyle(Style::Validity::SubtreeAndRenderersInvalid); … … 1311 1311 { 1312 1312 if (removalType.disconnectedFromDocument) 1313 clear Flag(IsConnectedFlag);1313 clearNodeFlag(NodeFlag::IsConnected); 1314 1314 if (isInShadowTree() && !treeScope().rootNode().isShadowRoot()) 1315 clear Flag(IsInShadowTreeFlag);1315 clearNodeFlag(NodeFlag::IsInShadowTree); 1316 1316 if (removalType.disconnectedFromDocument) { 1317 1317 if (auto* cache = oldParentOfRemovedTree.document().existingAXObjectCache()) -
trunk/Source/WebCore/dom/Node.h
r266769 r266776 187 187 // Other methods (not part of DOM) 188 188 189 bool isElementNode() const { return getFlag(IsElementFlag); }190 bool isContainerNode() const { return getFlag(IsContainerFlag); }191 bool isTextNode() const { return getFlag(IsTextFlag); }192 bool isHTMLElement() const { return getFlag(IsHTMLFlag); }193 bool isSVGElement() const { return getFlag(IsSVGFlag); }194 bool isMathMLElement() const { return getFlag(IsMathMLFlag); }189 bool isElementNode() const { return hasNodeFlag(NodeFlag::IsElement); } 190 bool isContainerNode() const { return hasNodeFlag(NodeFlag::IsContainerNode); } 191 bool isTextNode() const { return hasNodeFlag(NodeFlag::IsText); } 192 bool isHTMLElement() const { return hasNodeFlag(NodeFlag::IsHTMLElement); } 193 bool isSVGElement() const { return hasNodeFlag(NodeFlag::IsSVGElement); } 194 bool isMathMLElement() const { return hasNodeFlag(NodeFlag::IsMathMLElement); } 195 195 196 196 bool isPseudoElement() const { return pseudoId() != PseudoId::None; } … … 202 202 virtual bool isWebVTTElement() const { return false; } 203 203 #endif 204 bool isStyledElement() const { return getFlag(IsHTMLFlag) || getFlag(IsSVGFlag) || getFlag(IsMathMLFlag); }204 bool isStyledElement() const { return hasNodeFlag(NodeFlag::IsHTMLElement) || hasNodeFlag(NodeFlag::IsSVGElement) || hasNodeFlag(NodeFlag::IsMathMLElement); } 205 205 virtual bool isAttributeNode() const { return false; } 206 bool isCharacterDataNode() const { return !isContainerNode() && (isTextNode() || virtualIsCharacterData()); }206 bool isCharacterDataNode() const { return hasNodeFlag(NodeFlag::IsCharacterData); } 207 207 virtual bool isFrameOwnerElement() const { return false; } 208 208 virtual bool isPluginElement() const { return false; } … … 212 212 #endif 213 213 214 bool isDocumentNode() const { return getFlag(IsDocumentNodeFlag); }215 bool isTreeScope() const { return getFlag(IsDocumentNodeFlag) || getFlag(IsShadowRootFlag); }216 bool isDocumentFragment() const { return getFlag(IsContainerFlag) && !(getFlag(IsElementFlag) || getFlag(IsDocumentNodeFlag)); }217 bool isShadowRoot() const { return getFlag(IsShadowRootFlag); }218 219 bool hasCustomStyleResolveCallbacks() const { return getFlag(HasCustomStyleResolveCallbacksFlag); }220 221 bool hasSyntheticAttrChildNodes() const { return getFlag(HasSyntheticAttrChildNodesFlag); }222 void setHasSyntheticAttrChildNodes(bool flag) { set Flag(flag, HasSyntheticAttrChildNodesFlag); }214 bool isDocumentNode() const { return hasNodeFlag(NodeFlag::IsDocumentNode); } 215 bool isTreeScope() const { return hasNodeFlag(NodeFlag::IsDocumentNode) || hasNodeFlag(NodeFlag::IsShadowRoot); } 216 bool isDocumentFragment() const { return hasNodeFlag(NodeFlag::IsDocumentFragment); } 217 bool isShadowRoot() const { return hasNodeFlag(NodeFlag::IsShadowRoot); } 218 219 bool hasCustomStyleResolveCallbacks() const { return hasNodeFlag(NodeFlag::HasCustomStyleResolveCallbacks); } 220 221 bool hasSyntheticAttrChildNodes() const { return hasNodeFlag(NodeFlag::HasSyntheticAttrChildNodes); } 222 void setHasSyntheticAttrChildNodes(bool flag) { setNodeFlag(NodeFlag::HasSyntheticAttrChildNodes, flag); } 223 223 224 224 // If this node is in a shadow tree, returns its shadow host. Otherwise, returns null. … … 261 261 ContainerNode* nonShadowBoundaryParentNode() const; 262 262 263 bool selfOrAncestorHasDirAutoAttribute() const { return getFlag(SelfOrAncestorHasDirAutoFlag); }264 void setSelfOrAncestorHasDirAutoAttribute(bool flag) { set Flag(flag, SelfOrAncestorHasDirAutoFlag); }263 bool selfOrAncestorHasDirAutoAttribute() const { return hasNodeFlag(NodeFlag::SelfOrAncestorHasDirAuto); } 264 void setSelfOrAncestorHasDirAutoAttribute(bool flag) { setNodeFlag(NodeFlag::SelfOrAncestorHasDirAuto, flag); } 265 265 266 266 // Returns the enclosing event parent Element (or self) that, when clicked, would trigger a navigation. … … 290 290 virtual void startLoadingDynamicSheet() { ASSERT_NOT_REACHED(); } 291 291 292 bool isUserActionElement() const { return getFlag(IsUserActionElement); }293 void setUserActionElement(bool flag) { set Flag(flag, IsUserActionElement); }292 bool isUserActionElement() const { return hasNodeFlag(NodeFlag::IsUserActionElement); } 293 void setUserActionElement(bool flag) { setNodeFlag(NodeFlag::IsUserActionElement, flag); } 294 294 295 295 bool inRenderedDocument() const; … … 298 298 bool styleResolutionShouldRecompositeLayer() const { return hasStyleFlag(NodeStyleFlag::StyleResolutionShouldRecompositeLayer); } 299 299 bool childNeedsStyleRecalc() const { return hasStyleFlag(NodeStyleFlag::DescendantNeedsStyleResolution); } 300 bool isEditingText() const { return getFlag(IsTextFlag) && getFlag(IsEditingText); }300 bool isEditingText() const { return hasNodeFlag(NodeFlag::IsEditingText); } 301 301 302 302 void setChildNeedsStyleRecalc() { setStyleFlag(NodeStyleFlag::DescendantNeedsStyleResolution); } … … 305 305 void setHasValidStyle(); 306 306 307 bool isLink() const { return getFlag(IsLinkFlag); }308 void setIsLink(bool flag) { set Flag(flag, IsLinkFlag); }309 310 bool hasEventTargetData() const { return getFlag(HasEventTargetDataFlag); }311 void setHasEventTargetData(bool flag) { set Flag(flag, HasEventTargetDataFlag); }307 bool isLink() const { return hasNodeFlag(NodeFlag::IsLink); } 308 void setIsLink(bool flag) { setNodeFlag(NodeFlag::IsLink, flag); } 309 310 bool hasEventTargetData() const { return hasNodeFlag(NodeFlag::HasEventTargetData); } 311 void setHasEventTargetData(bool flag) { setNodeFlag(NodeFlag::HasEventTargetData, flag); } 312 312 313 313 WEBCORE_EXPORT bool isContentEditable(); … … 357 357 // Returns true if this node is associated with a document and is in its associated document's 358 358 // node tree, false otherwise (https://dom.spec.whatwg.org/#connected). 359 bool isConnected() const { return getFlag(IsConnectedFlag); }359 bool isConnected() const { return hasNodeFlag(NodeFlag::IsConnected); } 360 360 bool isInUserAgentShadowTree() const; 361 bool isInShadowTree() const { return getFlag(IsInShadowTreeFlag); }362 bool isInTreeScope() const { return getFlag(static_cast<NodeFlags>(IsConnectedFlag | IsInShadowTreeFlag)); }361 bool isInShadowTree() const { return hasNodeFlag(NodeFlag::IsInShadowTree); } 362 bool isInTreeScope() const { return hasNodeFlag(NodeFlag::IsConnected) || hasNodeFlag(NodeFlag::IsInShadowTree); } 363 363 364 364 bool isDocumentTypeNode() const { return nodeType() == DOCUMENT_TYPE_NODE; } … … 507 507 static uint32_t rareDataPointerMask() { return -1; } 508 508 #endif 509 static int32_t flagIsText() { return IsTextFlag; }510 static int32_t flagIsContainer() { return IsContainerFlag; }511 static int32_t flagIsElement() { return IsElementFlag; }512 static int32_t flagIsShadowRoot() { return IsShadowRootFlag; }513 static int32_t flagIsHTML() { return IsHTMLFlag; }514 static int32_t flagIsLink() { return IsLinkFlag; }515 static int32_t flagHasFocusWithin() { return HasFocusWithin; }516 static int32_t flagIsParsingChildrenFinished() { return IsParsingChildrenFinishedFlag; }509 static int32_t flagIsText() { return static_cast<int32_t>(NodeFlag::IsText); } 510 static int32_t flagIsContainer() { return static_cast<int32_t>(NodeFlag::IsContainerNode); } 511 static int32_t flagIsElement() { return static_cast<int32_t>(NodeFlag::IsElement); } 512 static int32_t flagIsShadowRoot() { return static_cast<int32_t>(NodeFlag::IsShadowRoot); } 513 static int32_t flagIsHTML() { return static_cast<int32_t>(NodeFlag::IsHTMLElement); } 514 static int32_t flagIsLink() { return static_cast<int32_t>(NodeFlag::IsLink); } 515 static int32_t flagHasFocusWithin() { return static_cast<int32_t>(NodeFlag::HasFocusWithin); } 516 static int32_t flagIsParsingChildrenFinished() { return static_cast<int32_t>(NodeFlag::IsParsingChildrenFinished); } 517 517 #endif // ENABLE(JIT) 518 518 519 519 protected: 520 enum NodeFlags{521 Is TextFlag = 1,522 Is ContainerFlag= 1 << 1,523 Is ElementFlag= 1 << 2,524 Is HTMLFlag= 1 << 3,525 Is SVGFlag= 1 << 4,526 Is MathMLFlag= 1 << 5,527 Is DocumentNodeFlag= 1 << 6,528 Is ShadowRootFlag= 1 << 7,529 Is ConnectedFlag= 1 << 8,530 Is InShadowTreeFlag= 1 << 9,531 // UnusedFlag= 1 << 10,532 HasEventTargetDataFlag= 1 << 11,533 // UnusedFlag= 1 << 12,520 enum class NodeFlag : uint32_t { 521 IsCharacterData = 1 << 0, 522 IsText = 1 << 1, 523 IsContainerNode = 1 << 2, 524 IsElement = 1 << 3, 525 IsHTMLElement = 1 << 4, 526 IsSVGElement = 1 << 5, 527 IsMathMLElement = 1 << 6, 528 IsDocumentNode = 1 << 7, 529 IsDocumentFragment = 1 << 8, 530 IsShadowRoot = 1 << 9, 531 IsConnected = 1 << 10, 532 IsInShadowTree = 1 << 11, 533 HasEventTargetData = 1 << 12, 534 534 // UnusedFlag = 1 << 13, 535 535 // UnusedFlag = 1 << 14, … … 539 539 IsEditingText = 1 << 15, // Text 540 540 HasFocusWithin = 1 << 16, // Element 541 IsLink Flag= 1 << 17,541 IsLink = 1 << 17, 542 542 IsUserActionElement = 1 << 18, 543 IsParsingChildrenFinished Flag= 1 << 19,544 HasSyntheticAttrChildNodes Flag= 1 << 20,545 SelfOrAncestorHasDirAuto Flag= 1 << 21,546 547 HasCustomStyleResolveCallbacks Flag= 1 << 22,548 549 HasPendingResources Flag= 1 << 23,550 HasCSSAnimation Flag= 1 << 24,551 HasElementIdentifier Flag= 1 << 25,543 IsParsingChildrenFinished = 1 << 19, 544 HasSyntheticAttrChildNodes = 1 << 20, 545 SelfOrAncestorHasDirAuto = 1 << 21, 546 547 HasCustomStyleResolveCallbacks = 1 << 22, 548 549 HasPendingResources = 1 << 23, 550 HasCSSAnimation = 1 << 24, 551 HasElementIdentifier = 1 << 25, 552 552 #if ENABLE(FULLSCREEN_API) 553 ContainsFullScreenElement Flag= 1 << 26,553 ContainsFullScreenElement = 1 << 26, 554 554 #endif 555 555 556 556 // Bits 27-31 are free. 557 558 DefaultNodeFlags = IsParsingChildrenFinishedFlag559 557 }; 560 558 … … 579 577 }; 580 578 581 bool getFlag(NodeFlags mask) const { return m_nodeFlags & mask; } 582 void setFlag(bool f, NodeFlags mask) const { m_nodeFlags = (m_nodeFlags & ~mask) | (-(int32_t)f & mask); } 583 void setFlag(NodeFlags mask) const { m_nodeFlags |= mask; } 584 void clearFlag(NodeFlags mask) const { m_nodeFlags &= ~mask; } 579 bool hasNodeFlag(NodeFlag flag) const { return m_nodeFlags.contains(flag); } 580 void setNodeFlag(NodeFlag flag, bool value = true) const { m_nodeFlags.set(flag, value); } 581 void clearNodeFlag(NodeFlag flag) const { m_nodeFlags.remove(flag); } 585 582 586 583 RareDataBitFields rareDataBitfields() const { return bitwise_cast<RareDataBitFields>(m_rareDataWithBitfields.type()); } … … 593 590 void setCustomElementState(CustomElementState); 594 591 595 bool isParsingChildrenFinished() const { return getFlag(IsParsingChildrenFinishedFlag); } 596 void setIsParsingChildrenFinished() { setFlag(IsParsingChildrenFinishedFlag); } 597 void clearIsParsingChildrenFinished() { clearFlag(IsParsingChildrenFinishedFlag); } 598 599 enum ConstructionType { 600 CreateOther = DefaultNodeFlags, 601 CreateText = DefaultNodeFlags | IsTextFlag, 602 CreateContainer = DefaultNodeFlags | IsContainerFlag, 603 CreateElement = CreateContainer | IsElementFlag, 604 CreatePseudoElement = CreateElement | IsConnectedFlag, 605 CreateShadowRoot = CreateContainer | IsShadowRootFlag | IsInShadowTreeFlag, 606 CreateDocumentFragment = CreateContainer, 607 CreateHTMLElement = CreateElement | IsHTMLFlag, 608 CreateSVGElement = CreateElement | IsSVGFlag | HasCustomStyleResolveCallbacksFlag, 609 CreateMathMLElement = CreateElement | IsMathMLFlag, 610 CreateDocument = CreateContainer | IsDocumentNodeFlag | IsConnectedFlag, 611 CreateEditingText = CreateText | IsEditingText, 612 }; 592 bool isParsingChildrenFinished() const { return hasNodeFlag(NodeFlag::IsParsingChildrenFinished); } 593 void setIsParsingChildrenFinished() { setNodeFlag(NodeFlag::IsParsingChildrenFinished); } 594 void clearIsParsingChildrenFinished() { clearNodeFlag(NodeFlag::IsParsingChildrenFinished); } 595 596 constexpr static auto DefaultNodeFlags = OptionSet<NodeFlag>(NodeFlag::IsParsingChildrenFinished); 597 constexpr static auto CreateOther = DefaultNodeFlags; 598 constexpr static auto CreateCharacterData = DefaultNodeFlags | NodeFlag::IsCharacterData; 599 constexpr static auto CreateText = CreateCharacterData | NodeFlag::IsText; 600 constexpr static auto CreateContainer = DefaultNodeFlags | NodeFlag::IsContainerNode; 601 constexpr static auto CreateElement = CreateContainer | NodeFlag::IsElement; 602 constexpr static auto CreatePseudoElement = CreateElement | NodeFlag::IsConnected; 603 constexpr static auto CreateDocumentFragment = CreateContainer | NodeFlag::IsDocumentFragment; 604 constexpr static auto CreateShadowRoot = CreateDocumentFragment | NodeFlag::IsShadowRoot | NodeFlag::IsInShadowTree; 605 constexpr static auto CreateHTMLElement = CreateElement | NodeFlag::IsHTMLElement; 606 constexpr static auto CreateSVGElement = CreateElement | NodeFlag::IsSVGElement | NodeFlag::HasCustomStyleResolveCallbacks; 607 constexpr static auto CreateMathMLElement = CreateElement | NodeFlag::IsMathMLElement; 608 constexpr static auto CreateDocument = CreateContainer | NodeFlag::IsDocumentNode | NodeFlag::IsConnected; 609 constexpr static auto CreateEditingText = CreateText | NodeFlag::IsEditingText; 610 using ConstructionType = OptionSet<NodeFlag>; 613 611 Node(Document&, ConstructionType); 614 612 … … 678 676 void clearEventTargetData(); 679 677 680 void setHasCustomStyleResolveCallbacks() { set Flag(true, HasCustomStyleResolveCallbacksFlag); }678 void setHasCustomStyleResolveCallbacks() { setNodeFlag(NodeFlag::HasCustomStyleResolveCallbacks); } 681 679 682 680 void setTreeScope(TreeScope& scope) { m_treeScope = &scope; } … … 694 692 } 695 693 696 virtual bool virtualIsCharacterData() const { return false; }697 698 694 WEBCORE_EXPORT void removedLastRef(); 699 695 … … 721 717 722 718 mutable uint32_t m_refCountAndParentBit { s_refCountIncrement }; 723 mutable uint32_tm_nodeFlags;719 mutable OptionSet<NodeFlag> m_nodeFlags; 724 720 725 721 ContainerNode* m_parentNode { nullptr }; -
trunk/Source/WebCore/dom/ProcessingInstruction.cpp
r239427 r266776 45 45 46 46 inline ProcessingInstruction::ProcessingInstruction(Document& document, const String& target, const String& data) 47 : CharacterData(document, data , CreateOther)47 : CharacterData(document, data) 48 48 , m_target(target) 49 49 {
Note:
See TracChangeset
for help on using the changeset viewer.