mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Auto merge of #16931 - nox:font-feature-descriptor, r=emilio
Support font-feature-settings as a @font-face descriptor <!-- 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/16931) <!-- Reviewable:end -->
This commit is contained in:
commit
61d64daf4c
7 changed files with 191 additions and 124 deletions
|
@ -1803,14 +1803,14 @@ ${helpers.single_keyword_system("font-variant-position",
|
|||
use std::fmt;
|
||||
use style_traits::ToCss;
|
||||
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
#[derive(Clone, Debug, Eq, PartialEq)]
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
pub enum T {
|
||||
Normal,
|
||||
Tag(Vec<FeatureTagValue>)
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
#[derive(Clone, Debug, Eq, PartialEq)]
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
pub struct FeatureTagValue {
|
||||
pub tag: u32,
|
||||
|
@ -1836,6 +1836,16 @@ ${helpers.single_keyword_system("font-variant-position",
|
|||
}
|
||||
}
|
||||
|
||||
impl Parse for T {
|
||||
/// https://www.w3.org/TR/css-fonts-3/#propdef-font-feature-settings
|
||||
fn parse(context: &ParserContext, input: &mut Parser) -> Result<Self, ()> {
|
||||
if input.try(|i| i.expect_ident_matching("normal")).is_ok() {
|
||||
return Ok(T::Normal);
|
||||
}
|
||||
input.parse_comma_separated(|i| FeatureTagValue::parse(context, i)).map(T::Tag)
|
||||
}
|
||||
}
|
||||
|
||||
impl ToCss for FeatureTagValue {
|
||||
fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write {
|
||||
use std::str;
|
||||
|
@ -1908,12 +1918,7 @@ ${helpers.single_keyword_system("font-variant-position",
|
|||
|
||||
/// normal | <feature-tag-value>#
|
||||
pub fn parse(context: &ParserContext, input: &mut Parser) -> Result<SpecifiedValue, ()> {
|
||||
if input.try(|input| input.expect_ident_matching("normal")).is_ok() {
|
||||
Ok(SpecifiedValue::Value(computed_value::T::Normal))
|
||||
} else {
|
||||
input.parse_comma_separated(|i| computed_value::FeatureTagValue::parse(context, i))
|
||||
.map(computed_value::T::Tag).map(SpecifiedValue::Value)
|
||||
}
|
||||
computed_value::T::parse(context, input).map(SpecifiedValue::Value)
|
||||
}
|
||||
</%helpers:longhand>
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue