Changeset 235780 in webkit
- Timestamp:
- Sep 6, 2018 10:55:15 PM (6 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r235777 r235780 1 2018-09-06 Ryosuke Niwa <rniwa@webkit.org> 2 3 ShadowRoot should have its own node flag 4 https://bugs.webkit.org/show_bug.cgi?id=189392 5 6 Reviewed by Antti Koivisto. 7 8 Added IsShadowRootFlag and IsDocumentNodeFlag, and removed IsDocumentFragmentFlag and IsStyledElementFlag. 9 Also re-ordered flags to group flags used by subclasses below ones directly used by Node in 10 accordinate with the comment. 11 12 No new tests since there should be no behavioral change. 13 14 * dom/ContainerNode.h: 15 (WebCore::Node::isTreeScope const): Deleted. 16 * dom/Node.h: 17 (WebCore::Node::isStyledElement const): Check if this is a HTML, SVG, or MathML element instead. 18 (WebCore::Node::isDocumentNode const): Simply check IsDocumentNodeFlag. 19 (WebCore::Node::isTreeScope const): Check if this is a document or a shadow root Instead of comparing 20 the tree scope to this. 21 (WebCore::Node::isDocumentFragment const): Check if this is a container node which is neither document, 22 element, nor shadow root. 23 (WebCore::Node::isShadowRoot const): Simply check IsShadowRootFlag. This is the change needed to fix 24 the blockign bug 166748. 25 (WebCore::Node::flagIsShadowRoot): Added. Will be used in the bug 166748. 26 1 27 2018-09-06 Zalan Bujtas <zalan@apple.com> 2 28 -
trunk/Source/WebCore/dom/ContainerNode.h
r229694 r235780 193 193 } 194 194 195 inline bool Node::isTreeScope() const196 {197 return &treeScope().rootNode() == this;198 }199 200 195 inline Node& Node::rootNode() const 201 196 { -
trunk/Source/WebCore/dom/Node.h
r232178 r235780 213 213 virtual bool isWebVTTElement() const { return false; } 214 214 #endif 215 bool isStyledElement() const { return getFlag(Is StyledElementFlag); }215 bool isStyledElement() const { return getFlag(IsHTMLFlag) || getFlag(IsSVGFlag) || getFlag(IsMathMLFlag); } 216 216 virtual bool isAttributeNode() const { return false; } 217 217 virtual bool isCharacterDataNode() const { return false; } … … 223 223 #endif 224 224 225 bool isDocumentNode() const { return getFlag(Is ContainerFlag) && !getFlag(IsElementFlag) && !getFlag(IsDocumentFragmentFlag); }226 bool isTreeScope() const ;227 bool isDocumentFragment() const { return getFlag(Is DocumentFragmentFlag); }228 bool isShadowRoot() const { return isDocumentFragment() && isTreeScope(); }225 bool isDocumentNode() const { return getFlag(IsDocumentNodeFlag); } 226 bool isTreeScope() const { return getFlag(IsDocumentNodeFlag) || getFlag(IsShadowRootFlag); } 227 bool isDocumentFragment() const { return getFlag(IsContainerFlag) && !(getFlag(IsElementFlag) || getFlag(IsDocumentNodeFlag)); } 228 bool isShadowRoot() const { return getFlag(IsShadowRootFlag); } 229 229 230 230 bool hasCustomStyleResolveCallbacks() const { return getFlag(HasCustomStyleResolveCallbacksFlag); } … … 539 539 static int32_t flagIsContainer() { return IsContainerFlag; } 540 540 static int32_t flagIsElement() { return IsElementFlag; } 541 static int32_t flagIsShadowRoot() { return IsShadowRootFlag; } 541 542 static int32_t flagIsHTML() { return IsHTMLFlag; } 542 543 static int32_t flagIsLink() { return IsLinkFlag; } … … 556 557 IsContainerFlag = 1 << 1, 557 558 IsElementFlag = 1 << 2, 558 IsStyledElementFlag = 1 << 3, 559 IsHTMLFlag = 1 << 4, 560 IsSVGFlag = 1 << 5, 561 DescendantsAffectedByPreviousSiblingFlag = 1 << 6, 562 ChildNeedsStyleRecalcFlag = 1 << 7, 563 IsConnectedFlag = 1 << 8, 564 IsLinkFlag = 1 << 9, 565 IsUserActionElement = 1 << 10, 566 HasRareDataFlag = 1 << 11, 567 IsDocumentFragmentFlag = 1 << 12, 559 IsHTMLFlag = 1 << 3, 560 IsSVGFlag = 1 << 4, 561 IsMathMLFlag = 1 << 5, 562 IsConnectedFlag = 1 << 6, 563 IsInShadowTreeFlag = 1 << 7, 564 IsDocumentNodeFlag = 1 << 8, 565 IsShadowRootFlag = 1 << 9, 566 HasRareDataFlag = 1 << 10, 567 HasEventTargetDataFlag = 1 << 11, 568 568 569 569 // These bits are used by derived classes, pulled up here so they can 570 570 // be stored in the same memory word as the Node bits above. 571 ChildNeedsStyleRecalcFlag = 1 << 12, // ContainerNode 572 571 573 IsParsingChildrenFinishedFlag = 1 << 13, // Element 572 574 StyleValidityShift = 14, … … 577 579 HasSyntheticAttrChildNodesFlag = 1 << 19, 578 580 HasCustomStyleResolveCallbacksFlag = 1 << 20, 579 HasEventTargetDataFlag = 1 << 21,581 DescendantsAffectedByPreviousSiblingFlag = 1 << 21, 580 582 IsCustomElement = 1 << 22, 581 Is InShadowTreeFlag = 1 << 23,582 Is MathMLFlag= 1 << 24,583 IsLinkFlag = 1 << 23, 584 IsUserActionElement = 1 << 24, 583 585 584 586 ChildrenAffectedByFirstChildRulesFlag = 1 << 25, … … 610 612 CreateElement = CreateContainer | IsElementFlag, 611 613 CreatePseudoElement = CreateElement | IsConnectedFlag, 612 CreateShadowRoot = CreateContainer | Is DocumentFragmentFlag | IsInShadowTreeFlag,613 CreateDocumentFragment = CreateContainer | IsDocumentFragmentFlag,614 Create StyledElement = CreateElement | IsStyledElementFlag,615 Create HTMLElement = CreateStyledElement | IsHTMLFlag,616 Create SVGElement = CreateStyledElement | IsSVGFlag | HasCustomStyleResolveCallbacksFlag,617 CreateDocument = CreateContainer | Is ConnectedFlag,614 CreateShadowRoot = CreateContainer | IsShadowRootFlag | IsInShadowTreeFlag, 615 CreateDocumentFragment = CreateContainer, 616 CreateHTMLElement = CreateElement | IsHTMLFlag, 617 CreateSVGElement = CreateElement | IsSVGFlag | HasCustomStyleResolveCallbacksFlag, 618 CreateMathMLElement = CreateElement | IsMathMLFlag, 619 CreateDocument = CreateContainer | IsDocumentNodeFlag | IsConnectedFlag, 618 620 CreateEditingText = CreateText | IsEditingTextOrUndefinedCustomElementFlag, 619 CreateMathMLElement = CreateStyledElement | IsMathMLFlag620 621 }; 621 622 Node(Document&, ConstructionType);
Note: See TracChangeset
for help on using the changeset viewer.