aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbors-servo <lbergstrom+bors@mozilla.com>2017-11-20 07:58:00 -0600
committerGitHub <noreply@github.com>2017-11-20 07:58:00 -0600
commitbea01960588d4130e5519f42817f2eccf372bba6 (patch)
treed22f3192683554863e108e43cfd308c688619f51
parente4cfff8364cebd0ae2236cc8c39ba93072b35148 (diff)
parentdcdc3841227d1738c7fd9a6cdeadffe6f49c9281 (diff)
downloadservo-bea01960588d4130e5519f42817f2eccf372bba6.tar.gz
servo-bea01960588d4130e5519f42817f2eccf372bba6.zip
Auto merge of #19298 - CYBAI:implement-normal-for-fontsettings, r=emilio
Implement normal for FontSettings As discussed with emilio in #19293 , this PR will move the `normal` function into `FontSettings` implementation. r? emilio --- - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [x] These changes will update the implementation of `normal` function of `FontSettings`. - [x] These changes do not require tests <!-- 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/19298) <!-- Reviewable:end -->
-rw-r--r--components/style/values/computed/font.rs8
-rw-r--r--components/style/values/generics/mod.rs8
-rw-r--r--components/style/values/specified/font.rs8
3 files changed, 8 insertions, 16 deletions
diff --git a/components/style/values/computed/font.rs b/components/style/values/computed/font.rs
index ed2b7c9f881..86f33856d6b 100644
--- a/components/style/values/computed/font.rs
+++ b/components/style/values/computed/font.rs
@@ -290,14 +290,6 @@ pub type FontVariantNumeric = specified::VariantNumeric;
/// Use FontSettings as computed type of FontFeatureSettings
pub type FontFeatureSettings = FontSettings<FontSettingTagInt>;
-impl FontFeatureSettings {
- #[inline]
- /// Default value of `font-feature-settings` as `normal`
- pub fn normal() -> FontFeatureSettings {
- FontSettings::Normal
- }
-}
-
/// font-language-override can only have a single three-letter
/// OpenType "language system" tag, so we should be able to compute
/// it and store it as a 32-bit integer
diff --git a/components/style/values/generics/mod.rs b/components/style/values/generics/mod.rs
index 5052b2395e1..c2a20081c98 100644
--- a/components/style/values/generics/mod.rs
+++ b/components/style/values/generics/mod.rs
@@ -196,6 +196,14 @@ pub enum FontSettings<T> {
Tag(Vec<FontSettingTag<T>>)
}
+impl <T> FontSettings<T> {
+ #[inline]
+ /// Default value of font settings as `normal`
+ pub fn normal() -> Self {
+ FontSettings::Normal
+ }
+}
+
impl<T: Parse> Parse for FontSettings<T> {
/// <https://www.w3.org/TR/css-fonts-3/#propdef-font-feature-settings>
fn parse<'i, 't>(context: &ParserContext, input: &mut Parser<'i, 't>) -> Result<Self, ParseError<'i>> {
diff --git a/components/style/values/specified/font.rs b/components/style/values/specified/font.rs
index e8560387012..9a78441ab0e 100644
--- a/components/style/values/specified/font.rs
+++ b/components/style/values/specified/font.rs
@@ -1804,14 +1804,6 @@ impl Parse for FontLanguageOverride {
/// This property provides low-level control over OpenType or TrueType font variations.
pub type FontVariantSettings = FontSettings<FontSettingTagFloat>;
-impl FontVariantSettings {
- #[inline]
- /// Default value of `font-variant-settings`
- pub fn normal() -> FontVariantSettings {
- FontSettings::Normal
- }
-}
-
#[derive(Clone, Debug, MallocSizeOf, PartialEq, ToComputedValue)]
/// text-zoom. Enable if true, disable if false
pub struct XTextZoom(pub bool);