layout_2020: Add 'white_space' field to InlineNestingLevelState

Indicate current white-space property of current nesting context.
This commit is contained in:
Pu Xingyu 2023-06-29 11:25:41 +08:00
parent a725380db0
commit 6f377a9262

View file

@ -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<PositioningContext>,
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,
},
),