mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
stylo: Don't serialize default position on -moz- prefixed linear gradient
Normally, we should not serialize if the line direction points downwards. Unprefixed and -webkit- prefixed syntaxes use only Keyword enum for line direction and we check them already. But -moz- prefixed linear gradients can store position too. Therefore it's stored inside `LineDirection::MozPosition` and we should check that for consistency between other gradients.
This commit is contained in:
parent
056c085119
commit
dfd12d78c6
2 changed files with 35 additions and 1 deletions
|
@ -13,6 +13,8 @@ use std::fmt;
|
|||
use style_traits::ToCss;
|
||||
use values::{Either, None_};
|
||||
use values::computed::{Angle, ComputedUrl, Context, Length, LengthOrPercentage, NumberOrPercentage, ToComputedValue};
|
||||
#[cfg(feature = "gecko")]
|
||||
use values::computed::Percentage;
|
||||
use values::computed::position::Position;
|
||||
use values::generics::image::{CompatMode, ColorStop as GenericColorStop, EndingShape as GenericEndingShape};
|
||||
use values::generics::image::{Gradient as GenericGradient, GradientItem as GenericGradientItem};
|
||||
|
@ -88,7 +90,13 @@ impl GenericLineDirection for LineDirection {
|
|||
if compat_mode != CompatMode::Modern => true,
|
||||
LineDirection::Corner(..) => false,
|
||||
#[cfg(feature = "gecko")]
|
||||
LineDirection::MozPosition(_, _) => false,
|
||||
LineDirection::MozPosition(Some(Position {
|
||||
horizontal: LengthOrPercentage::Percentage(Percentage(x)),
|
||||
vertical: LengthOrPercentage::Percentage(Percentage(y)),
|
||||
}), None) => {
|
||||
// `50% 0%` is the default value for line direction.
|
||||
x == 0.5 && y == 0.0
|
||||
},
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue