mirror of
https://github.com/servo/servo.git
synced 2025-08-03 20:50:07 +01:00
Add gradient border support.
This commit is contained in:
parent
cc9fb0ba59
commit
02c675204a
3 changed files with 98 additions and 31 deletions
|
@ -885,10 +885,7 @@ pub struct IframeDisplayItem {
|
|||
|
||||
/// Paints a gradient.
|
||||
#[derive(Clone, Deserialize, HeapSizeOf, Serialize)]
|
||||
pub struct GradientDisplayItem {
|
||||
/// Fields common to all display items.
|
||||
pub base: BaseDisplayItem,
|
||||
|
||||
pub struct Gradient {
|
||||
/// The start point of the gradient (computed during display list construction).
|
||||
pub start_point: Point2D<Au>,
|
||||
|
||||
|
@ -899,6 +896,15 @@ pub struct GradientDisplayItem {
|
|||
pub stops: Vec<GradientStop>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Deserialize, HeapSizeOf, Serialize)]
|
||||
pub struct GradientDisplayItem {
|
||||
/// Fields common to all display item.
|
||||
pub base: BaseDisplayItem,
|
||||
|
||||
/// Contains all gradient data. Included start, end point and color stops.
|
||||
pub gradient: Gradient,
|
||||
}
|
||||
|
||||
/// A normal border, supporting CSS border styles.
|
||||
#[derive(Clone, HeapSizeOf, Deserialize, Serialize)]
|
||||
pub struct NormalBorder {
|
||||
|
@ -938,11 +944,22 @@ pub struct ImageBorder {
|
|||
pub repeat_vertical: webrender_traits::RepeatMode,
|
||||
}
|
||||
|
||||
/// A border that is made of linear gradient
|
||||
#[derive(Clone, HeapSizeOf, Deserialize, Serialize)]
|
||||
pub struct GradientBorder {
|
||||
/// The gradient info that this border uses, border-image-source.
|
||||
pub gradient: Gradient,
|
||||
|
||||
/// Outsets for the border, as per border-image-outset.
|
||||
pub outset: SideOffsets2D<f32>,
|
||||
}
|
||||
|
||||
/// Specifies the type of border
|
||||
#[derive(Clone, HeapSizeOf, Deserialize, Serialize)]
|
||||
pub enum BorderDetails {
|
||||
Normal(NormalBorder),
|
||||
Image(ImageBorder),
|
||||
Gradient(GradientBorder),
|
||||
}
|
||||
|
||||
/// Paints a border.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue