Properly set default direction of prefixed linear gradients

The default linear gradient direction is `to bottom`. This correspondes to
`top` keyword in prefixed linear gradients. We should preserve the default value.
This commit is contained in:
Nazım Can Altınova 2017-08-30 20:55:18 -07:00
parent 19cbea23a8
commit a0c1eb5109
3 changed files with 17 additions and 7 deletions

View file

@ -526,7 +526,10 @@ impl GradientKind {
input.expect_comma()?;
d
} else {
LineDirection::Vertical(Y::Bottom)
match *compat_mode {
CompatMode::Modern => LineDirection::Vertical(Y::Bottom),
_ => LineDirection::Vertical(Y::Top),
}
};
Ok(GenericGradientKind::Linear(direction))
}
@ -615,10 +618,13 @@ impl GradientKind {
}
impl GenericsLineDirection for LineDirection {
fn points_downwards(&self) -> bool {
fn points_downwards(&self, compat_mode: CompatMode) -> bool {
match *self {
LineDirection::Angle(ref angle) => angle.radians() == PI,
LineDirection::Vertical(Y::Bottom) => true,
LineDirection::Vertical(Y::Bottom)
if compat_mode == CompatMode::Modern => true,
LineDirection::Vertical(Y::Top)
if compat_mode != CompatMode::Modern => true,
_ => false,
}
}