Title: [235780] trunk/Source/WebCore
Revision
235780
Author
[email protected]
Date
2018-09-06 22:55:15 -0700 (Thu, 06 Sep 2018)

Log Message

ShadowRoot should have its own node flag
https://bugs.webkit.org/show_bug.cgi?id=189392

Reviewed by Antti Koivisto.

Added IsShadowRootFlag and IsDocumentNodeFlag, and removed IsDocumentFragmentFlag and IsStyledElementFlag.
Also re-ordered flags to group flags used by subclasses below ones directly used by Node in
accordinate with the comment.

No new tests since there should be no behavioral change.

* dom/ContainerNode.h:
(WebCore::Node::isTreeScope const): Deleted.
* dom/Node.h:
(WebCore::Node::isStyledElement const): Check if this is a HTML, SVG, or MathML element instead.
(WebCore::Node::isDocumentNode const): Simply check IsDocumentNodeFlag.
(WebCore::Node::isTreeScope const): Check if this is a document or a shadow root Instead of comparing
the tree scope to this.
(WebCore::Node::isDocumentFragment const): Check if this is a container node which is neither document,
element, nor shadow root.
(WebCore::Node::isShadowRoot const): Simply check IsShadowRootFlag. This is the change needed to fix
the blockign bug 166748.
(WebCore::Node::flagIsShadowRoot): Added. Will be used in the bug 166748.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (235779 => 235780)


--- trunk/Source/WebCore/ChangeLog	2018-09-07 05:54:58 UTC (rev 235779)
+++ trunk/Source/WebCore/ChangeLog	2018-09-07 05:55:15 UTC (rev 235780)
@@ -1,3 +1,29 @@
+2018-09-06  Ryosuke Niwa  <[email protected]>
+
+        ShadowRoot should have its own node flag
+        https://bugs.webkit.org/show_bug.cgi?id=189392
+
+        Reviewed by Antti Koivisto.
+
+        Added IsShadowRootFlag and IsDocumentNodeFlag, and removed IsDocumentFragmentFlag and IsStyledElementFlag.
+        Also re-ordered flags to group flags used by subclasses below ones directly used by Node in
+        accordinate with the comment.
+
+        No new tests since there should be no behavioral change.
+
+        * dom/ContainerNode.h:
+        (WebCore::Node::isTreeScope const): Deleted.
+        * dom/Node.h:
+        (WebCore::Node::isStyledElement const): Check if this is a HTML, SVG, or MathML element instead.
+        (WebCore::Node::isDocumentNode const): Simply check IsDocumentNodeFlag.
+        (WebCore::Node::isTreeScope const): Check if this is a document or a shadow root Instead of comparing
+        the tree scope to this.
+        (WebCore::Node::isDocumentFragment const): Check if this is a container node which is neither document,
+        element, nor shadow root.
+        (WebCore::Node::isShadowRoot const): Simply check IsShadowRootFlag. This is the change needed to fix
+        the blockign bug 166748.
+        (WebCore::Node::flagIsShadowRoot): Added. Will be used in the bug 166748.
+
 2018-09-06  Zalan Bujtas  <[email protected]>
 
         [LFC] Inline replaced height calculation should use "used value"

Modified: trunk/Source/WebCore/dom/ContainerNode.h (235779 => 235780)


--- trunk/Source/WebCore/dom/ContainerNode.h	2018-09-07 05:54:58 UTC (rev 235779)
+++ trunk/Source/WebCore/dom/ContainerNode.h	2018-09-07 05:55:15 UTC (rev 235780)
@@ -192,11 +192,6 @@
     return downcast<ContainerNode>(*this).lastChild();
 }
 
-inline bool Node::isTreeScope() const
-{
-    return &treeScope().rootNode() == this;
-}
-
 inline Node& Node::rootNode() const
 {
     if (isInTreeScope())

Modified: trunk/Source/WebCore/dom/Node.h (235779 => 235780)


--- trunk/Source/WebCore/dom/Node.h	2018-09-07 05:54:58 UTC (rev 235779)
+++ trunk/Source/WebCore/dom/Node.h	2018-09-07 05:55:15 UTC (rev 235780)
@@ -212,7 +212,7 @@
 #if ENABLE(VIDEO_TRACK)
     virtual bool isWebVTTElement() const { return false; }
 #endif
-    bool isStyledElement() const { return getFlag(IsStyledElementFlag); }
+    bool isStyledElement() const { return getFlag(IsHTMLFlag) || getFlag(IsSVGFlag) || getFlag(IsMathMLFlag); }
     virtual bool isAttributeNode() const { return false; }
     virtual bool isCharacterDataNode() const { return false; }
     virtual bool isFrameOwnerElement() const { return false; }
@@ -222,10 +222,10 @@
     virtual bool isImageControlsButtonElement() const { return false; }
 #endif
 
-    bool isDocumentNode() const { return getFlag(IsContainerFlag) && !getFlag(IsElementFlag) && !getFlag(IsDocumentFragmentFlag); }
-    bool isTreeScope() const;
-    bool isDocumentFragment() const { return getFlag(IsDocumentFragmentFlag); }
-    bool isShadowRoot() const { return isDocumentFragment() && isTreeScope(); }
+    bool isDocumentNode() const { return getFlag(IsDocumentNodeFlag); }
+    bool isTreeScope() const { return getFlag(IsDocumentNodeFlag) || getFlag(IsShadowRootFlag); }
+    bool isDocumentFragment() const { return getFlag(IsContainerFlag) && !(getFlag(IsElementFlag) || getFlag(IsDocumentNodeFlag)); }
+    bool isShadowRoot() const { return getFlag(IsShadowRootFlag); }
 
     bool hasCustomStyleResolveCallbacks() const { return getFlag(HasCustomStyleResolveCallbacksFlag); }
 
@@ -538,6 +538,7 @@
     static int32_t flagIsText() { return IsTextFlag; }
     static int32_t flagIsContainer() { return IsContainerFlag; }
     static int32_t flagIsElement() { return IsElementFlag; }
+    static int32_t flagIsShadowRoot() { return IsShadowRootFlag; }
     static int32_t flagIsHTML() { return IsHTMLFlag; }
     static int32_t flagIsLink() { return IsLinkFlag; }
     static int32_t flagHasFocusWithin() { return HasFocusWithin; }
@@ -555,19 +556,20 @@
         IsTextFlag = 1,
         IsContainerFlag = 1 << 1,
         IsElementFlag = 1 << 2,
-        IsStyledElementFlag = 1 << 3,
-        IsHTMLFlag = 1 << 4,
-        IsSVGFlag = 1 << 5,
-        DescendantsAffectedByPreviousSiblingFlag = 1 << 6,
-        ChildNeedsStyleRecalcFlag = 1 << 7,
-        IsConnectedFlag = 1 << 8,
-        IsLinkFlag = 1 << 9,
-        IsUserActionElement = 1 << 10,
-        HasRareDataFlag = 1 << 11,
-        IsDocumentFragmentFlag = 1 << 12,
+        IsHTMLFlag = 1 << 3,
+        IsSVGFlag = 1 << 4,
+        IsMathMLFlag = 1 << 5,
+        IsConnectedFlag = 1 << 6,
+        IsInShadowTreeFlag = 1 << 7,
+        IsDocumentNodeFlag = 1 << 8,
+        IsShadowRootFlag = 1 << 9,
+        HasRareDataFlag = 1 << 10,
+        HasEventTargetDataFlag = 1 << 11,
 
         // These bits are used by derived classes, pulled up here so they can
         // be stored in the same memory word as the Node bits above.
+        ChildNeedsStyleRecalcFlag = 1 << 12, // ContainerNode
+
         IsParsingChildrenFinishedFlag = 1 << 13, // Element
         StyleValidityShift = 14,
         StyleValidityMask = 3 << StyleValidityShift,
@@ -576,10 +578,10 @@
         HasFocusWithin = 1 << 18,
         HasSyntheticAttrChildNodesFlag = 1 << 19,
         HasCustomStyleResolveCallbacksFlag = 1 << 20,
-        HasEventTargetDataFlag = 1 << 21,
+        DescendantsAffectedByPreviousSiblingFlag = 1 << 21,
         IsCustomElement = 1 << 22,
-        IsInShadowTreeFlag = 1 << 23,
-        IsMathMLFlag = 1 << 24,
+        IsLinkFlag = 1 << 23,
+        IsUserActionElement = 1 << 24,
 
         ChildrenAffectedByFirstChildRulesFlag = 1 << 25,
         ChildrenAffectedByLastChildRulesFlag = 1 << 26,
@@ -609,14 +611,13 @@
         CreateContainer = DefaultNodeFlags | IsContainerFlag, 
         CreateElement = CreateContainer | IsElementFlag, 
         CreatePseudoElement =  CreateElement | IsConnectedFlag,
-        CreateShadowRoot = CreateContainer | IsDocumentFragmentFlag | IsInShadowTreeFlag,
-        CreateDocumentFragment = CreateContainer | IsDocumentFragmentFlag,
-        CreateStyledElement = CreateElement | IsStyledElementFlag, 
-        CreateHTMLElement = CreateStyledElement | IsHTMLFlag,
-        CreateSVGElement = CreateStyledElement | IsSVGFlag | HasCustomStyleResolveCallbacksFlag,
-        CreateDocument = CreateContainer | IsConnectedFlag,
+        CreateShadowRoot = CreateContainer | IsShadowRootFlag | IsInShadowTreeFlag,
+        CreateDocumentFragment = CreateContainer,
+        CreateHTMLElement = CreateElement | IsHTMLFlag,
+        CreateSVGElement = CreateElement | IsSVGFlag | HasCustomStyleResolveCallbacksFlag,
+        CreateMathMLElement = CreateElement | IsMathMLFlag,
+        CreateDocument = CreateContainer | IsDocumentNodeFlag | IsConnectedFlag,
         CreateEditingText = CreateText | IsEditingTextOrUndefinedCustomElementFlag,
-        CreateMathMLElement = CreateStyledElement | IsMathMLFlag
     };
     Node(Document&, ConstructionType);
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to