From 6f377a926227ba052d1ab002ddf29dd750265fa0 Mon Sep 17 00:00:00 2001 From: Pu Xingyu Date: Thu, 29 Jun 2023 11:25:41 +0800 Subject: [PATCH] layout_2020: Add 'white_space' field to InlineNestingLevelState Indicate current white-space property of current nesting context. --- components/layout_2020/flow/inline.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/components/layout_2020/flow/inline.rs b/components/layout_2020/flow/inline.rs index 58f8884473e..ba94c9652d1 100644 --- a/components/layout_2020/flow/inline.rs +++ b/components/layout_2020/flow/inline.rs @@ -23,6 +23,7 @@ use app_units::Au; use atomic_refcell::AtomicRef; use gfx::text::text_run::GlyphRun; use servo_arc::Arc; +use style::computed_values::white_space::T as WhiteSpace; use style::logical_geometry::WritingMode; use style::properties::ComputedValues; use style::values::computed::{Length, LengthPercentage, Percentage}; @@ -74,6 +75,7 @@ struct InlineNestingLevelState<'box_tree> { inline_start: Length, max_block_size_of_fragments_so_far: Length, positioning_context: Option, + white_space: WhiteSpace, /// Indicates whether this nesting level have text decorations in effect. /// From https://drafts.csswg.org/css-text-decor/#line-decoration // "When specified on or propagated to a block container that establishes @@ -297,6 +299,7 @@ impl InlineFormattingContext { inline_start: Length::zero(), max_block_size_of_fragments_so_far: Length::zero(), positioning_context: None, + white_space: containing_block.style.clone_inherited_text().white_space, text_decoration_line: self.text_decoration_line, }, sequential_layout_state, @@ -503,6 +506,7 @@ impl InlineBox { start_corner += &relative_adjustement(&style, ifc.containing_block) } let positioning_context = PositioningContext::new_for_style(&style); + let white_space = style.clone_inherited_text().white_space; let text_decoration_line = ifc.current_nesting_level.text_decoration_line | style.clone_text_decoration_line(); PartialInlineBoxFragment { @@ -523,6 +527,7 @@ impl InlineBox { inline_start: ifc.inline_position, max_block_size_of_fragments_so_far: Length::zero(), positioning_context, + white_space, text_decoration_line: text_decoration_line, }, ),