From cf6215c85f66390bbcddd05f80d37590a9920d3d Mon Sep 17 00:00:00 2001 From: Boris Chiou Date: Wed, 5 Sep 2018 04:50:33 +0000 Subject: [PATCH] style: Add a pref for |clip-path:path()|. Add a preference, layout.css.clip-path-path.enabled, for |clip-path:path()|. Differential Revision: https://phabricator.services.mozilla.com/D4965 --- .../style/values/specified/basic_shape.rs | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/components/style/values/specified/basic_shape.rs b/components/style/values/specified/basic_shape.rs index 824c13f1f01..18541b8dbce 100644 --- a/components/style/values/specified/basic_shape.rs +++ b/components/style/values/specified/basic_shape.rs @@ -49,17 +49,24 @@ pub type ShapeRadius = generic::ShapeRadius; /// The specified value of `Polygon` pub type Polygon = generic::Polygon; +#[cfg(feature = "gecko")] +fn is_clip_path_path_enabled(context: &ParserContext) -> bool { + use gecko_bindings::structs::mozilla; + context.chrome_rules_enabled() || + unsafe { mozilla::StaticPrefs_sVarCache_layout_css_clip_path_path_enabled } +} +#[cfg(feature = "servo")] +fn is_clip_path_path_enabled(_: &ParserContext) -> bool { + false +} + impl Parse for ClippingShape { #[inline] fn parse<'i, 't>( context: &ParserContext, input: &mut Parser<'i, 't>, ) -> Result> { - // |clip-path:path()| is a chrome-only property value support for now. `path()` is - // defined in css-shape-2, but the spec is not stable enough, and we haven't decided - // to make it public yet. However, it has some benefits for the front-end, so we - // implement it. - if context.chrome_rules_enabled() { + if is_clip_path_path_enabled(context) { if let Ok(p) = input.try(|i| Path::parse(context, i)) { return Ok(ShapeSource::Path(p)); }