Auto merge of #19499 - canaltinova:subgrid-pref, r=upsuper

stylo: Hide accidentally exposed subgrid behind prefs

Reviewed by xidorn on Bugzilla.

---
<!-- 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 1421645](https://bugzilla.mozilla.org/show_bug.cgi?id=1421645)

<!-- 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/19499)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2017-12-05 15:16:37 -06:00 committed by GitHub
commit 1aadbd463a
2 changed files with 38 additions and 20 deletions

File diff suppressed because one or more lines are too long

View file

@ -326,6 +326,19 @@ impl ToComputedValue for TrackList<LengthOrPercentage, Integer> {
}
}
#[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<LengthOrPercentage, Integer> {
// FIXME: Derive Parse (probably with None_)
fn parse<'i, 't>(context: &ParserContext, input: &mut Parser<'i, 't>) -> Result<Self, ParseError<'i>> {
@ -343,10 +356,12 @@ impl GridTemplateComponent<LengthOrPercentage, Integer> {
context: &ParserContext,
input: &mut Parser<'i, 't>,
) -> Result<Self, ParseError<'i>> {
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)
}
}