From 1c48a3bedb8b08b264279965b7c408cb24ab183d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Naz=C4=B1m=20Can=20Alt=C4=B1nova?= Date: Tue, 5 Dec 2017 22:58:48 +0300 Subject: [PATCH] stylo: Hide accidentally exposed subgrid behind prefs --- components/style/values/specified/grid.rs | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/components/style/values/specified/grid.rs b/components/style/values/specified/grid.rs index f2b8453c46c..8c4d7d225d8 100644 --- a/components/style/values/specified/grid.rs +++ b/components/style/values/specified/grid.rs @@ -326,6 +326,19 @@ impl ToComputedValue for TrackList { } } +#[cfg(feature = "gecko")] +#[inline] +fn allow_grid_template_subgrids() -> bool { + use gecko_bindings::structs::mozilla; + unsafe { mozilla::StylePrefs_sGridTemplateSubgridValueEnabled } +} + +#[cfg(feature = "servo")] +#[inline] +fn allow_grid_template_subgrids() -> bool { + false +} + impl Parse for GridTemplateComponent { // FIXME: Derive Parse (probably with None_) fn parse<'i, 't>(context: &ParserContext, input: &mut Parser<'i, 't>) -> Result> { @@ -343,10 +356,12 @@ impl GridTemplateComponent { context: &ParserContext, input: &mut Parser<'i, 't>, ) -> Result> { - if let Ok(t) = input.try(|i| TrackList::parse(context, i)) { - return Ok(GridTemplateComponent::TrackList(t)) + if allow_grid_template_subgrids() { + if let Ok(t) = input.try(|i| LineNameList::parse(context, i)) { + return Ok(GridTemplateComponent::Subgrid(t)) + } } - LineNameList::parse(context, input).map(GridTemplateComponent::Subgrid) + TrackList::parse(context, input).map(GridTemplateComponent::TrackList) } }