Title: [113312] trunk/Source/WebCore
Revision
113312
Author
[email protected]
Date
2012-04-05 04:50:35 -0700 (Thu, 05 Apr 2012)

Log Message

IsCommentNode flags is a waste.
https://bugs.webkit.org/show_bug.cgi?id=83251

Reviewed by Ryosuke Niwa.

Effectively nobody uses it. To save a precious NodeFlags bit, this
change removes NodeFlags::IsCommentFlag and its companion mehtod
Node::isCommentNode().

No new tests. No behaviour change.

* dom/CharacterData.h:
(WebCore::CharacterData::CharacterData):
* dom/Comment.cpp:
(WebCore::Comment::Comment):
* dom/Node.h:
* rendering/RenderTreeAsText.cpp:
(WebCore::getTagName):
This was the only client of Node::isCommentNode(). Replaced it with nodeType() call.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (113311 => 113312)


--- trunk/Source/WebCore/ChangeLog	2012-04-05 11:45:07 UTC (rev 113311)
+++ trunk/Source/WebCore/ChangeLog	2012-04-05 11:50:35 UTC (rev 113312)
@@ -1,3 +1,25 @@
+2012-04-05  MORITA Hajime  <[email protected]>
+
+        IsCommentNode flags is a waste.
+        https://bugs.webkit.org/show_bug.cgi?id=83251
+
+        Reviewed by Ryosuke Niwa.
+
+        Effectively nobody uses it. To save a precious NodeFlags bit, this
+        change removes NodeFlags::IsCommentFlag and its companion mehtod
+        Node::isCommentNode().
+
+        No new tests. No behaviour change.
+
+        * dom/CharacterData.h:
+        (WebCore::CharacterData::CharacterData):
+        * dom/Comment.cpp:
+        (WebCore::Comment::Comment):
+        * dom/Node.h:
+        * rendering/RenderTreeAsText.cpp:
+        (WebCore::getTagName):
+        This was the only client of Node::isCommentNode(). Replaced it with nodeType() call.
+
 2012-04-05  Hans Wennborg  <[email protected]>
 
         webkit_unit_tests build fix.

Modified: trunk/Source/WebCore/dom/CharacterData.h (113311 => 113312)


--- trunk/Source/WebCore/dom/CharacterData.h	2012-04-05 11:45:07 UTC (rev 113311)
+++ trunk/Source/WebCore/dom/CharacterData.h	2012-04-05 11:50:35 UTC (rev 113312)
@@ -52,7 +52,7 @@
         : Node(document, type)
         , m_data(!text.isNull() ? text : emptyString())
     {
-        ASSERT(type == CreateComment || type == CreateText);
+        ASSERT(type == CreateOther || type == CreateText);
     }
 
     virtual bool rendererIsNeeded(const NodeRenderingContext&);

Modified: trunk/Source/WebCore/dom/Comment.cpp (113311 => 113312)


--- trunk/Source/WebCore/dom/Comment.cpp	2012-04-05 11:45:07 UTC (rev 113311)
+++ trunk/Source/WebCore/dom/Comment.cpp	2012-04-05 11:50:35 UTC (rev 113312)
@@ -27,7 +27,7 @@
 namespace WebCore {
 
 inline Comment::Comment(Document* document, const String& text)
-    : CharacterData(document, text, CreateComment)
+    : CharacterData(document, text, CreateOther)
 {
 }
 

Modified: trunk/Source/WebCore/dom/Node.h (113311 => 113312)


--- trunk/Source/WebCore/dom/Node.h	2012-04-05 11:45:07 UTC (rev 113311)
+++ trunk/Source/WebCore/dom/Node.h	2012-04-05 11:50:35 UTC (rev 113312)
@@ -90,7 +90,7 @@
 
 typedef int ExceptionCode;
 
-const int nodeStyleChangeShift = 22;
+const int nodeStyleChangeShift = 21;
 
 // SyntheticStyleChange means that we need to go through the entire style change logic even though
 // no style property has actually changed. It is used to restructure the tree when, for instance,
@@ -212,7 +212,6 @@
     bool isStyledElement() const { return getFlag(IsStyledElementFlag); }
     virtual bool isFrameOwnerElement() const { return false; }
     virtual bool isAttributeNode() const { return false; }
-    bool isCommentNode() const { return getFlag(IsCommentFlag); }
     virtual bool isCharacterDataNode() const { return false; }
     bool isDocumentNode() const;
     bool isShadowRoot() const { return getFlag(IsShadowRootFlag); }
@@ -629,42 +628,41 @@
 private:
     enum NodeFlags {
         IsTextFlag = 1,
-        IsCommentFlag = 1 << 1,
-        IsContainerFlag = 1 << 2,
-        IsElementFlag = 1 << 3,
-        IsStyledElementFlag = 1 << 4,
-        IsHTMLFlag = 1 << 5,
-        IsSVGFlag = 1 << 6,
-        IsAttachedFlag = 1 << 7,
-        ChildNeedsStyleRecalcFlag = 1 << 8,
-        InDocumentFlag = 1 << 9,
-        IsLinkFlag = 1 << 10,
-        IsActiveFlag = 1 << 11,
-        IsHoveredFlag = 1 << 12,
-        InActiveChainFlag = 1 << 13,
-        InDetachFlag = 1 << 14,
-        HasRareDataFlag = 1 << 15,
-        IsShadowRootFlag = 1 << 16,
+        IsContainerFlag = 1 << 1,
+        IsElementFlag = 1 << 2,
+        IsStyledElementFlag = 1 << 3,
+        IsHTMLFlag = 1 << 4,
+        IsSVGFlag = 1 << 5,
+        IsAttachedFlag = 1 << 6,
+        ChildNeedsStyleRecalcFlag = 1 << 7,
+        InDocumentFlag = 1 << 8,
+        IsLinkFlag = 1 << 9,
+        IsActiveFlag = 1 << 10,
+        IsHoveredFlag = 1 << 11,
+        InActiveChainFlag = 1 << 12,
+        InDetachFlag = 1 << 13,
+        HasRareDataFlag = 1 << 14,
+        IsShadowRootFlag = 1 << 15,
 
         // 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.
-        IsParsingChildrenFinishedFlag = 1 << 17, // Element
-        IsStyleAttributeValidFlag = 1 << 18, // StyledElement
+        IsParsingChildrenFinishedFlag = 1 << 16, // Element
+        IsStyleAttributeValidFlag = 1 << 17, // StyledElement
 #if ENABLE(SVG)
-        AreSVGAttributesValidFlag = 1 << 19, // Element
-        IsSynchronizingSVGAttributesFlag = 1 << 20, // SVGElement
-        HasSVGRareDataFlag = 1 << 21, // SVGElement
+        AreSVGAttributesValidFlag = 1 << 18, // Element
+        IsSynchronizingSVGAttributesFlag = 1 << 19, // SVGElement
+        HasSVGRareDataFlag = 1 << 20, // SVGElement
 #endif
 
         StyleChangeMask = 1 << nodeStyleChangeShift | 1 << (nodeStyleChangeShift + 1),
 
-        SelfOrAncestorHasDirAutoFlag = 1 << 24,
-        HasCustomWillOrDidRecalcStyleFlag = 1 << 25,
-        HasCustomStyleForRendererFlag = 1 << 26,
+        SelfOrAncestorHasDirAutoFlag = 1 << 23,
+        HasCustomWillOrDidRecalcStyleFlag = 1 << 24,
+        HasCustomStyleForRendererFlag = 1 << 25,
 
-        HasNameFlag = 1 << 27,
+        HasNameFlag = 1 << 26,
 
-        AttributeStyleDirtyFlag = 1 << 28,
+        AttributeStyleDirtyFlag = 1 << 27,
 
 #if ENABLE(SVG)
         DefaultNodeFlags = IsParsingChildrenFinishedFlag | IsStyleAttributeValidFlag | AreSVGAttributesValidFlag
@@ -684,7 +682,6 @@
     enum ConstructionType { 
         CreateOther = DefaultNodeFlags,
         CreateText = DefaultNodeFlags | IsTextFlag,
-        CreateComment = DefaultNodeFlags | IsCommentFlag,
         CreateContainer = DefaultNodeFlags | IsContainerFlag, 
         CreateElement = CreateContainer | IsElementFlag, 
         CreateShadowRoot = CreateContainer | IsShadowRootFlag,

Modified: trunk/Source/WebCore/rendering/RenderTreeAsText.cpp (113311 => 113312)


--- trunk/Source/WebCore/rendering/RenderTreeAsText.cpp	2012-04-05 11:45:07 UTC (rev 113311)
+++ trunk/Source/WebCore/rendering/RenderTreeAsText.cpp	2012-04-05 11:50:35 UTC (rev 113312)
@@ -166,7 +166,7 @@
 {
     if (n->isDocumentNode())
         return "";
-    if (n->isCommentNode())
+    if (n->nodeType() == Node::COMMENT_NODE)
         return "COMMENT";
     return n->nodeName();
 }
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to