1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 04:57:44 +00:00

LibWeb: Perform layout of a slot's assigned nodes

This commit is contained in:
Timothy Flynn 2023-09-05 15:17:10 -04:00 committed by Andreas Kling
parent e4d3a9aa68
commit bdf2323b3f

View file

@ -21,6 +21,7 @@
#include <LibWeb/HTML/HTMLButtonElement.h>
#include <LibWeb/HTML/HTMLInputElement.h>
#include <LibWeb/HTML/HTMLProgressElement.h>
#include <LibWeb/HTML/HTMLSlotElement.h>
#include <LibWeb/Layout/ListItemBox.h>
#include <LibWeb/Layout/ListItemMarkerBox.h>
#include <LibWeb/Layout/Node.h>
@ -342,6 +343,19 @@ ErrorOr<void> TreeBuilder::create_layout_tree(DOM::Node& dom_node, TreeBuilder::
layout_node->append_child(*list_item_marker);
}
if (is<HTML::HTMLSlotElement>(dom_node)) {
auto slottables = static_cast<HTML::HTMLSlotElement&>(dom_node).assigned_nodes_internal();
push_parent(verify_cast<NodeWithStyle>(*layout_node));
for (auto const& slottable : slottables) {
TRY(slottable.visit([&](auto& node) -> ErrorOr<void> {
return create_layout_tree(node, context);
}));
}
pop_parent();
}
if (is<HTML::HTMLProgressElement>(dom_node)) {
auto& progress = static_cast<HTML::HTMLProgressElement&>(dom_node);
if (!progress.using_system_appearance()) {