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 HTMLTextAreaElement final
17 : public HTMLElement
18 , public FormAssociatedElement {
19 WEB_PLATFORM_OBJECT(HTMLTextAreaElement, HTMLElement);
20 FORM_ASSOCIATED_ELEMENT(HTMLElement, HTMLTextAreaElement)
21
22public:
23 virtual ~HTMLTextAreaElement() override;
24
25 DeprecatedString const& type() const
26 {
27 static DeprecatedString textarea = "textarea";
28 return textarea;
29 }
30
31 // ^EventTarget
32 // https://html.spec.whatwg.org/multipage/interaction.html#the-tabindex-attribute:the-textarea-element
33 virtual bool is_focusable() const override { return true; }
34
35 // ^FormAssociatedElement
36 // https://html.spec.whatwg.org/multipage/forms.html#category-listed
37 virtual bool is_listed() const override { return true; }
38
39 // https://html.spec.whatwg.org/multipage/forms.html#category-submit
40 virtual bool is_submittable() const override { return true; }
41
42 // https://html.spec.whatwg.org/multipage/forms.html#category-reset
43 virtual bool is_resettable() const override { return true; }
44
45 // https://html.spec.whatwg.org/multipage/forms.html#category-autocapitalize
46 virtual bool is_auto_capitalize_inheriting() const override { return true; }
47
48 // ^HTMLElement
49 // https://html.spec.whatwg.org/multipage/forms.html#category-label
50 virtual bool is_labelable() const override { return true; }
51
52 virtual void reset_algorithm() override;
53
54 // https://www.w3.org/TR/html-aria/#el-textarea
55 virtual Optional<ARIA::Role> default_role() const override { return ARIA::Role::textbox; }
56
57private:
58 HTMLTextAreaElement(DOM::Document&, DOM::QualifiedName);
59
60 virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override;
61
62 // ^DOM::Element
63 virtual i32 default_tab_index_value() const override;
64};
65
66}