render: paint generated boxes with contextual backgrounds

This commit is contained in:
SGavrl committed 2026-07-26 19:48:59 +00:00
1 parent eea960dd32
commit 37f6c93af9
5 files changed
+556 -63

No files matched your search

+13
View File
@@ -251,6 +251,11 @@ pub struct LayoutStyle {
/// o'clock per CSS, list of (rgba, optional 0..1 stop position)). Modern
/// hero sections use gradients heavily; without this they paint white.
pub background_gradient: Option<(f32, Vec<([u8; 4], Option<f32>)>)>,
/// First `radial-gradient(...)` layer: center in box-relative fractions
/// and color stops. It is painted below the first linear layer, matching
/// the common `linear-gradient(...), radial-gradient(...)` hero pattern.
pub background_radial_gradient:
Option<((f32, f32), Vec<([u8; 4], Option<f32>)>)>,
/// `conic-gradient(...)` background. The angle is the CSS `from` angle,
/// the center is a fraction of the border box, and stops are normalized
/// during paint. Conic gradients commonly provide the color source for a
@@ -265,6 +270,9 @@ pub struct LayoutStyle {
/// `10px` applies to both axes, matching how small square icons are
/// almost always sized).
pub background_size: Option<(f32, f32)>,
/// Raw one/two-axis `background-size` expression, retained for paint-time
/// resolution against the final owner box (`calc(100% - 2rem) auto`).
pub background_size_expression: Option<String>,
/// Keyword `background-size` behavior. `None` is CSS `auto`, which uses
/// the image's intrinsic dimensions rather than stretching it to the box.
pub background_size_fit: Option<ObjectFit>,
@@ -440,6 +448,11 @@ pub struct LayoutStyle {
/// children, same as if it were real text content.
pub before_content: Option<String>,
pub after_content: Option<String>,
/// Computed boxes generated by `::before`/`::after`. Text-only pseudos
/// continue through `before_content`/`after_content`; these styles retain
/// positioned decorative boxes for layout-independent painting.
pub before_pseudo: Option<Box<LayoutStyle>>,
pub after_pseudo: Option<Box<LayoutStyle>>,
/// True for `inline-block`/`inline-flex`/`inline-grid`: participates in
/// the surrounding inline flow from the outside, like plain `inline`