tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

Comment.h (1843B)


      1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
      2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
      3 /* This Source Code Form is subject to the terms of the Mozilla Public
      4 * License, v. 2.0. If a copy of the MPL was not distributed with this
      5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
      6 
      7 #ifndef mozilla_dom_Comment_h
      8 #define mozilla_dom_Comment_h
      9 
     10 #include "mozilla/dom/CharacterData.h"
     11 
     12 namespace mozilla::dom {
     13 
     14 class Comment final : public CharacterData {
     15 private:
     16  void Init() {
     17    MOZ_ASSERT(mNodeInfo->NodeType() == COMMENT_NODE,
     18               "Bad NodeType in aNodeInfo");
     19  }
     20 
     21  virtual ~Comment();
     22 
     23 public:
     24  explicit Comment(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
     25      : CharacterData(std::move(aNodeInfo)) {
     26    Init();
     27  }
     28 
     29  explicit Comment(nsNodeInfoManager* aNodeInfoManager)
     30      : CharacterData(aNodeInfoManager->GetCommentNodeInfo()) {
     31    Init();
     32  }
     33 
     34  NS_IMPL_FROMNODE_HELPER(Comment, IsComment())
     35 
     36  // nsISupports
     37  NS_INLINE_DECL_REFCOUNTING_INHERITED(Comment, CharacterData)
     38 
     39  virtual already_AddRefed<CharacterData> CloneDataNode(
     40      mozilla::dom::NodeInfo* aNodeInfo, bool aCloneText) const override;
     41 
     42 #ifdef DEBUG
     43  virtual void List(FILE* out, int32_t aIndent) const override;
     44  virtual void DumpContent(FILE* out = stdout, int32_t aIndent = 0,
     45                           bool aDumpAll = true) const override {
     46    return;
     47  }
     48 #endif
     49 
     50  static already_AddRefed<Comment> Constructor(const GlobalObject& aGlobal,
     51                                               const nsAString& aData,
     52                                               ErrorResult& aRv);
     53 
     54 protected:
     55  virtual JSObject* WrapNode(JSContext* aCx,
     56                             JS::Handle<JSObject*> aGivenProto) override;
     57 };
     58 
     59 }  // namespace mozilla::dom
     60 
     61 #endif  // mozilla_dom_Comment_h