mirror of
https://github.com/servo/servo.git
synced 2025-08-06 22:15:33 +01:00
Auto merge of #15905 - mephisto41:add-border-gradient, r=emilio
Add gradient border support. webrender add gradient border support in https://github.com/servo/webrender/pull/953. This pr add support in servo. --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors <!-- Either: --> - [X] These changes do not require tests because it should be covered by wpt <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/15905) <!-- Reviewable:end -->
This commit is contained in:
commit
fd8127b23b
6 changed files with 174 additions and 31 deletions
|
@ -886,10 +886,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>,
|
||||
|
||||
|
@ -900,6 +897,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 {
|
||||
|
@ -939,11 +945,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