Repository: servo/servo
File: components/layout/display_list/mod.rs (Rust)

Code before:
                    };

                    if let Some(layer) = layer {
                        if layer.repeat {
                            builder.wr().push_repeating_image(
                                &layer.common,
                                layer.bounds,
                                layer.tile_size,
                                layer.tile_spacing,
                                style.clone_image_rendering().to_webrender(),
                                wr::AlphaType::PremultipliedAlpha,
                                image_key,
                                wr::ColorF::WHITE,
                            )
                        } else {
                            builder.wr().push_image(
                                &layer.common,
                                layer.bounds,
                                style.clone_image_rendering().to_webrender(),
                                wr::AlphaType::PremultipliedAlpha,
                                image_key,
                                wr::ColorF::WHITE,
                            )
                        }

                        builder.mark_is_contentful();
                        let lcp_candidate_id = self
                            .fragment
                            .base
                            .tag
                            .map(|tag| LCPCandidateID(tag.node.id()))
                            .unwrap_or(LCPCandidateID(0));
                        builder.collect_lcp_candidate(
                            lcp_candidate_id,
                            layer.common.clip_rect,
                            layer.bounds,
                        );
                    }
                },
            }
        }
    }

    fn build_border_side(&mut self, style_color: BorderStyleColor) -> wr::BorderSide {
        wr::BorderSide {
            color: rgba(style_color.color),
            style: match style_color.style {
                BorderStyle::None => wr::BorderStyle::None,
                BorderStyle::Solid => wr::BorderStyle::Solid,
                BorderStyle::Double => wr::BorderStyle::Double,
                BorderStyle::Dotted => wr::BorderStyle::Dotted,

Review comment (suggestion):
When I saw this, I wondered to myself why it did not include gradients, but that's what the specification says. As I had this thought, we should include the specification text here to address anyone else in the future who is also confused:


```suggestion
                        // From <https://www.w3.org/TR/paint-timing/#sec-terminology>:
                        // > An element target is contentful when one or more of the following apply:
                        // > ..
                        // > target has a background-image which is a contentful image, and its used
                        // >  background-size has non-zero width and height values.
                        //
                        // > A CSS image img is a contentful image when all of the following apply:
                        // >  - img is url valued.
                        // >  - img is available.
                        builder.mark_is_contentful();
```

Code after:
                            let layer_size = layer.as_ref().map(|layer| {
                                Size2D::new(
                                    layer.tile_size.width * scale,
                                    layer.tile_size.height * scale,
                                )
                                .to_i32()
                            });

                            node.and_then(|node| {
                                let size = layer_size.unwrap_or(default_size);
                                builder.image_resolver.rasterize_vector_image(
                                    vector_image.id,
                                    size,
                                    node,
                                    vector_image.svg_id,
                                )
                            })
                            .and_then(|rasterized_image| rasterized_image.id)
                        },
                    };

                    let Some(image_key) = image_wr_key else {
                        continue;
                    };

                    if let Some(layer) = layer {
                        if layer.repeat {
                            builder.wr().push_repeating_image(
                                &layer.common,
                                layer.bounds,
                                layer.tile_size,
                                layer.tile_spacing,
                                style.clone_image_rendering().to_webrender(),
                                wr::AlphaType::PremultipliedAlpha,
                                image_key,
                                wr::ColorF::WHITE,
                            )
                        } else {
                            builder.wr().push_image(
                                &layer.common,
                                layer.bounds,
                                style.clone_image_rendering().to_webrender(),
                                wr::AlphaType::PremultipliedAlpha,
                                image_key,
                                wr::ColorF::WHITE,
                            )
                        }

                        // From <https://www.w3.org/TR/paint-timing/#sec-terminology>:
                        // An element target is contentful when one or more of the following apply:
                        // > target has a background-image which is a contentful image, and its used