layout: support tiled gradients

Use background-size, background-position properties to render
CSS gradients.

Some cleanup in display_list_builder.rs related to gradient
calculations.

Adds two wpt tests for tiled gradients.

Note: For now even gradients with background-repeat: no-repeat
are repeated. Sometimes the gradient is not repeated everywhere.

Enable vars-background-shorthand-001.html CSS test.
This commit is contained in:
Pyfisch 2017-12-13 20:02:49 +01:00
parent 80341b291b
commit 9502e9f42a
9 changed files with 353 additions and 164 deletions

View file

@ -720,6 +720,15 @@ pub struct GradientDisplayItem {
/// Contains all gradient data. Included start, end point and color stops.
pub gradient: Gradient,
/// The size of a single gradient tile.
///
/// The gradient may fill an entire element background
/// but it can be composed from many smaller copys of
/// the same gradient.
///
/// Without tiles, the tile will be the same size as the background.
pub tile: Size2D<Au>,
}
/// Paints a radial gradient.
@ -745,6 +754,15 @@ pub struct RadialGradientDisplayItem {
/// Contains all gradient data.
pub gradient: RadialGradient,
/// The size of a single gradient tile.
///
/// The gradient may fill an entire element background
/// but it can be composed from many smaller copys of
/// the same gradient.
///
/// Without tiles, the tile will be the same size as the background.
pub tile: Size2D<Au>,
}
/// A normal border, supporting CSS border styles.