Serenity Operating System
1/*
2 * Copyright (c) 2020, the SerenityOS developers.
3 *
4 * SPDX-License-Identifier: BSD-2-Clause
5 */
6
7#include <AK/Assertions.h>
8#include <LibWeb/ARIA/Roles.h>
9#include <LibWeb/Bindings/Intrinsics.h>
10#include <LibWeb/HTML/HTMLQuoteElement.h>
11
12namespace Web::HTML {
13
14HTMLQuoteElement::HTMLQuoteElement(DOM::Document& document, DOM::QualifiedName qualified_name)
15 : HTMLElement(document, move(qualified_name))
16{
17}
18
19HTMLQuoteElement::~HTMLQuoteElement() = default;
20
21JS::ThrowCompletionOr<void> HTMLQuoteElement::initialize(JS::Realm& realm)
22{
23 MUST_OR_THROW_OOM(Base::initialize(realm));
24 set_prototype(&Bindings::ensure_web_prototype<Bindings::HTMLQuoteElementPrototype>(realm, "HTMLQuoteElement"));
25
26 return {};
27}
28
29Optional<ARIA::Role> HTMLQuoteElement::default_role() const
30{
31 // https://www.w3.org/TR/html-aria/#el-blockquote
32 if (local_name() == TagNames::blockquote)
33 return ARIA::Role::blockquote;
34 // https://www.w3.org/TR/html-aria/#el-q
35 if (local_name() == TagNames::q)
36 return ARIA::Role::generic;
37 VERIFY_NOT_REACHED();
38}
39
40}