Bug 1454251: Remove nsINode::ePROCESSING_INSTRUCTION. r?bz draft
authorEmilio Cobos Álvarez <emilio@crisal.io>
Sun, 15 Apr 2018 15:04:07 +0200
changeset 782394 eab04ad2be68445843dc4beca11a574750af0286
parent 782393 d2b86c2737acc058a40a2a9157f254389fe77800
child 782395 1e8b955b13601faead9ed2c47aca8e5f5370342d
push id106521
push userbmo:emilio@crisal.io
push dateSun, 15 Apr 2018 13:29:46 +0000
reviewersbz
bugs1454251
milestone61.0a1
Bug 1454251: Remove nsINode::ePROCESSING_INSTRUCTION. r?bz MozReview-Commit-ID: Xz5UiIgRpz
dom/base/nsINode.h
dom/xml/ProcessingInstruction.cpp
dom/xml/ProcessingInstruction.h
dom/xslt/xpath/txMozillaXPathTreeWalker.cpp
dom/xslt/xpath/txXPathTreeWalker.h
layout/base/nsCSSFrameConstructor.cpp
layout/style/nsStyleUtil.cpp
--- a/dom/base/nsINode.h
+++ b/dom/base/nsINode.h
@@ -409,18 +409,16 @@ public:
   virtual ~nsINode();
 
   /**
    * Bit-flags to pass (or'ed together) to IsNodeOfType()
    */
   enum {
     /** nsIAttribute nodes */
     eATTRIBUTE           = 1 << 2,
-    /** xml processing instructions */
-    ePROCESSING_INSTRUCTION = 1 << 4,
     /** form control elements */
     eHTML_FORM_CONTROL   = 1 << 6,
     /** animation elements */
     eANIMATION           = 1 << 10,
     /** filter elements that implement SVGFilterPrimitiveStandardAttributes */
     eFILTER              = 1 << 11,
     /** SVGGeometryElement */
     eSHAPE               = 1 << 12
--- a/dom/xml/ProcessingInstruction.cpp
+++ b/dom/xml/ProcessingInstruction.cpp
@@ -74,22 +74,16 @@ bool
 ProcessingInstruction::GetAttrValue(nsAtom *aName, nsAString& aValue)
 {
   nsAutoString data;
 
   GetData(data);
   return nsContentUtils::GetPseudoAttributeValue(data, aName, aValue);
 }
 
-bool
-ProcessingInstruction::IsNodeOfType(uint32_t aFlags) const
-{
-  return !(aFlags & ~ePROCESSING_INSTRUCTION);
-}
-
 already_AddRefed<CharacterData>
 ProcessingInstruction::CloneDataNode(mozilla::dom::NodeInfo *aNodeInfo,
                                      bool aCloneText) const
 {
   nsAutoString data;
   GetData(data);
   RefPtr<mozilla::dom::NodeInfo> ni = aNodeInfo;
   return do_AddRef(new ProcessingInstruction(ni.forget(), data));
--- a/dom/xml/ProcessingInstruction.h
+++ b/dom/xml/ProcessingInstruction.h
@@ -20,19 +20,16 @@ class ProcessingInstruction : public Cha
 {
 public:
   ProcessingInstruction(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo,
                         const nsAString& aData);
 
   // nsISupports
   NS_DECL_ISUPPORTS_INHERITED
 
-  // nsINode
-  virtual bool IsNodeOfType(uint32_t aFlags) const override;
-
   virtual already_AddRefed<CharacterData>
     CloneDataNode(mozilla::dom::NodeInfo *aNodeInfo,
                   bool aCloneText) const override;
 
 #ifdef DEBUG
   virtual void List(FILE* out, int32_t aIndent) const override;
   virtual void DumpContent(FILE* out, int32_t aIndent, bool aDumpAll) const override;
 #endif
--- a/dom/xslt/xpath/txMozillaXPathTreeWalker.cpp
+++ b/dom/xslt/xpath/txMozillaXPathTreeWalker.cpp
@@ -301,17 +301,17 @@ txXPathNodeUtils::getLocalName(const txX
 
     if (aNode.isContent()) {
         if (aNode.mNode->IsElement()) {
             RefPtr<nsAtom> localName =
                 aNode.Content()->NodeInfo()->NameAtom();
             return localName.forget();
         }
 
-        if (aNode.mNode->IsNodeOfType(nsINode::ePROCESSING_INSTRUCTION)) {
+        if (aNode.mNode->IsProcessingInstruction()) {
             return NS_Atomize(aNode.mNode->NodeName());
         }
 
         return nullptr;
     }
 
     // This is an attribute node, so we necessarily come from an element.
     RefPtr<nsAtom> localName =
@@ -348,17 +348,17 @@ txXPathNodeUtils::getLocalName(const txX
 
     if (aNode.isContent()) {
         if (aNode.mNode->IsElement()) {
             mozilla::dom::NodeInfo* nodeInfo = aNode.Content()->NodeInfo();
             nodeInfo->GetName(aLocalName);
             return;
         }
 
-        if (aNode.mNode->IsNodeOfType(nsINode::ePROCESSING_INSTRUCTION)) {
+        if (aNode.mNode->IsProcessingInstruction()) {
             // PIs don't have a nodeinfo but do have a name
             // XXXbz Not actually true, but this function looks like it wants
             // different things from elements and PIs for "local name"...
             aLocalName = aNode.mNode->NodeName();
             return;
         }
 
         aLocalName.Truncate();
--- a/dom/xslt/xpath/txXPathTreeWalker.h
+++ b/dom/xslt/xpath/txXPathTreeWalker.h
@@ -232,18 +232,17 @@ txXPathNodeUtils::isAttribute(const txXP
 {
     return aNode.isAttribute();
 }
 
 /* static */
 inline bool
 txXPathNodeUtils::isProcessingInstruction(const txXPathNode& aNode)
 {
-    return aNode.isContent() &&
-           aNode.Content()->IsNodeOfType(nsINode::ePROCESSING_INSTRUCTION);
+    return aNode.isContent() && aNode.Content()->IsProcessingInstruction();
 }
 
 /* static */
 inline bool
 txXPathNodeUtils::isComment(const txXPathNode& aNode)
 {
     return aNode.isContent() && aNode.Content()->IsComment();
 }
--- a/layout/base/nsCSSFrameConstructor.cpp
+++ b/layout/base/nsCSSFrameConstructor.cpp
@@ -5509,18 +5509,17 @@ nsCSSFrameConstructor::ShouldCreateItems
   }
 
   // don't create a whitespace frame if aParent doesn't want it
   if (!NeedFrameFor(aState, aParentFrame, aContent)) {
     return false;
   }
 
   // never create frames for comments or PIs
-  if (aContent->IsComment() ||
-      aContent->IsNodeOfType(nsINode::ePROCESSING_INSTRUCTION)) {
+  if (aContent->IsComment() || aContent->IsProcessingInstruction()) {
     return false;
   }
 
   return true;
 }
 
 void
 nsCSSFrameConstructor::DoAddFrameConstructionItems(nsFrameConstructorState& aState,
@@ -6345,18 +6344,17 @@ nsCSSFrameConstructor::IsValidSibling(ns
       StyleDisplay::TableCaption     == siblingDisplay ||
       StyleDisplay::TableHeaderGroup == siblingDisplay ||
       StyleDisplay::TableRowGroup    == siblingDisplay ||
       StyleDisplay::TableFooterGroup == siblingDisplay ||
       LayoutFrameType::Menu == parentType) {
     // if we haven't already, resolve a style to find the display type of
     // aContent.
     if (UNSET_DISPLAY == aDisplay) {
-      if (aContent->IsComment() ||
-          aContent->IsNodeOfType(nsINode::ePROCESSING_INSTRUCTION)) {
+      if (aContent->IsComment() || aContent->IsProcessingInstruction()) {
         // Comments and processing instructions never have frames, so we should
         // not try to generate styles for them.
         return false;
       }
       // FIXME(emilio): This is buggy some times, see bug 1424656.
       RefPtr<ComputedStyle> computedStyle = ResolveComputedStyle(aContent);
       const nsStyleDisplay* display = computedStyle->StyleDisplay();
       aDisplay = display->mDisplay;
@@ -10103,18 +10101,17 @@ nsCSSFrameConstructor::AddFCItemsForAnon
     nsIContent* content = aAnonymousItems[i].mContent;
     // Gecko-styled nodes should have no pending restyle flags.
     // Assert some things about this content
     MOZ_ASSERT(!(content->GetFlags() &
                  (NODE_DESCENDANTS_NEED_FRAMES | NODE_NEEDS_FRAME)),
                "Should not be marked as needing frames");
     MOZ_ASSERT(!content->GetPrimaryFrame(),
                "Should have no existing frame");
-    MOZ_ASSERT(!content->IsComment() &&
-               !content->IsNodeOfType(nsINode::ePROCESSING_INSTRUCTION),
+    MOZ_ASSERT(!content->IsComment() && !content->IsProcessingInstruction(),
                "Why is someone creating garbage anonymous content");
 
     // Make sure we eagerly performed the servo cascade when the anonymous
     // nodes were created.
     MOZ_ASSERT(!content->IsElement() || content->AsElement()->HasServoData());
 
     RefPtr<ComputedStyle> computedStyle = ResolveComputedStyle(content);
 
@@ -11450,18 +11447,17 @@ nsCSSFrameConstructor::BuildInlineChildI
   } else {
     // Use the content tree child list:
     FlattenedChildIterator iter(parentContent);
     for (nsIContent* content = iter.GetNextChild(); content; content = iter.GetNextChild()) {
       // Manually check for comments/PIs, since we don't have a frame to pass to
       // AddFrameConstructionItems.  We know our parent is a non-replaced inline,
       // so there is no need to do the NeedFrameFor check.
       content->UnsetFlags(NODE_DESCENDANTS_NEED_FRAMES | NODE_NEEDS_FRAME);
-      if (content->IsComment() ||
-          content->IsNodeOfType(nsINode::ePROCESSING_INSTRUCTION)) {
+      if (content->IsComment() || content->IsProcessingInstruction()) {
         continue;
       }
 
       RefPtr<ComputedStyle> childContext = ResolveComputedStyle(content);
       AddFrameConstructionItemsInternal(aState, content, nullptr,
                                         iter.XBLInvolved(), childContext,
                                         flags, nullptr,
                                         aParentItem.mChildItems);
--- a/layout/style/nsStyleUtil.cpp
+++ b/layout/style/nsStyleUtil.cpp
@@ -741,34 +741,32 @@ nsStyleUtil::ColorComponentToFloat(uint8
 }
 
 /* static */ bool
 nsStyleUtil::IsSignificantChild(nsIContent* aChild,
                                 bool aWhitespaceIsSignificant)
 {
   bool isText = aChild->IsText();
 
-  if (!isText && !aChild->IsComment() &&
-      !aChild->IsNodeOfType(nsINode::ePROCESSING_INSTRUCTION)) {
+  if (!isText && !aChild->IsComment() && !aChild->IsProcessingInstruction()) {
     return true;
   }
 
   return isText && aChild->TextLength() != 0 &&
          (aWhitespaceIsSignificant ||
           !aChild->TextIsOnlyWhitespace());
 }
 
 /* static */ bool
 nsStyleUtil::ThreadSafeIsSignificantChild(const nsIContent* aChild,
                                           bool aWhitespaceIsSignificant)
 {
   bool isText = aChild->IsText();
 
-  if (!isText && !aChild->IsComment() &&
-      !aChild->IsNodeOfType(nsINode::ePROCESSING_INSTRUCTION)) {
+  if (!isText && !aChild->IsComment() && !aChild->IsProcessingInstruction()) {
     return true;
   }
 
   return isText && aChild->TextLength() != 0 &&
          (aWhitespaceIsSignificant ||
           !aChild->ThreadSafeTextIsOnlyWhitespace());
 }