Serenity Operating System
1/*
2 * Copyright (c) 2020, the SerenityOS developers.
3 * Copyright (c) 2022, Luke Wilde <lukew@serenityos.org>
4 *
5 * SPDX-License-Identifier: BSD-2-Clause
6 */
7
8#pragma once
9
10#include <LibWeb/ARIA/Roles.h>
11#include <LibWeb/HTML/FormAssociatedElement.h>
12#include <LibWeb/HTML/HTMLElement.h>
13
14namespace Web::HTML {
15
16class HTMLOutputElement final
17 : public HTMLElement
18 , public FormAssociatedElement {
19 WEB_PLATFORM_OBJECT(HTMLOutputElement, HTMLElement);
20 FORM_ASSOCIATED_ELEMENT(HTMLElement, HTMLOutputElement)
21
22public:
23 virtual ~HTMLOutputElement() override;
24
25 DeprecatedString const& type() const
26 {
27 static DeprecatedString output = "output";
28 return output;
29 }
30
31 // ^FormAssociatedElement
32 // https://html.spec.whatwg.org/multipage/forms.html#category-listed
33 virtual bool is_listed() const override { return true; }
34
35 // https://html.spec.whatwg.org/multipage/forms.html#category-autocapitalize
36 virtual bool is_resettable() const override { return true; }
37
38 // https://html.spec.whatwg.org/multipage/forms.html#category-autocapitalize
39 virtual bool is_auto_capitalize_inheriting() const override { return true; }
40
41 // ^HTMLElement
42 // https://html.spec.whatwg.org/multipage/forms.html#category-label
43 virtual bool is_labelable() const override { return true; }
44
45 virtual void reset_algorithm() override;
46
47 // https://www.w3.org/TR/html-aria/#el-output
48 virtual Optional<ARIA::Role> default_role() const override { return ARIA::Role::status; }
49
50private:
51 HTMLOutputElement(DOM::Document&, DOM::QualifiedName);
52
53 virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override;
54};
55
56}