lewp_css/domain/at_rules/font_face/font_display.rs
1// This file is part of css. It is subject to the license terms in the COPYRIGHT file found in the top-level directory of this distribution and at https://raw.githubusercontent.com/lemonrock/css/master/COPYRIGHT. No part of predicator, including this file, may be copied, modified, propagated, or distributed except according to the terms contained in the COPYRIGHT file.
2// Copyright © 2017 The developers of css. See the COPYRIGHT file in the top-level directory of this distribution and at https://raw.githubusercontent.com/lemonrock/css/master/COPYRIGHT.
3
4use {
5 crate::{
6 define_css_keyword_enum,
7 parsers::{Parse, ParserContext},
8 CustomParseError,
9 },
10 cssparser::{ParseError, Parser},
11};
12
13// A font-display value for a @font-face rule.
14// The font-display descriptor determines how a font face is displayed based on whether and when it is downloaded and ready to use.
15define_css_keyword_enum!
16(
17 FontDisplay:
18 "auto" => auto,
19 "block" => block,
20 "swap" => swap,
21 "fallback" => fallback,
22 "optional" => optional
23);
24
25impl Parse for FontDisplay {
26 #[inline]
27 fn parse<'i, 't>(
28 _context: &ParserContext,
29 input: &mut Parser<'i, 't>,
30 ) -> Result<Self, ParseError<'i, CustomParseError<'i>>> {
31 FontDisplay::parse(input)
32 }
33}