Add font-style descriptor in @font-face

This commit is contained in:
Simon Sapin 2017-02-02 19:45:12 +01:00
parent 5405fb0d73
commit 8767b0d7cc
2 changed files with 24 additions and 0 deletions

View file

@ -9,6 +9,7 @@
#![deny(missing_docs)] #![deny(missing_docs)]
use computed_values::font_family::FamilyName; use computed_values::font_family::FamilyName;
#[cfg(feature = "gecko")] use computed_values::font_style;
use cssparser::{AtRuleParser, DeclarationListParser, DeclarationParser, Parser}; use cssparser::{AtRuleParser, DeclarationListParser, DeclarationParser, Parser};
use parser::{ParserContext, log_css_error, Parse}; use parser::{ParserContext, log_css_error, Parse};
use std::fmt; use std::fmt;
@ -282,6 +283,22 @@ macro_rules! font_face_descriptors {
} }
/// css-name rust_identifier: Type = initial_value, /// css-name rust_identifier: Type = initial_value,
#[cfg(feature = "gecko")]
font_face_descriptors! {
mandatory descriptors = [
/// The specified url.
"font-family" family: FamilyName = FamilyName(atom!("")),
/// The format hints specified with the `format()` function.
"src" sources: Vec<Source> = Vec::new(),
]
optional descriptors = [
/// The style of this font face
"font-style" style: font_style::T = font_style::T::normal,
]
}
#[cfg(feature = "servo")]
font_face_descriptors! { font_face_descriptors! {
mandatory descriptors = [ mandatory descriptors = [
/// The specified url. /// The specified url.

View file

@ -380,6 +380,13 @@
-> Result<SpecifiedValue, ()> { -> Result<SpecifiedValue, ()> {
SpecifiedValue::parse(input) SpecifiedValue::parse(input)
} }
impl Parse for SpecifiedValue {
#[inline]
fn parse(_context: &ParserContext, input: &mut Parser)
-> Result<SpecifiedValue, ()> {
SpecifiedValue::parse(input)
}
}
</%def> </%def>
% if vector: % if vector:
<%call expr="vector_longhand(name, keyword=Keyword(name, values, **keyword_kwargs), **kwargs)"> <%call expr="vector_longhand(name, keyword=Keyword(name, values, **keyword_kwargs), **kwargs)">