CDATASection.h (1647B)
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_CDATASection_h 8 #define mozilla_dom_CDATASection_h 9 10 #include "mozilla/dom/Text.h" 11 12 namespace mozilla::dom { 13 14 class CDATASection final : public Text { 15 private: 16 void Init() { 17 MOZ_ASSERT(mNodeInfo->NodeType() == CDATA_SECTION_NODE, 18 "Bad NodeType in aNodeInfo"); 19 } 20 21 virtual ~CDATASection(); 22 23 public: 24 explicit CDATASection(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo) 25 : Text(std::move(aNodeInfo)) { 26 Init(); 27 } 28 29 explicit CDATASection(nsNodeInfoManager* aNodeInfoManager) 30 : Text(aNodeInfoManager->GetNodeInfo(nsGkAtoms::cdataTagName, nullptr, 31 kNameSpaceID_None, 32 CDATA_SECTION_NODE)) { 33 Init(); 34 } 35 36 // nsISupports 37 NS_INLINE_DECL_REFCOUNTING_INHERITED(CDATASection, Text) 38 39 // nsINode 40 already_AddRefed<CharacterData> CloneDataNode( 41 mozilla::dom::NodeInfo* aNodeInfo, bool aCloneText) const override; 42 43 #ifdef MOZ_DOM_LIST 44 void List(FILE* out, int32_t aIndent) const override; 45 void DumpContent(FILE* out, int32_t aIndent, bool aDumpAll) const override; 46 #endif 47 48 protected: 49 JSObject* WrapNode(JSContext* aCx, 50 JS::Handle<JSObject*> aGivenProto) override; 51 }; 52 53 } // namespace mozilla::dom 54 55 #endif // mozilla_dom_CDATASection_h