chromium/third_party/blink/renderer/core/editing/serializers/markup_formatter.cc

/*
 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2012 Apple Inc. All rights
 * reserved.
 * Copyright (C) 2009, 2010 Google Inc. All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

#ifdef UNSAFE_BUFFERS_BUILD
// TODO(crbug.com/351564777): Remove this and convert code to safer constructs.
#pragma allow_unsafe_buffers
#endif

#include "third_party/blink/renderer/core/editing/serializers/markup_formatter.h"

#include "third_party/blink/public/mojom/use_counter/metrics/web_feature.mojom-shared.h"
#include "third_party/blink/renderer/core/dom/cdata_section.h"
#include "third_party/blink/renderer/core/dom/comment.h"
#include "third_party/blink/renderer/core/dom/document.h"
#include "third_party/blink/renderer/core/dom/document_fragment.h"
#include "third_party/blink/renderer/core/dom/document_type.h"
#include "third_party/blink/renderer/core/dom/node.h"
#include "third_party/blink/renderer/core/dom/processing_instruction.h"
#include "third_party/blink/renderer/core/editing/editing_utilities.h"
#include "third_party/blink/renderer/core/editing/editor.h"
#include "third_party/blink/renderer/core/execution_context/execution_context.h"
#include "third_party/blink/renderer/core/html/html_element.h"
#include "third_party/blink/renderer/core/html/html_template_element.h"
#include "third_party/blink/renderer/core/html_names.h"
#include "third_party/blink/renderer/core/xlink_names.h"
#include "third_party/blink/renderer/core/xml_names.h"
#include "third_party/blink/renderer/core/xmlns_names.h"
#include "third_party/blink/renderer/platform/runtime_enabled_features.h"
#include "third_party/blink/renderer/platform/weborigin/kurl.h"
#include "third_party/blink/renderer/platform/wtf/text/character_names.h"
#include "third_party/blink/renderer/platform/wtf/text/character_visitor.h"

namespace blink {

struct EntityDescription {};

template <typename CharType>
static inline void AppendCharactersReplacingEntitiesInternal(
    StringBuilder& result,
    const StringView& source,
    CharType* text,
    unsigned length,
    const EntityDescription entity_maps[],
    unsigned entity_maps_count,
    EntityMask entity_mask) {}

void MarkupFormatter::AppendCharactersReplacingEntities(
    StringBuilder& result,
    const StringView& source,
    EntityMask entity_mask) {}

MarkupFormatter::MarkupFormatter(AbsoluteURLs resolve_urls_method,
                                 SerializationType serialization_type)
    :{}

String MarkupFormatter::ResolveURLIfNeeded(const Element& element,
                                           const Attribute& attribute) const {}

void MarkupFormatter::AppendStartMarkup(StringBuilder& result,
                                        const Node& node) {}

void MarkupFormatter::AppendEndMarkup(StringBuilder& result,
                                      const Element& element) {}

void MarkupFormatter::AppendEndMarkup(StringBuilder& result,
                                      const Element& element,
                                      const AtomicString& prefix,
                                      const AtomicString& local_name) {}

void MarkupFormatter::AppendAttributeValue(StringBuilder& result,
                                           const String& attribute,
                                           bool document_is_html,
                                           const Document& document) {}

void MarkupFormatter::AppendAttribute(StringBuilder& result,
                                      const AtomicString& prefix,
                                      const AtomicString& local_name,
                                      const String& value,
                                      bool document_is_html,
                                      const Document& document) {}

void MarkupFormatter::AppendText(StringBuilder& result, const Text& text) {}

void MarkupFormatter::AppendComment(StringBuilder& result,
                                    const String& comment) {}

void MarkupFormatter::AppendXMLDeclaration(StringBuilder& result,
                                           const Document& document) {}

void MarkupFormatter::AppendDocumentType(StringBuilder& result,
                                         const DocumentType& n) {}

void MarkupFormatter::AppendProcessingInstruction(StringBuilder& result,
                                                  const String& target,
                                                  const String& data) {}

void MarkupFormatter::AppendStartTagOpen(StringBuilder& result,
                                         const Element& element) {}

void MarkupFormatter::AppendStartTagOpen(StringBuilder& result,
                                         const AtomicString& prefix,
                                         const AtomicString& local_name) {}

void MarkupFormatter::AppendStartTagClose(StringBuilder& result,
                                          const Element& element) {}

void MarkupFormatter::AppendAttributeAsHTML(StringBuilder& result,
                                            const Attribute& attribute,
                                            const String& value,
                                            const Document& document) {}

void MarkupFormatter::AppendAttributeAsXMLWithoutNamespace(
    StringBuilder& result,
    const Attribute& attribute,
    const String& value,
    const Document& document) {}

void MarkupFormatter::AppendCDATASection(StringBuilder& result,
                                         const String& section) {}

EntityMask MarkupFormatter::EntityMaskForText(const Text& text) const {}

// Rules of self-closure
// 1. No elements in HTML documents use the self-closing syntax.
// 2. Elements w/ children never self-close because they use a separate end tag.
// 3. HTML elements which do not listed in spec will close with a
// separate end tag.
// 4. Other elements self-close.
bool MarkupFormatter::ShouldSelfClose(const Element& element) const {}

bool MarkupFormatter::SerializeAsHTML() const {}

}  // namespace blink