tor-browser

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

CDATASection.cpp (1575B)


      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 #include "mozilla/dom/CDATASection.h"
      8 
      9 #include "mozilla/IntegerPrintfMacros.h"
     10 #include "mozilla/dom/CDATASectionBinding.h"
     11 
     12 namespace mozilla::dom {
     13 
     14 CDATASection::~CDATASection() = default;
     15 
     16 JSObject* CDATASection::WrapNode(JSContext* aCx,
     17                                 JS::Handle<JSObject*> aGivenProto) {
     18  return CDATASection_Binding::Wrap(aCx, this, aGivenProto);
     19 }
     20 
     21 already_AddRefed<CharacterData> CDATASection::CloneDataNode(
     22    mozilla::dom::NodeInfo* aNodeInfo, bool aCloneText) const {
     23  RefPtr<mozilla::dom::NodeInfo> ni = aNodeInfo;
     24  auto* nim = ni->NodeInfoManager();
     25  RefPtr<CDATASection> it = new (nim) CDATASection(ni.forget());
     26  if (aCloneText) {
     27    it->mBuffer = mBuffer;
     28  }
     29 
     30  return it.forget();
     31 }
     32 
     33 #ifdef MOZ_DOM_LIST
     34 void CDATASection::List(FILE* out, int32_t aIndent) const {
     35  int32_t index;
     36  for (index = aIndent; --index >= 0;) fputs("  ", out);
     37 
     38  fprintf(out, "CDATASection refcount=%" PRIuPTR "<", mRefCnt.get());
     39 
     40  nsAutoString tmp;
     41  ToCString(tmp, 0, mBuffer.GetLength());
     42  fputs(NS_LossyConvertUTF16toASCII(tmp).get(), out);
     43 
     44  fputs(">\n", out);
     45 }
     46 
     47 void CDATASection::DumpContent(FILE* out, int32_t aIndent,
     48                               bool aDumpAll) const {}
     49 #endif
     50 
     51 }  // namespace mozilla::dom