/// * Passing a `WindowLogicalRect` directly to a `WebRender` push function is a **type error** (it
pub fn to_padding_box(self, border: &crate::solver3::geometry::EdgeSizes) -> PaddingBoxRect {
pub(crate) fn translate_item(mut item: DisplayListItem, delta: LogicalPosition) -> DisplayListItem {
let (font_hash, font_size, source_node_index) = (*font_hash, *font_size_px, *source_node_index);
#[allow(clippy::too_many_lines)] // large but cohesive: single-purpose layout/render/parse routine (one branch per case)
#[allow(clippy::too_many_lines)] // large but cohesive: single-purpose layout/render/parse routine (one branch per case)
#[allow(clippy::suboptimal_flops)] // mul_add not guaranteed faster/available without target +fma; keep explicit a*b+c
pub(crate) fn add_forced_page_break(&mut self, y_position: f32, causing_node: Option<NodeId>) {
pub(crate) fn push_hit_test_area(&mut self, bounds: LogicalRect, tag: DisplayListTagId) {
width > 0.0 && style.is_some_and(|s| !matches!(s, BorderStyle::None | BorderStyle::Hidden))
pub(crate) fn push_underline(&mut self, bounds: LogicalRect, color: ColorU, thickness: f32) {
#[allow(clippy::implicit_hasher)] // internal helper; only ever called with the default-hasher HashMap/HashSet
// +spec:stacking-contexts:9e85a3 - Stacking context tree: hierarchical, nested, atomic painting
fn get_styled_node_state(&self, dom_id: NodeId) -> azul_core::styled_dom::StyledNodeState {
fn paint_selections(&self, builder: &mut DisplayListBuilder, node_index: usize) -> Result<()> {
let node_state = &self.ctx.styled_dom.styled_nodes.as_container()[dom_id].styled_node_state;
if let Some(text_selection) = self.ctx.text_selections.get(&self.ctx.styled_dom.dom_id) {
fn paint_cursor(&self, builder: &mut DisplayListBuilder, node_index: usize) -> Result<()> {
let node_state = &self.ctx.styled_dom.styled_nodes.as_container()[dom_id].styled_node_state;
// +spec:writing-modes:a86a28 - preorder depth-first traversal of the rendering tree in logical
// +spec:box-model:de94ab - stacking context painting order (negative z, in-flow, z=0, positive
// 2.2 §9.9.1 painting order: negative z-index, in-flow, z-index 0, positive z-index (recursive)
let azul_core::dom::SvgNodeData::Path(path) = node_data.get(dom_id)?.get_svg_data()? else {
fn push_image_mask_clip(&self, builder: &mut DisplayListBuilder, node_index: usize) -> bool {
#[allow(clippy::too_many_lines)] // large but cohesive: single-purpose layout/render/parse routine (one branch per case)
let parent_paints_me_as_an_inline_shape = self.parent_paints_as_inline_shape(node_index);
fn paint_collapsed_table_borders(&self, builder: &mut DisplayListBuilder, table_index: usize) {
/// Emits drawing commands for the foreground content, including hit-test areas and scrollbars.
fn paint_scrollbars(&self, builder: &mut DisplayListBuilder, node_index: usize) -> Result<()> {
#[allow(clippy::suboptimal_flops)] // mul_add not guaranteed faster/available without target +fma; keep explicit a*b+c
// +spec:overflow:47b791 - z-index applies to positioned boxes; z-index:auto does not establish
let z_auto = crate::solver3::getters::is_z_index_auto(self.ctx.styled_dom, Some(dom_id));
if let Some(styled_node) = self.ctx.styled_dom.styled_nodes.as_container().get(dom_id) {
if crate::solver3::getters::get_opacity(self.ctx.styled_dom, dom_id, node_state) < 1.0 {
/// Expands `clip_rect` outward by the `overflow-clip-margin` value on axes that use `overflow:
fn get_scroll_content_size(node: &LayoutNodeHot, warm: Option<&LayoutNodeWarm>) -> LogicalSize {
#[allow(clippy::cast_possible_truncation, clippy::cast_sign_loss)] // bounded graphics/coord/font/
// enum/value mapping/dispatch table: one arm per input variant (or cross-type bindings that can't
#[allow(clippy::too_many_lines)] // large but cohesive: single-purpose layout/render/parse routine
clip_rect_bounds(bounds, page_top, page_bottom).map(|clipped| DisplayListItem::SelectionRect {
clip_rect_bounds(bounds, page_top, page_bottom).map(|clipped| DisplayListItem::HitTestArea {
fn clip_rect_bounds(bounds: LogicalRect, page_top: f32, page_bottom: f32) -> Option<LogicalRect> {
#[allow(clippy::cast_possible_truncation, clippy::cast_sign_loss)] // bounded graphics/coord/font/fixed-point/debug-marker cast
#[allow(clippy::cast_precision_loss)] // bounded graphics/coord/font/fixed-point/debug-marker cast
#[allow(clippy::too_many_lines)] // large but cohesive: single-purpose layout/render/parse routine (one branch per case)
#[allow(clippy::too_many_lines)] // large but cohesive: single-purpose layout/render/parse routine
let breaks = page_breaks::compute_page_breaks_from_display_list(display_list, &constraints);
#[allow(clippy::too_many_lines)] // large but cohesive: single-purpose layout/render/parse routine
pub(crate) fn offset_display_item_y(item: &DisplayListItem, y_offset: f32) -> DisplayListItem {
let baseline_y = bounds.origin.y + (bounds.size.height - text_height).mul_add(0.5, ascent_px);
/// 1. For each Text item in the display list, check if any glyphs extend past the container's right
/// 2. If so, find the last glyph that fits entirely within the container, accounting for the width
/// 4. Append an ellipsis glyph (U+2026 = glyph index 0x2026 as a fallback; proper glyph lookup
// +spec:overflow:f175b9 - bidi ellipsis: characters visually at the end edge of the line are hidden
#[allow(clippy::many_single_char_names)] // domain-standard coordinate/geometry/short-lived names