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