From 481fdfee68a816921d42258f198e6338d43e1dd9 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Tue, 15 Aug 2023 09:34:06 +0200 Subject: [PATCH] LibWeb: Resolve CSS inset properties when entering inline-flow elements We don't actually apply the insets anywhere yet, but at least now they are available in the node's layout state. --- Userland/Libraries/LibWeb/Layout/FormattingContext.h | 3 ++- Userland/Libraries/LibWeb/Layout/InlineLevelIterator.cpp | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/Userland/Libraries/LibWeb/Layout/FormattingContext.h b/Userland/Libraries/LibWeb/Layout/FormattingContext.h index 4f1de6d645..4b8030f6e8 100644 --- a/Userland/Libraries/LibWeb/Layout/FormattingContext.h +++ b/Userland/Libraries/LibWeb/Layout/FormattingContext.h @@ -96,6 +96,8 @@ public: virtual CSSPixelPoint calculate_static_position(Box const&) const; bool can_skip_is_anonymous_text_run(Box&); + void compute_inset(NodeWithStyleAndBoxModelMetrics const&); + protected: FormattingContext(Type, LayoutState&, Box const&, FormattingContext* parent = nullptr); @@ -106,7 +108,6 @@ protected: [[nodiscard]] bool should_treat_max_height_as_none(Box const&, AvailableSize const&) const; OwnPtr layout_inside(Box const&, LayoutMode, AvailableSpace const&); - void compute_inset(Box const& box); struct SpaceUsedByFloats { CSSPixels left { 0 }; diff --git a/Userland/Libraries/LibWeb/Layout/InlineLevelIterator.cpp b/Userland/Libraries/LibWeb/Layout/InlineLevelIterator.cpp index b35d44d72a..32b21cf8f6 100644 --- a/Userland/Libraries/LibWeb/Layout/InlineLevelIterator.cpp +++ b/Userland/Libraries/LibWeb/Layout/InlineLevelIterator.cpp @@ -42,6 +42,9 @@ void InlineLevelIterator::enter_node_with_box_model_metrics(Layout::NodeWithStyl m_extra_leading_metrics->border += used_values.border_left; m_extra_leading_metrics->padding += used_values.padding_left; + // Now's our chance to resolve the inset properties for this node. + m_inline_formatting_context.compute_inset(node); + m_box_model_node_stack.append(node); }