Implement CSS text truncation

This commit is contained in:
SGavrl committed 2026-08-03 13:29:16 +00:00
1 parent f8f8d6da51
commit 26a78a91c8
6 files changed
+589 -5

No files matched your search

+27
View File
@@ -452,6 +452,15 @@ pub struct LayoutStyle {
/// until the parent's computed outer/inner display is known. The DOM
/// top-down pass copies that provenance and then clears this marker.
pub(crate) display_inherit: bool,
/// Original legacy flexbox display provenance. `Some(false)` is
/// `-webkit-box`; `Some(true)` is `-webkit-inline-box`. A vertical legacy
/// box with an active line clamp computes to flow-root/inline-block, but
/// retaining the specified display makes that adjustment independent of
/// declaration order and keeps unclamped CSSOM serialization honest.
pub(crate) webkit_box_display: Option<bool>,
/// Computed legacy box orientation. Only the vertical/block-axis form
/// activates the legacy WebKit line-clamp contract.
pub(crate) webkit_box_orient_vertical: bool,
/// Computed CSS `container-type` (not inherited).
pub container_type: ContainerType,
/// The specified value was the CSS-wide `inherit` keyword. Resolved
@@ -934,6 +943,14 @@ pub struct LayoutStyle {
/// value (or the initial `normal`). The inline shaper uses this to retain
/// author/source newlines in code blocks and to select wrapping behavior.
pub white_space: Option<WhiteSpace>,
/// Non-inherited `text-overflow`. This first implementation deliberately
/// models Chromium's single-value `clip|ellipsis` syntax; bidi/two-sided
/// markers remain a separate extension.
pub text_overflow: TextOverflow,
/// Non-inherited legacy line count. It affects direct pure-text inline
/// formatting contexts only; nested descendant line counting needs a real
/// block-line iterator and must not be approximated by clipping children.
pub webkit_line_clamp: Option<u32>,
/// `overflow-wrap` (legacy alias: `word-wrap`). Inherited; `None` means
/// inherit the nearest ancestor's value (or the initial `normal`).
///
@@ -1168,6 +1185,16 @@ pub enum WhiteSpace {
BreakSpaces,
}
/// Single-value CSS `text-overflow` behavior supported by Chromium's default
/// feature set. The marker is generated by the inline formatter and never
/// inserted into DOM text.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
pub enum TextOverflow {
#[default]
Clip,
Ellipsis,
}
/// Emergency wrapping behavior for otherwise-unbreakable text.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
pub enum OverflowWrap {