/src/serenity/Userland/Libraries/LibWeb/HTML/HTMLDetailsElement.h
Line | Count | Source |
1 | | /* |
2 | | * Copyright (c) 2020, the SerenityOS developers. |
3 | | * Copyright (c) 2023, Tim Flynn <trflynn89@serenityos.org> |
4 | | * |
5 | | * SPDX-License-Identifier: BSD-2-Clause |
6 | | */ |
7 | | |
8 | | #pragma once |
9 | | |
10 | | #include <AK/Optional.h> |
11 | | #include <LibWeb/ARIA/Roles.h> |
12 | | #include <LibWeb/HTML/HTMLElement.h> |
13 | | #include <LibWeb/HTML/ToggleTaskTracker.h> |
14 | | #include <LibWeb/WebIDL/ExceptionOr.h> |
15 | | |
16 | | namespace Web::HTML { |
17 | | |
18 | | class HTMLDetailsElement final : public HTMLElement { |
19 | | WEB_PLATFORM_OBJECT(HTMLDetailsElement, HTMLElement); |
20 | | JS_DECLARE_ALLOCATOR(HTMLDetailsElement); |
21 | | |
22 | | public: |
23 | | virtual ~HTMLDetailsElement() override; |
24 | | |
25 | | // https://www.w3.org/TR/html-aria/#el-details |
26 | 0 | virtual Optional<ARIA::Role> default_role() const override { return ARIA::Role::group; } |
27 | | |
28 | | private: |
29 | | HTMLDetailsElement(DOM::Document&, DOM::QualifiedName); |
30 | | |
31 | | virtual void initialize(JS::Realm&) override; |
32 | | virtual void visit_edges(Cell::Visitor&) override; |
33 | | |
34 | | virtual void inserted() override; |
35 | | virtual void removed_from(DOM::Node*) override; |
36 | | virtual void children_changed() override; |
37 | | virtual void attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value) override; |
38 | | |
39 | | void queue_a_details_toggle_event_task(String old_state, String new_state); |
40 | | |
41 | | WebIDL::ExceptionOr<void> create_shadow_tree_if_needed(); |
42 | | void update_shadow_tree_slots(); |
43 | | void update_shadow_tree_style(); |
44 | | |
45 | | // https://html.spec.whatwg.org/multipage/interactive-elements.html#details-toggle-task-tracker |
46 | | Optional<ToggleTaskTracker> m_details_toggle_task_tracker; |
47 | | |
48 | | JS::GCPtr<HTML::HTMLSlotElement> m_summary_slot; |
49 | | JS::GCPtr<HTML::HTMLSlotElement> m_descendants_slot; |
50 | | }; |
51 | | |
52 | | } |