Bug 1454233: Add a comment about why IsDocument() is the way it is. r=me
authorEmilio Cobos Álvarez <emilio@crisal.io>
Fri, 20 Apr 2018 03:56:02 +0200
changeset 470804 6bec96422fe4ba15e76247e7e8b83e506daf1f6d
parent 470803 cb757c8237f0ae635266eb247032bf9147eb4e38
child 470805 7549ebecdf7e78e3560382a2b25fddb34c0ba60f
push id1728
push userjlund@mozilla.com
push dateMon, 18 Jun 2018 21:12:27 +0000
treeherdermozilla-release@c296fde26f5f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersme
bugs1454233
milestone61.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1454233: Add a comment about why IsDocument() is the way it is. r=me MozReview-Commit-ID: LYkYnKF9M2c
dom/base/nsINode.h
--- a/dom/base/nsINode.h
+++ b/dom/base/nsINode.h
@@ -448,16 +448,17 @@ public:
     return IsElement() || IsText();
   }
 
   /**
    * Returns true if this is a document node.
    */
   bool IsDocument() const
   {
+    // One less pointer-chase than checking NodeType().
     return !GetParentNode() && IsInUncomposedDoc();
   }
 
   /**
    * Return this node as a document. Asserts IsDocument().
    *
    * This is defined inline in nsIDocument.h.
    */