mirror of
https://github.com/servo/servo.git
synced 2025-07-23 15:23:42 +01:00
Add check to handle zerosize linear gradients
This commit is contained in:
parent
9f58ae4b07
commit
d87e5d831b
1 changed files with 6 additions and 1 deletions
|
@ -660,9 +660,14 @@ impl<'a> ToRaqoteSource<'a> for FillOrStrokeStyle {
|
||||||
))),
|
))),
|
||||||
LinearGradient(style) => {
|
LinearGradient(style) => {
|
||||||
let stops = style.stops.into_iter().map(|s| s.to_raqote()).collect();
|
let stops = style.stops.into_iter().map(|s| s.to_raqote()).collect();
|
||||||
let gradient = raqote::Gradient { stops };
|
let mut gradient = raqote::Gradient { stops };
|
||||||
let start = Point2D::new(style.x0 as f32, style.y0 as f32);
|
let start = Point2D::new(style.x0 as f32, style.y0 as f32);
|
||||||
let end = Point2D::new(style.x1 as f32, style.y1 as f32);
|
let end = Point2D::new(style.x1 as f32, style.y1 as f32);
|
||||||
|
if start == end {
|
||||||
|
// TODO
|
||||||
|
// hack to make Pattern::is_zero_size_gradient() return true
|
||||||
|
gradient.stops.clear();
|
||||||
|
}
|
||||||
Some(raqote::Source::new_linear_gradient(
|
Some(raqote::Source::new_linear_gradient(
|
||||||
gradient,
|
gradient,
|
||||||
start,
|
start,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue