// +spec:containing-block:723eee - Percentages specify sizing with respect to the containing block
// +spec:containing-block:8ad6f4 - Percentage resolution against containing block (editorial note:
// transferred percentages) +spec:containing-block:257f3b - Block-axis percentages resolve against
// containing block size +spec:containing-block:f1344e - percentage min/max-width resolved against
/// // +spec:display-contents:f12d4e - intrinsic sizing: size determined by contents, not context
// drops 2→0 RIGHT BEFORE this call. It's currently INLINED into layout_document (absent from the
// lift log), so its frame/entry isn't a separate SP-wrapped @sub_ call. Forcing it OUT makes the
// call a wrapped @sub_ → enforce_sp_preservation save/restores SP around it. If new_tree survives
// (sizingEntry=2), the inlined entry/frame-setup was mis-lifting SP. (g60's inline(always) was a
#[allow(clippy::cast_possible_truncation)] // bounded graphics/coord/font/fixed-point/debug-marker cast
// (caller's &new_tree). Same → nodes-field-offset mis-lift; differ → &mut arg mis-passed.
const fn new(ctx: &'a mut LayoutContext<'b, T>, text_cache: &'c mut LayoutCache) -> Self {
#[allow(clippy::cast_possible_truncation)] // bounded graphics/coord/font/fixed-point/debug-marker
let text_items = split_text_for_whitespace(ctx.styled_dom, dom_id, &text, &style_props);
#[allow(clippy::cast_possible_truncation)] // bounded graphics/coord/font/fixed-point/debug-marker cast
#[allow(clippy::match_same_arms)] // enum/value mapping/dispatch table: one arm per input variant
// +spec:height-calculation:1c899b - width and height properties specify the preferred size of the
/// // +spec:display-contents:71ccde - extrinsic sizing: size determined by context (containing
/// 1. `width` and `height` CSS properties are resolved to pixel values. Percentages are calculated
// +spec:width-calculation:fb0629 - width/margin used values depend on box type, auto replaced by
// <=8B Copy param kept by-ref intentionally (hot pixel/coord path or to avoid churning call sites
Text3AvailableSpace::Definite(w) => auto_block_inline_size(&LogicalSize::new(w, 0.0), bp),
// enum/value mapping/dispatch table: one arm per input variant (or cross-type bindings that can't
#[allow(clippy::too_many_lines, clippy::cognitive_complexity)] // large but cohesive: single-purpose layout/render/parse routine (one branch per case)
matches!(node_data.get_node_type(), NodeType::Image(_)) || node_data.is_virtual_view_node();
let css_width = if display.unwrap_or_default() == LayoutDisplay::Inline && !is_replaced {
let css_height = if display.unwrap_or_default() == LayoutDisplay::Inline && !is_replaced {
// +spec:intrinsic-sizing:9e1c9d - non-quantitative values (auto, min-content, max-content) are
// +spec:height-calculation:7880e3 - Distinction between box types for height/margin calculation
// +spec:height-calculation:6a6cac - §10.5 content height resolution (auto, length, percentage)
// +spec:replaced-elements:5a85ce - abs-pos replaced: derive auto width from height × intrinsic
#[allow(clippy::cast_precision_loss)] // small integer aspect-ratio components (e.g. 2000/1000)
} else if let MultiValue::Exact(azul_css::props::style::effects::StyleAspectRatio::Ratio(ar)) =
// box-sizing: border-box includes padding+border in width/height; content-box adds them outside
// +spec:box-sizing:8159a8 - box-sizing property indicates whether content-box or border-box is
// +spec:min-max-sizing:d97870 - width/height/min/max refer to physical dimensions; layout rules
// +spec:min-max-sizing:b02ebc - sizing properties min-width/max-width/min-height/max-height and
// preferred aspect ratio +spec:replaced-elements:740f3e - constraint violation table for replaced
// min-width/min-height <length> with aspect ratio for replaced elements with intrinsic ratios.
// Implements all 10 cases from the spec table, coordinating +spec:min-max-sizing:07620d - CSS 2.2
// §10.4 constraint violation table for replaced elements with intrinsic ratios Implements all 11
// cases from the spec table, coordinating width and height together to preserve the aspect ratio
// +spec:min-max-sizing:92ab8d - constraint violation table for replaced elements with intrinsic
// +spec:positioning:c0af55 - automatic minimum size of abspos box is always zero (default 0.0)
// +spec:min-max-sizing:713560 - constraint violation table for replaced elements with intrinsic
// +spec:min-max-sizing:114b53 - min-width/max-width/min-height/max-height property definitions:
// initial values, percentage resolution against containing block, applies to elements accepting
// width/height +spec:min-max-sizing:12667d - width/height/min-width/min-height/max-width/max-height
/// +spec:min-max-sizing:205e9e - intrinsic size constraints (min/max-content contributions, min/max
// +spec:min-max-sizing:cac146 - min-width/min-height specify minimum box dimensions; max overridden
// +spec:height-calculation:22a77a - percentage min/max-height resolved against containing block; if
// CB height depends on content and element is not absolutely positioned, percentage treated as 0
// constrain box heights to a range +spec:height-calculation:c6c33a - min-height and max-height
pub fn extract_text_from_node(styled_dom: &StyledDom, node_id: NodeId) -> Option<String> {