mirror of
https://github.com/servo/servo.git
synced 2025-08-04 13:10:20 +01:00
Rename font_face::FontFaceRule to FontFaceData.
This commit is contained in:
parent
e36b92507e
commit
2c0347ac5b
5 changed files with 19 additions and 17 deletions
|
@ -94,14 +94,13 @@ use std::time::{SystemTime, Instant};
|
|||
use style::attr::{AttrIdentifier, AttrValue, LengthOrPercentageOrAuto};
|
||||
use style::context::QuirksMode;
|
||||
use style::element_state::*;
|
||||
use style::font_face::FontFaceRule;
|
||||
use style::keyframes::Keyframe;
|
||||
use style::media_queries::MediaList;
|
||||
use style::properties::PropertyDeclarationBlock;
|
||||
use style::selector_parser::{PseudoElement, Snapshot};
|
||||
use style::shared_lock::{SharedRwLock as StyleSharedRwLock, Locked as StyleLocked};
|
||||
use style::stylesheets::{CssRules, KeyframesRule, MediaRule, NamespaceRule, StyleRule, ImportRule};
|
||||
use style::stylesheets::SupportsRule;
|
||||
use style::stylesheets::{CssRules, FontFaceRule, KeyframesRule, MediaRule};
|
||||
use style::stylesheets::{NamespaceRule, StyleRule, ImportRule, SupportsRule};
|
||||
use style::values::specified::Length;
|
||||
use style::viewport::ViewportRule;
|
||||
use time::Duration;
|
||||
|
|
|
@ -11,8 +11,8 @@ use dom::cssstylesheet::CSSStyleSheet;
|
|||
use dom::window::Window;
|
||||
use dom_struct::dom_struct;
|
||||
use std::sync::Arc;
|
||||
use style::font_face::FontFaceRule;
|
||||
use style::shared_lock::{Locked, ToCssWithGuard};
|
||||
use style::stylesheets::FontFaceRule;
|
||||
|
||||
#[dom_struct]
|
||||
pub struct CSSFontFaceRule {
|
||||
|
|
|
@ -75,8 +75,8 @@ impl ToCss for UrlSource {
|
|||
///
|
||||
/// Note that the prelude parsing code lives in the `stylesheets` module.
|
||||
pub fn parse_font_face_block(context: &ParserContext, input: &mut Parser)
|
||||
-> Result<FontFaceRule, ()> {
|
||||
let mut rule = FontFaceRule::initial();
|
||||
-> Result<FontFaceData, ()> {
|
||||
let mut rule = FontFaceData::initial();
|
||||
{
|
||||
let parser = FontFaceRuleParser {
|
||||
context: context,
|
||||
|
@ -104,7 +104,7 @@ pub fn parse_font_face_block(context: &ParserContext, input: &mut Parser)
|
|||
#[cfg_attr(feature = "servo", derive(Deserialize, Serialize))]
|
||||
pub struct EffectiveSources(Vec<Source>);
|
||||
|
||||
impl FontFaceRule {
|
||||
impl FontFaceData {
|
||||
/// Returns the list of effective sources for that font-face, that is the
|
||||
/// sources which don't list any format hint, or the ones which list at
|
||||
/// least "truetype" or "opentype".
|
||||
|
@ -134,7 +134,7 @@ impl iter::Iterator for EffectiveSources {
|
|||
|
||||
struct FontFaceRuleParser<'a, 'b: 'a> {
|
||||
context: &'a ParserContext<'b>,
|
||||
rule: &'a mut FontFaceRule,
|
||||
rule: &'a mut FontFaceData,
|
||||
missing: MissingDescriptors,
|
||||
}
|
||||
|
||||
|
@ -181,11 +181,11 @@ macro_rules! font_face_descriptors {
|
|||
$( #[$o_doc: meta] $o_name: tt $o_ident: ident: $o_ty: ty = $o_initial: expr, )*
|
||||
]
|
||||
) => {
|
||||
/// A `@font-face` rule.
|
||||
/// Data inside a `@font-face` rule.
|
||||
///
|
||||
/// https://drafts.csswg.org/css-fonts/#font-face-rule
|
||||
#[derive(Debug, PartialEq, Eq)]
|
||||
pub struct FontFaceRule {
|
||||
pub struct FontFaceData {
|
||||
$(
|
||||
#[$m_doc]
|
||||
pub $m_ident: $m_ty,
|
||||
|
@ -218,9 +218,9 @@ macro_rules! font_face_descriptors {
|
|||
}
|
||||
}
|
||||
|
||||
impl FontFaceRule {
|
||||
impl FontFaceData {
|
||||
fn initial() -> Self {
|
||||
FontFaceRule {
|
||||
FontFaceData {
|
||||
$(
|
||||
$m_ident: $m_initial,
|
||||
)*
|
||||
|
@ -231,7 +231,7 @@ macro_rules! font_face_descriptors {
|
|||
}
|
||||
}
|
||||
|
||||
impl ToCssWithGuard for FontFaceRule {
|
||||
impl ToCssWithGuard for FontFaceData {
|
||||
// Serialization of FontFaceRule is not specced.
|
||||
fn to_css<W>(&self, _guard: &SharedRwLockReadGuard, dest: &mut W) -> fmt::Result
|
||||
where W: fmt::Write {
|
||||
|
|
|
@ -11,7 +11,7 @@ use cssparser::{AtRuleParser, Parser, QualifiedRuleParser};
|
|||
use cssparser::{AtRuleType, RuleListParser, SourcePosition, Token, parse_one_rule};
|
||||
use cssparser::ToCss as ParserToCss;
|
||||
use error_reporting::ParseErrorReporter;
|
||||
use font_face::{FontFaceRule, parse_font_face_block};
|
||||
use font_face::{FontFaceData, parse_font_face_block};
|
||||
use keyframes::{Keyframe, parse_keyframe_list};
|
||||
use media_queries::{Device, MediaList, parse_media_query_list};
|
||||
use parking_lot::RwLock;
|
||||
|
@ -551,6 +551,9 @@ impl ToCssWithGuard for StyleRule {
|
|||
}
|
||||
}
|
||||
|
||||
/// A @font-face rule
|
||||
pub type FontFaceRule = FontFaceData;
|
||||
|
||||
impl Stylesheet {
|
||||
/// Updates an empty stylesheet from a given string of text.
|
||||
pub fn update_from_str(existing: &Stylesheet,
|
||||
|
@ -1004,7 +1007,7 @@ impl<'a, 'b> AtRuleParser for NestedRuleParser<'a, 'b> {
|
|||
match prelude {
|
||||
AtRulePrelude::FontFace => {
|
||||
Ok(CssRule::FontFace(Arc::new(self.shared_lock.wrap(
|
||||
try!(parse_font_face_block(self.context, input))))))
|
||||
parse_font_face_block(self.context, input)?.into()))))
|
||||
}
|
||||
AtRulePrelude::Media(media_queries) => {
|
||||
Ok(CssRule::Media(Arc::new(self.shared_lock.wrap(MediaRule {
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
use gfx::font_cache_thread::FontCacheThread;
|
||||
use ipc_channel::ipc;
|
||||
use style::computed_values::font_family::FamilyName;
|
||||
use style::font_face::{FontFaceRule, Source};
|
||||
use style::font_face::{FontFaceData, Source};
|
||||
|
||||
#[test]
|
||||
fn test_local_web_font() {
|
||||
|
@ -14,7 +14,7 @@ fn test_local_web_font() {
|
|||
let font_cache_thread = FontCacheThread::new(inp_chan, None);
|
||||
let family_name = FamilyName(From::from("test family"));
|
||||
let variant_name = FamilyName(From::from("test font face"));
|
||||
let font_face_rule = FontFaceRule {
|
||||
let font_face_rule = FontFaceData {
|
||||
family: family_name.clone(),
|
||||
sources: vec![Source::Local(variant_name)],
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue