|
8 | 8 |
|
9 | 9 | use crate::error_reporting::ContextualParseError;
|
10 | 10 | use crate::parser::{Parse, ParserContext};
|
11 |
| -#[cfg(feature = "gecko")] |
12 | 11 | use crate::properties::longhands::font_language_override;
|
13 | 12 | use crate::shared_lock::{SharedRwLockReadGuard, ToCssWithGuard};
|
14 | 13 | use crate::str::CssStringWriter;
|
15 | 14 | use crate::values::computed::font::{FamilyName, FontStretch};
|
16 | 15 | use crate::values::generics::font::FontStyle as GenericFontStyle;
|
17 |
| -#[cfg(feature = "gecko")] |
18 | 16 | use crate::values::specified::font::MetricsOverride;
|
19 | 17 | use crate::values::specified::font::SpecifiedFontStyle;
|
20 | 18 | use crate::values::specified::font::{AbsoluteFontWeight, FontStretch as SpecifiedFontStretch};
|
21 |
| -#[cfg(feature = "gecko")] |
22 | 19 | use crate::values::specified::font::{FontFeatureSettings, FontVariationSettings};
|
23 | 20 | use crate::values::specified::url::SpecifiedUrl;
|
24 | 21 | use crate::values::specified::Angle;
|
25 |
| -#[cfg(feature = "gecko")] |
26 | 22 | use crate::values::specified::NonNegativePercentage;
|
27 |
| -#[cfg(feature = "gecko")] |
28 | 23 | use cssparser::UnicodeRange;
|
29 | 24 | use cssparser::{
|
30 | 25 | AtRuleParser, CowRcStr, DeclarationParser, Parser, QualifiedRuleParser, RuleBodyItemParser,
|
@@ -491,64 +486,6 @@ pub fn parse_font_face_block(
|
491 | 486 | #[cfg(feature = "servo")]
|
492 | 487 | pub struct FontFace<'a>(&'a FontFaceRuleData);
|
493 | 488 |
|
494 |
| -/// A list of effective sources that we send over through IPC to the font cache. |
495 |
| -#[cfg(feature = "servo")] |
496 |
| -#[derive(Clone, Debug)] |
497 |
| -#[cfg_attr(feature = "servo", derive(Deserialize, Serialize))] |
498 |
| -pub struct EffectiveSources(Vec<Source>); |
499 |
| - |
500 |
| -#[cfg(feature = "servo")] |
501 |
| -impl<'a> FontFace<'a> { |
502 |
| - /// Returns the list of effective sources for that font-face, that is the |
503 |
| - /// sources which don't list any format hint, or the ones which list at |
504 |
| - /// least "truetype" or "opentype". |
505 |
| - pub fn effective_sources(&self) -> EffectiveSources { |
506 |
| - EffectiveSources( |
507 |
| - self.sources() |
508 |
| - .0 |
509 |
| - .iter() |
510 |
| - .rev() |
511 |
| - .filter(|source| { |
512 |
| - if let Source::Url(ref url_source) = **source { |
513 |
| - // We support only opentype fonts and truetype is an alias for |
514 |
| - // that format. Sources without format hints need to be |
515 |
| - // downloaded in case we support them. |
516 |
| - url_source |
517 |
| - .format_hint |
518 |
| - .as_ref() |
519 |
| - .map_or(true, |hint| match hint { |
520 |
| - FontFaceSourceFormat::Keyword( |
521 |
| - FontFaceSourceFormatKeyword::Truetype |
522 |
| - | FontFaceSourceFormatKeyword::Opentype |
523 |
| - | FontFaceSourceFormatKeyword::Woff, |
524 |
| - ) => true, |
525 |
| - FontFaceSourceFormat::String(s) => { |
526 |
| - s == "truetype" || s == "opentype" || s == "woff" |
527 |
| - } |
528 |
| - _ => false, |
529 |
| - }) |
530 |
| - } else { |
531 |
| - true |
532 |
| - } |
533 |
| - }) |
534 |
| - .cloned() |
535 |
| - .collect(), |
536 |
| - ) |
537 |
| - } |
538 |
| -} |
539 |
| - |
540 |
| -#[cfg(feature = "servo")] |
541 |
| -impl Iterator for EffectiveSources { |
542 |
| - type Item = Source; |
543 |
| - fn next(&mut self) -> Option<Source> { |
544 |
| - self.0.pop() |
545 |
| - } |
546 |
| - |
547 |
| - fn size_hint(&self) -> (usize, Option<usize>) { |
548 |
| - (self.0.len(), Some(self.0.len())) |
549 |
| - } |
550 |
| -} |
551 |
| - |
552 | 489 | struct FontFaceRuleParser<'a, 'b: 'a> {
|
553 | 490 | context: &'a ParserContext<'b>,
|
554 | 491 | rule: &'a mut FontFaceRuleData,
|
@@ -762,7 +699,6 @@ macro_rules! font_face_descriptors {
|
762 | 699 | }
|
763 | 700 | }
|
764 | 701 |
|
765 |
| -#[cfg(feature = "gecko")] |
766 | 702 | font_face_descriptors! {
|
767 | 703 | mandatory descriptors = [
|
768 | 704 | /// The name of this font face
|
@@ -809,16 +745,3 @@ font_face_descriptors! {
|
809 | 745 | "size-adjust" size_adjust / mSizeAdjust: NonNegativePercentage,
|
810 | 746 | ]
|
811 | 747 | }
|
812 |
| - |
813 |
| -#[cfg(feature = "servo")] |
814 |
| -font_face_descriptors! { |
815 |
| - mandatory descriptors = [ |
816 |
| - /// The name of this font face |
817 |
| - "font-family" family / mFamily: FamilyName, |
818 |
| - |
819 |
| - /// The alternative sources for this font face. |
820 |
| - "src" sources / mSrc: SourceList, |
821 |
| - ] |
822 |
| - optional descriptors = [ |
823 |
| - ] |
824 |
| -} |
0 commit comments