mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 15:38:10 +00:00
LibWeb: Introduce the slottable concept for DOM elements and text nodes
A slottable is either a DOM element or a DOM text node. They may be assigned to slots (HTMLSlotElement) either automatically or manually. Automatic assignment occurs by matching a slot's `name` attribute to a slottable's `slot` attribute. Manual assignment occurs by using the slot's (not yet implemented) `assign` API. This commit does not perform the above assignments. It just sets up the slottable concept via IDL and hooks the slottable mixin into the element and text nodes.
This commit is contained in:
parent
b85a252753
commit
45b36bd08a
12 changed files with 116 additions and 1 deletions
32
Userland/Libraries/LibWeb/DOM/Slottable.cpp
Normal file
32
Userland/Libraries/LibWeb/DOM/Slottable.cpp
Normal file
|
@ -0,0 +1,32 @@
|
|||
/*
|
||||
* Copyright (c) 2023, Tim Flynn <trflynn89@serenityos.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <LibWeb/Bindings/MainThreadVM.h>
|
||||
#include <LibWeb/DOM/Element.h>
|
||||
#include <LibWeb/DOM/Node.h>
|
||||
#include <LibWeb/DOM/ShadowRoot.h>
|
||||
#include <LibWeb/DOM/Slottable.h>
|
||||
#include <LibWeb/DOM/Text.h>
|
||||
#include <LibWeb/HTML/HTMLSlotElement.h>
|
||||
|
||||
namespace Web::DOM {
|
||||
|
||||
SlottableMixin::~SlottableMixin() = default;
|
||||
|
||||
void SlottableMixin::visit_edges(JS::Cell::Visitor& visitor)
|
||||
{
|
||||
visitor.visit(m_assigned_slot);
|
||||
visitor.visit(m_manual_slot_assignment);
|
||||
}
|
||||
|
||||
// https://dom.spec.whatwg.org/#dom-slotable-assignedslot
|
||||
JS::GCPtr<HTML::HTMLSlotElement> SlottableMixin::assigned_slot()
|
||||
{
|
||||
// FIXME: The assignedSlot getter steps are to return the result of find a slot given this and with the open flag set.
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue