1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 14:28:12 +00:00

LibWeb: Create a shadow tree for details elements with manual slots

The spec requires that details elements be assigned a shadow tree with
two slots. The first slot is assigned the first summary child element of
the details element. The second slot is assigned all other children.
This commit is contained in:
Timothy Flynn 2023-09-05 15:24:20 -04:00 committed by Andreas Kling
parent bdf2323b3f
commit b1632c58bf
6 changed files with 166 additions and 0 deletions

View file

@ -1,5 +1,6 @@
/*
* Copyright (c) 2020, the SerenityOS developers.
* Copyright (c) 2023, Tim Flynn <trflynn89@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
@ -10,6 +11,7 @@
#include <LibWeb/ARIA/Roles.h>
#include <LibWeb/HTML/HTMLElement.h>
#include <LibWeb/HTML/ToggleTaskTracker.h>
#include <LibWeb/WebIDL/ExceptionOr.h>
namespace Web::HTML {
@ -26,13 +28,22 @@ private:
HTMLDetailsElement(DOM::Document&, DOM::QualifiedName);
virtual void initialize(JS::Realm&) override;
virtual void visit_edges(Cell::Visitor&) override;
virtual void children_changed() override;
virtual void attribute_changed(DeprecatedFlyString const& name, DeprecatedString const& value) override;
void queue_a_details_toggle_event_task(String old_state, String new_state);
WebIDL::ExceptionOr<void> create_shadow_tree(JS::Realm&);
void update_shadow_tree_slots();
void update_shadow_tree_style();
// https://html.spec.whatwg.org/multipage/interactive-elements.html#details-toggle-task-tracker
Optional<ToggleTaskTracker> m_details_toggle_task_tracker;
JS::GCPtr<HTML::HTMLSlotElement> m_summary_slot;
JS::GCPtr<HTML::HTMLSlotElement> m_descendants_slot;
};
}