style: Introduce css(parse_condition).

This will allow us to add a pref for this, and to parse it only on chrome easily.

Bug: 1288572
Reviewed-by: xidorn
MozReview-Commit-ID: L1rsyc2A2hu
This commit is contained in:
Emilio Cobos Álvarez 2018-06-02 18:38:42 +02:00
parent ce5a85d6a1
commit 1da798e65b
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C
3 changed files with 50 additions and 8 deletions

View file

@ -150,10 +150,19 @@ impl<'a> ParserContext<'a> {
}
}
// XXXManishearth Replace all specified value parse impls with impls of this
// trait. This will make it easy to write more generic values in the future.
/// A trait to abstract parsing of a specified value given a `ParserContext` and
/// CSS input.
///
/// This can be derived on keywords with `#[derive(Parse)]`.
///
/// The derive code understands the following attributes on each of the variants:
///
/// * `#[css(aliases = "foo,bar")]` can be used to alias a value with another
/// at parse-time.
///
/// * `#[css(parse_condition = "function")]` can be used to make the parsing of
/// the value conditional on `function`, which will be invoked with a
/// `&ParserContext` reference.
pub trait Parse: Sized {
/// Parse a value of this type.
///