mirror of
https://github.com/servo/servo.git
synced 2025-08-05 21:50:18 +01:00
Implement serialization of linear-gradient the same ways as in Gecko
This commit is contained in:
parent
9d74ae890b
commit
6ae4bf6ee8
3 changed files with 81 additions and 49 deletions
|
@ -56,7 +56,7 @@ use style::properties::longhands::border_image_repeat::computed_value::RepeatKey
|
|||
use style::properties::style_structs;
|
||||
use style::servo::restyle_damage::REPAINT;
|
||||
use style::values::{Either, RGBA};
|
||||
use style::values::computed::{Gradient, GradientItem, LengthOrPercentage};
|
||||
use style::values::computed::{Angle, Gradient, GradientItem, LengthOrPercentage};
|
||||
use style::values::computed::{LengthOrPercentageOrAuto, NumberOrPercentage, Position};
|
||||
use style::values::computed::effects::SimpleShadow;
|
||||
use style::values::computed::image::{EndingShape, LineDirection};
|
||||
|
@ -1214,6 +1214,18 @@ impl FragmentDisplayListBuilding for Fragment {
|
|||
-> display_list::Gradient {
|
||||
let angle = match *direction {
|
||||
LineDirection::Angle(angle) => angle.radians(),
|
||||
LineDirection::Horizontal(x) => {
|
||||
match x {
|
||||
X::Left => Angle::Degree(270.).radians(),
|
||||
X::Right => Angle::Degree(90.).radians(),
|
||||
}
|
||||
},
|
||||
LineDirection::Vertical(y) => {
|
||||
match y {
|
||||
Y::Top => Angle::Degree(0.).radians(),
|
||||
Y::Bottom => Angle::Degree(180.).radians(),
|
||||
}
|
||||
},
|
||||
LineDirection::Corner(horizontal, vertical) => {
|
||||
// This the angle for one of the diagonals of the box. Our angle
|
||||
// will either be this one, this one + PI, or one of the other
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue