mirror of
https://github.com/servo/servo.git
synced 2025-08-10 16:05:43 +01:00
Factor out a UrlOrNone value type and make -moz-binding use it.
MozReview-Commit-ID: L57QEf40e2m
This commit is contained in:
parent
333afb61f6
commit
75e97c02dc
5 changed files with 62 additions and 66 deletions
|
@ -16,19 +16,24 @@
|
|||
</%call>
|
||||
</%def>
|
||||
|
||||
<%def name="predefined_type(name, type, initial_value, parse_method='parse', **kwargs)">
|
||||
<%def name="predefined_type(name, type, initial_value, parse_method='parse', needs_context=False, **kwargs)">
|
||||
<%call expr="longhand(name, predefined_type=type, **kwargs)">
|
||||
#[allow(unused_imports)]
|
||||
use app_units::Au;
|
||||
use cssparser::{Color as CSSParserColor, RGBA};
|
||||
pub type SpecifiedValue = specified::${type};
|
||||
pub use values::specified::${type} as SpecifiedValue;
|
||||
pub mod computed_value {
|
||||
pub use values::computed::${type} as T;
|
||||
}
|
||||
#[inline] pub fn get_initial_value() -> computed_value::T { ${initial_value} }
|
||||
#[inline] pub fn parse(_context: &ParserContext, input: &mut Parser)
|
||||
#[allow(unused_variables)]
|
||||
#[inline] pub fn parse(context: &ParserContext, input: &mut Parser)
|
||||
-> Result<SpecifiedValue, ()> {
|
||||
% if needs_context:
|
||||
specified::${type}::${parse_method}(context, input)
|
||||
% else:
|
||||
specified::${type}::${parse_method}(input)
|
||||
% endif
|
||||
}
|
||||
</%call>
|
||||
</%def>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue