diff --git a/components/style/values/computed/image.rs b/components/style/values/computed/image.rs index 007cbdad9df3..5ddb28e1fc8f 100644 --- a/components/style/values/computed/image.rs +++ b/components/style/values/computed/image.rs @@ -470,7 +470,7 @@ impl ToComputedValue for specified::AngleOrCorner { fn to_computed_value(&self, _: &Context) -> AngleOrCorner { match *self { specified::AngleOrCorner::None => { - AngleOrCorner::Angle(Angle(0.0)) + AngleOrCorner::Angle(Angle(PI)) }, specified::AngleOrCorner::Angle(angle) => { AngleOrCorner::Angle(angle) diff --git a/tests/unit/style/parsing/image.rs b/tests/unit/style/parsing/image.rs index 16eb63b6725d..96069dd83cc3 100644 --- a/tests/unit/style/parsing/image.rs +++ b/tests/unit/style/parsing/image.rs @@ -2,10 +2,16 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +use app_units::Au; use cssparser::Parser; +use euclid::size::Size2D; use media_queries::CSSErrorReporterTest; +use std::f32::consts::PI; use style::parser::ParserContext; use style::stylesheets::Origin; +use style::values::computed; +use style::values::computed::{Angle, Context, ToComputedValue}; +use style::values::specified; use style::values::specified::image::*; use style_traits::ToCss; @@ -32,6 +38,14 @@ fn test_linear_gradient() { // Parsing without and assert_roundtrip_with_context!(Image::parse, "linear-gradient(red, green)"); + + // AngleOrCorner::None should become AngleOrCorner::Angle(Angle(PI)) when parsed + // Note that Angle(PI) is correct for top-to-bottom rendering, whereas Angle(0) would render bottom-to-top. + // ref: https://developer.mozilla.org/en-US/docs/Web/CSS/angle + let container = Size2D::new(Au::default(), Au::default()); + let specified_context = Context::initial(container, true); + assert_eq!(specified::AngleOrCorner::None.to_computed_value(&specified_context), + computed::AngleOrCorner::Angle(Angle(PI))); } #[test] diff --git a/tests/wpt/mozilla/tests/css/linear_gradients_parsing_a.html b/tests/wpt/mozilla/tests/css/linear_gradients_parsing_a.html index 8bd5f0995122..c2e18fb98ed4 100644 --- a/tests/wpt/mozilla/tests/css/linear_gradients_parsing_a.html +++ b/tests/wpt/mozilla/tests/css/linear_gradients_parsing_a.html @@ -19,11 +19,15 @@ #c { background: linear-gradient(90deg, violet, violet 1em, violet 2ex, violet 50%, blue 50%, blue, blue); } +#d { + background: linear-gradient(red, green); +}
+
diff --git a/tests/wpt/mozilla/tests/css/linear_gradients_parsing_ref.html b/tests/wpt/mozilla/tests/css/linear_gradients_parsing_ref.html index 0ce8521cf44f..b4d21f1c85bf 100644 --- a/tests/wpt/mozilla/tests/css/linear_gradients_parsing_ref.html +++ b/tests/wpt/mozilla/tests/css/linear_gradients_parsing_ref.html @@ -30,6 +30,9 @@ background: blue; right: 0; } +#d { + background: linear-gradient(to bottom, red, green); +} @@ -39,5 +42,6 @@ +