From 45e85d20b64862df119f643f24e2d500c76c58f3 Mon Sep 17 00:00:00 2001 From: Aliaksandr Kalenik Date: Mon, 16 Jan 2023 13:51:49 +0100 Subject: [PATCH] LibWeb: Output display type inline-table in layout dump --- Userland/Libraries/LibWeb/Dump.cpp | 8 +++++--- Userland/Libraries/LibWeb/Layout/Node.cpp | 6 ++++++ Userland/Libraries/LibWeb/Layout/Node.h | 1 + 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/Userland/Libraries/LibWeb/Dump.cpp b/Userland/Libraries/LibWeb/Dump.cpp index 59e270c1b27..4f02ccc9eff 100644 --- a/Userland/Libraries/LibWeb/Dump.cpp +++ b/Userland/Libraries/LibWeb/Dump.cpp @@ -121,7 +121,7 @@ void dump_tree(StringBuilder& builder, Layout::Node const& layout_node, bool sho StringView svg_box_color_on = ""sv; StringView positioned_color_on = ""sv; StringView floating_color_on = ""sv; - StringView inline_block_color_on = ""sv; + StringView inline_color_on = ""sv; StringView line_box_color_on = ""sv; StringView fragment_color_on = ""sv; StringView flex_color_on = ""sv; @@ -133,7 +133,7 @@ void dump_tree(StringBuilder& builder, Layout::Node const& layout_node, bool sho svg_box_color_on = "\033[31m"sv; positioned_color_on = "\033[31;1m"sv; floating_color_on = "\033[32;1m"sv; - inline_block_color_on = "\033[36;1m"sv; + inline_color_on = "\033[36;1m"sv; line_box_color_on = "\033[34;1m"sv; fragment_color_on = "\033[35;1m"sv; flex_color_on = "\033[34;1m"sv; @@ -178,7 +178,9 @@ void dump_tree(StringBuilder& builder, Layout::Node const& layout_node, bool sho if (box.is_floating()) builder.appendff(" {}floating{}", floating_color_on, color_off); if (box.is_inline_block()) - builder.appendff(" {}inline-block{}", inline_block_color_on, color_off); + builder.appendff(" {}inline-block{}", inline_color_on, color_off); + if (box.is_inline_table()) + builder.appendff(" {}inline-table{}", inline_color_on, color_off); if (box.display().is_flex_inside()) { StringView direction; switch (box.computed_values().flex_direction()) { diff --git a/Userland/Libraries/LibWeb/Layout/Node.cpp b/Userland/Libraries/LibWeb/Layout/Node.cpp index ae59a86446f..74632dac010 100644 --- a/Userland/Libraries/LibWeb/Layout/Node.cpp +++ b/Userland/Libraries/LibWeb/Layout/Node.cpp @@ -659,6 +659,12 @@ bool Node::is_inline_block() const return display.is_inline_outside() && display.is_flow_root_inside(); } +bool Node::is_inline_table() const +{ + auto display = this->display(); + return display.is_inline_outside() && display.is_table_inside(); +} + JS::NonnullGCPtr NodeWithStyle::create_anonymous_wrapper() const { auto wrapper = heap().allocate_without_realm(const_cast(document()), nullptr, m_computed_values.clone_inherited_values()); diff --git a/Userland/Libraries/LibWeb/Layout/Node.h b/Userland/Libraries/LibWeb/Layout/Node.h index 109ab805872..7a9a391b381 100644 --- a/Userland/Libraries/LibWeb/Layout/Node.h +++ b/Userland/Libraries/LibWeb/Layout/Node.h @@ -76,6 +76,7 @@ public: bool is_inline() const; bool is_inline_block() const; + bool is_inline_table() const; bool is_out_of_flow(FormattingContext const&) const;