1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 20:47:45 +00:00

LibWeb: Remove Layout::TableBox

Solves conflict in layout tree "type system" when elements <label> (or
<button>) can't have `display: table` because Box can't be
Layout::Label (or Layout::ButtonBox) and Layout::TableBox at the same
time.
This commit is contained in:
Aliaksandr Kalenik 2023-05-29 14:11:19 +03:00 committed by Andreas Kling
parent 269310268d
commit 258f3ea952
34 changed files with 55 additions and 118 deletions

View file

@ -18,7 +18,6 @@
#include <LibWeb/Layout/ListItemMarkerBox.h>
#include <LibWeb/Layout/ReplacedBox.h>
#include <LibWeb/Layout/SVGSVGBox.h>
#include <LibWeb/Layout/TableBox.h>
#include <LibWeb/Layout/TableWrapper.h>
#include <LibWeb/Layout/Viewport.h>
@ -385,7 +384,16 @@ CSSPixels BlockFormattingContext::compute_table_box_width_inside_table_wrapper(B
auto context = create_independent_formatting_context_if_needed(throwaway_state, box);
VERIFY(context);
context->run(box, LayoutMode::IntrinsicSizing, m_state.get(box).available_inner_space_or_constraints_from(available_space));
auto const* table_box = box.first_child_of_type<TableBox>();
Optional<Box const&> table_box;
box.for_each_in_subtree_of_type<Box>([&](Box const& child_box) {
if (child_box.display().is_table_inside()) {
table_box = child_box;
return IterationDecision::Break;
}
return IterationDecision::Continue;
});
VERIFY(table_box.has_value());
auto table_used_width = throwaway_state.get(*table_box).content_width();
return table_used_width > available_width ? available_width : table_used_width;