Merge mozilla-central to autoland on a CLOSED TREE
[gecko.git] / dom / xml / CDATASection.cpp
blob4858c24af180912f91cb20aedc88556af3939ae4
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/. */
7 #include "mozilla/dom/CDATASection.h"
8 #include "mozilla/dom/CDATASectionBinding.h"
9 #include "mozilla/IntegerPrintfMacros.h"
11 namespace mozilla::dom {
13 CDATASection::~CDATASection() = default;
15 JSObject* CDATASection::WrapNode(JSContext* aCx,
16 JS::Handle<JSObject*> aGivenProto) {
17 return CDATASection_Binding::Wrap(aCx, this, aGivenProto);
20 already_AddRefed<CharacterData> CDATASection::CloneDataNode(
21 mozilla::dom::NodeInfo* aNodeInfo, bool aCloneText) const {
22 RefPtr<mozilla::dom::NodeInfo> ni = aNodeInfo;
23 auto* nim = ni->NodeInfoManager();
24 RefPtr<CDATASection> it = new (nim) CDATASection(ni.forget());
25 if (aCloneText) {
26 it->mText = mText;
29 return it.forget();
32 #ifdef MOZ_DOM_LIST
33 void CDATASection::List(FILE* out, int32_t aIndent) const {
34 int32_t index;
35 for (index = aIndent; --index >= 0;) fputs(" ", out);
37 fprintf(out, "CDATASection refcount=%" PRIuPTR "<", mRefCnt.get());
39 nsAutoString tmp;
40 ToCString(tmp, 0, mText.GetLength());
41 fputs(NS_LossyConvertUTF16toASCII(tmp).get(), out);
43 fputs(">\n", out);
46 void CDATASection::DumpContent(FILE* out, int32_t aIndent,
47 bool aDumpAll) const {}
48 #endif
50 } // namespace mozilla::dom