Auto merge of #18321 - canaltinova:default-linear-gradient, r=Manishearth

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.

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] These changes fix [Bug 1395189](https://bugzilla.mozilla.org/show_bug.cgi?id=1395189)

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/18321)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2017-08-31 23:18:23 -05:00 committed by GitHub
commit ff30f582a0
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,
}
}