mirror of
https://github.com/servo/servo.git
synced 2025-08-15 18:35:33 +01:00
Implement -webkit-radial-gradient() (fixes #15441)
This commit is contained in:
parent
50c25f3221
commit
d5cd34dec8
2 changed files with 82 additions and 25 deletions
|
@ -207,16 +207,21 @@ impl nsStyleImage {
|
|||
gecko_gradient
|
||||
},
|
||||
GradientKind::Radial(shape, position) => {
|
||||
let keyword_to_gecko_size = |keyword| {
|
||||
match keyword {
|
||||
SizeKeyword::ClosestSide => NS_STYLE_GRADIENT_SIZE_CLOSEST_SIDE,
|
||||
SizeKeyword::FarthestSide => NS_STYLE_GRADIENT_SIZE_FARTHEST_SIDE,
|
||||
SizeKeyword::ClosestCorner => NS_STYLE_GRADIENT_SIZE_CLOSEST_CORNER,
|
||||
SizeKeyword::FarthestCorner => NS_STYLE_GRADIENT_SIZE_FARTHEST_CORNER,
|
||||
SizeKeyword::Contain => NS_STYLE_GRADIENT_SIZE_CLOSEST_SIDE,
|
||||
SizeKeyword::Cover => NS_STYLE_GRADIENT_SIZE_FARTHEST_CORNER,
|
||||
}
|
||||
};
|
||||
let (gecko_shape, gecko_size) = match shape {
|
||||
GradientShape::Circle(ref length) => {
|
||||
let size = match *length {
|
||||
LengthOrKeyword::Keyword(keyword) => {
|
||||
match keyword {
|
||||
SizeKeyword::ClosestSide => NS_STYLE_GRADIENT_SIZE_CLOSEST_SIDE,
|
||||
SizeKeyword::FarthestSide => NS_STYLE_GRADIENT_SIZE_FARTHEST_SIDE,
|
||||
SizeKeyword::ClosestCorner => NS_STYLE_GRADIENT_SIZE_CLOSEST_CORNER,
|
||||
SizeKeyword::FarthestCorner => NS_STYLE_GRADIENT_SIZE_FARTHEST_CORNER,
|
||||
}
|
||||
keyword_to_gecko_size(keyword)
|
||||
},
|
||||
_ => NS_STYLE_GRADIENT_SIZE_EXPLICIT_SIZE,
|
||||
};
|
||||
|
@ -225,12 +230,7 @@ impl nsStyleImage {
|
|||
GradientShape::Ellipse(ref length) => {
|
||||
let size = match *length {
|
||||
LengthOrPercentageOrKeyword::Keyword(keyword) => {
|
||||
match keyword {
|
||||
SizeKeyword::ClosestSide => NS_STYLE_GRADIENT_SIZE_CLOSEST_SIDE,
|
||||
SizeKeyword::FarthestSide => NS_STYLE_GRADIENT_SIZE_FARTHEST_SIDE,
|
||||
SizeKeyword::ClosestCorner => NS_STYLE_GRADIENT_SIZE_CLOSEST_CORNER,
|
||||
SizeKeyword::FarthestCorner => NS_STYLE_GRADIENT_SIZE_FARTHEST_CORNER,
|
||||
}
|
||||
keyword_to_gecko_size(keyword)
|
||||
},
|
||||
_ => NS_STYLE_GRADIENT_SIZE_EXPLICIT_SIZE,
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue