Bug 1451874: Respect the -moz- gradient pref again. r?xidorn
MozReview-Commit-ID: 2MDRZLmLMM0
new file mode 100644
--- /dev/null
+++ b/layout/reftests/bugs/1451874-ref.html
@@ -0,0 +1,10 @@
+<!doctype html>
+<style>
+ div {
+ width: 100px;
+ height: 100px;
+ background: green;
+ }
+</style>
+<p>Should see a green box below</p>
+<div></div>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/bugs/1451874.html
@@ -0,0 +1,11 @@
+<!doctype html>
+<style>
+ div {
+ width: 100px;
+ height: 100px;
+ background: green;
+ background-image: -moz-linear-gradient(top,red,pink);
+ }
+</style>
+<p>Should see a green box below</p>
+<div></div>
--- a/layout/reftests/bugs/reftest.list
+++ b/layout/reftests/bugs/reftest.list
@@ -2060,8 +2060,9 @@ test-pref(font.size.systemFontScale,200)
== 1424177.html 1424177-ref.html
== 1424680.html 1424680-ref.html
== 1424798-1.html 1424798-ref.html
fuzzy(74,2234) random-if(webrender) == 1425243-1.html 1425243-1-ref.html
fuzzy-if(Android,66,574) fuzzy-if(d2d,89,777) fuzzy-if(!Android&&!d2d,1,31219) == 1425243-2.html 1425243-2-ref.html
== 1432541.html 1432541-ref.html
pref(layout.css.moz-document.url-prefix-hack.enabled,true) == 1446470.html 1035091-ref.html
pref(layout.css.moz-document.url-prefix-hack.enabled,false) == 1446470-2.html 1035091-ref.html
+test-pref(layout.css.prefixes.gradients,false) == 1451874.html 1451874-ref.html
--- a/servo/components/style/values/specified/image.rs
+++ b/servo/components/style/values/specified/image.rs
@@ -222,19 +222,31 @@ impl Parse for Gradient {
"-webkit-gradient" => {
return input.parse_nested_block(|i| Self::parse_webkit_gradient_argument(context, i));
},
_ => None,
};
let (shape, repeating, mut compat_mode) = match result {
Some(result) => result,
- None => return Err(input.new_custom_error(StyleParseErrorKind::UnexpectedFunction(func.clone()))),
+ None => return Err(input.new_custom_error(StyleParseErrorKind::UnexpectedFunction(func))),
};
+ #[cfg(feature = "gecko")]
+ {
+ use gecko_bindings::structs;
+ if compat_mode == CompatMode::Moz &&
+ !unsafe { structs::StaticPrefs_sVarCache_layout_css_prefixes_gradients }
+ {
+ return Err(input.new_custom_error(
+ StyleParseErrorKind::UnexpectedFunction(func)
+ ));
+ }
+ }
+
let (kind, items) = input.parse_nested_block(|i| {
let shape = match shape {
Shape::Linear => GradientKind::parse_linear(context, i, &mut compat_mode)?,
Shape::Radial => GradientKind::parse_radial(context, i, &mut compat_mode)?,
};
let items = GradientItem::parse_comma_separated(context, i)?;
Ok((shape, items))
})?;