Render gradients

This commit is contained in:
Simon Sapin 2020-01-23 17:12:57 +01:00
parent f39c3ff38b
commit 632e731760
2 changed files with 348 additions and 2 deletions

View file

@ -19,6 +19,7 @@ use style::values::specified::ui::CursorKind;
use webrender_api::{self as wr, units};
mod background;
mod gradient;
#[derive(Clone, Copy)]
pub struct WebRenderImageInfo {
@ -282,8 +283,17 @@ impl<'a> BuilderForBoxFragment<'a> {
match layer {
ImageLayer::None => {},
ImageLayer::Image(image) => match image {
Image::Gradient(_gradient) => {
// TODO
Image::Gradient(gradient) => {
let intrinsic = IntrinsicSizes {
width: None,
height: None,
ratio: None,
};
if let Some(layer) =
&background::layout_layer(self, builder, index, intrinsic)
{
gradient::build(&self.fragment.style, gradient, layer, builder)
}
},
Image::Url(image_url) => {
// FIXME: images wont always have in intrinsic width or height