mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
style: Add the size-adjust descriptor to the style system
Differential Revision: https://phabricator.services.mozilla.com/D110022
This commit is contained in:
parent
3024516019
commit
4b973885a3
2 changed files with 15 additions and 1 deletions
|
@ -23,7 +23,7 @@ use crate::values::specified::font::{AbsoluteFontWeight, FontStretch};
|
|||
#[cfg(feature = "gecko")]
|
||||
use crate::values::specified::font::MetricsOverride;
|
||||
use crate::values::specified::url::SpecifiedUrl;
|
||||
use crate::values::specified::Angle;
|
||||
use crate::values::specified::{Angle, NonNegativePercentage};
|
||||
#[cfg(feature = "gecko")]
|
||||
use cssparser::UnicodeRange;
|
||||
use cssparser::{AtRuleParser, DeclarationListParser, DeclarationParser, Parser};
|
||||
|
@ -429,6 +429,9 @@ macro_rules! is_descriptor_enabled {
|
|||
("line-gap-override") => {
|
||||
static_prefs::pref!("layout.css.font-metrics-overrides.enabled")
|
||||
};
|
||||
("size-adjust") => {
|
||||
static_prefs::pref!("layout.css.size-adjust.enabled")
|
||||
};
|
||||
($name:tt) => {
|
||||
true
|
||||
};
|
||||
|
@ -596,6 +599,9 @@ font_face_descriptors! {
|
|||
|
||||
/// The line-gap override for this font face.
|
||||
"line-gap-override" line_gap_override / mLineGapOverride: MetricsOverride,
|
||||
|
||||
/// The size adjustment for this font face.
|
||||
"size-adjust" size_adjust / mSizeAdjust: NonNegativePercentage,
|
||||
]
|
||||
}
|
||||
|
||||
|
|
|
@ -186,3 +186,11 @@ impl Parse for NonNegativePercentage {
|
|||
Ok(NonNegative(Percentage::parse_non_negative(context, input)?))
|
||||
}
|
||||
}
|
||||
|
||||
impl NonNegativePercentage {
|
||||
/// Convert to ComputedPercentage, for FontFaceRule size-adjust getter.
|
||||
#[inline]
|
||||
pub fn compute(&self) -> ComputedPercentage {
|
||||
ComputedPercentage(self.0.get())
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue