mirror of
https://github.com/servo/servo.git
synced 2025-08-06 22:15:33 +01:00
Auto merge of #19101 - CYBAI:moz-script-level-out-of-mako, r=emilio
style: Move font -moz-script-level outside of mako This is a sub-PR of #19015 r? emilio --- - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [x] These changes fix #19068 (github issue number if applicable). - [x] These changes do not require tests because _____ <!-- 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/19101) <!-- Reviewable:end -->
This commit is contained in:
commit
107ead64d0
6 changed files with 84 additions and 78 deletions
|
@ -192,3 +192,38 @@ impl ToComputedValue for specified::MozScriptMinSize {
|
|||
specified::MozScriptMinSize(ToComputedValue::from_computed_value(other))
|
||||
}
|
||||
}
|
||||
|
||||
/// The computed value of the -moz-script-level property.
|
||||
pub type MozScriptLevel = i8;
|
||||
|
||||
#[cfg(feature = "gecko")]
|
||||
impl ToComputedValue for specified::MozScriptLevel {
|
||||
type ComputedValue = MozScriptLevel;
|
||||
|
||||
fn to_computed_value(&self, cx: &Context) -> i8 {
|
||||
use properties::longhands::_moz_math_display::SpecifiedValue as DisplayValue;
|
||||
use std::{cmp, i8};
|
||||
|
||||
let int = match *self {
|
||||
specified::MozScriptLevel::Auto => {
|
||||
let parent = cx.builder.get_parent_font().clone__moz_script_level() as i32;
|
||||
let display = cx.builder.get_parent_font().clone__moz_math_display();
|
||||
if display == DisplayValue::inline {
|
||||
parent + 1
|
||||
} else {
|
||||
parent
|
||||
}
|
||||
}
|
||||
specified::MozScriptLevel::Relative(rel) => {
|
||||
let parent = cx.builder.get_parent_font().clone__moz_script_level();
|
||||
parent as i32 + rel
|
||||
}
|
||||
specified::MozScriptLevel::Absolute(abs) => abs,
|
||||
};
|
||||
cmp::min(int, i8::MAX as i32) as i8
|
||||
}
|
||||
|
||||
fn from_computed_value(other: &i8) -> Self {
|
||||
specified::MozScriptLevel::Absolute(*other as i32)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -36,7 +36,7 @@ pub use self::angle::Angle;
|
|||
pub use self::background::{BackgroundSize, BackgroundRepeat};
|
||||
pub use self::border::{BorderImageSlice, BorderImageWidth, BorderImageSideWidth};
|
||||
pub use self::border::{BorderRadius, BorderCornerRadius, BorderSpacing};
|
||||
pub use self::font::{FontWeight, MozScriptMinSize, XTextZoom};
|
||||
pub use self::font::{FontWeight, MozScriptLevel, MozScriptMinSize, XTextZoom};
|
||||
pub use self::box_::{AnimationIterationCount, AnimationName, ScrollSnapType, VerticalAlign};
|
||||
pub use self::color::{Color, ColorPropertyValue, RGBAColor};
|
||||
pub use self::effects::{BoxShadow, Filter, SimpleShadow};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue