diff options
author | Emilio Cobos Álvarez <emilio@crisal.io> | 2018-06-02 18:38:42 +0200 |
---|---|---|
committer | Emilio Cobos Álvarez <emilio@crisal.io> | 2018-06-12 12:15:06 -0700 |
commit | 1da798e65bb3451e056afdd2b584ac42e957a93f (patch) | |
tree | c425978dee97699985d92e38cf7c3bf5f9af0c14 /components/style/parser.rs | |
parent | ce5a85d6a19dbfc8be0fcfbacb241462019139ac (diff) | |
download | servo-1da798e65bb3451e056afdd2b584ac42e957a93f.tar.gz servo-1da798e65bb3451e056afdd2b584ac42e957a93f.zip |
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
Diffstat (limited to 'components/style/parser.rs')
-rw-r--r-- | components/style/parser.rs | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/components/style/parser.rs b/components/style/parser.rs index 26f4aeea071..1b7c65e2559 100644 --- a/components/style/parser.rs +++ b/components/style/parser.rs @@ -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. /// |