Serenity Operating System
at master 33 lines 890 B view raw
1/* 2 * Copyright (c) 2018-2021, Andreas Kling <kling@serenityos.org> 3 * 4 * SPDX-License-Identifier: BSD-2-Clause 5 */ 6 7#include <LibWeb/DOM/Document.h> 8#include <LibWeb/HTML/HTMLBRElement.h> 9#include <LibWeb/Layout/BreakNode.h> 10 11namespace Web::HTML { 12 13HTMLBRElement::HTMLBRElement(DOM::Document& document, DOM::QualifiedName qualified_name) 14 : HTMLElement(document, move(qualified_name)) 15{ 16} 17 18HTMLBRElement::~HTMLBRElement() = default; 19 20JS::ThrowCompletionOr<void> HTMLBRElement::initialize(JS::Realm& realm) 21{ 22 MUST_OR_THROW_OOM(Base::initialize(realm)); 23 set_prototype(&Bindings::ensure_web_prototype<Bindings::HTMLBRElementPrototype>(realm, "HTMLBRElement")); 24 25 return {}; 26} 27 28JS::GCPtr<Layout::Node> HTMLBRElement::create_layout_node(NonnullRefPtr<CSS::StyleProperties> style) 29{ 30 return heap().allocate_without_realm<Layout::BreakNode>(document(), *this, move(style)); 31} 32 33}