Skip to content

Truly independent web browser

878 B
Raw Blame
/*
 * Copyright (c) 2018-2020, Andreas Kling <[email protected]>
 *
 * SPDX-License-Identifier: BSD-2-Clause
 */

#include <LibGC/Heap.h>
#include <LibWeb/DOM/Comment.h>
#include <LibWeb/HTML/Scripting/Environments.h>
#include <LibWeb/HTML/Window.h>

namespace Web::DOM {

#if ARCH(X86_64) && !defined(AK_OS_WINDOWS)
static_assert(sizeof(Comment) == 104);
#endif

GC_DEFINE_ALLOCATOR(Comment);

Comment::Comment(Document& document, Utf16String data)
    : CharacterData(document, NodeType::COMMENT_NODE, move(data))
{
}

GC::Ref<Comment> Comment::create(Document& document, Utf16String data)
{
    return GC::Heap::the().allocate<Comment>(document, move(data));
}

GC::Ref<Comment> Comment::create_for_constructor(JS::Object& relevant_global_object, Utf16String data)
{
    return create(HTML::relevant_window(relevant_global_object).associated_document(), move(data));
}

}