mirror of
https://github.com/servo/servo.git
synced 2025-08-04 21:20:23 +01:00
mathvariant attributes should affect computed font style and weight in stylo.
This commit is contained in:
parent
98edf5d54d
commit
8125cf89b4
2 changed files with 19 additions and 1 deletions
|
@ -2191,7 +2191,7 @@ ${helpers.single_keyword("-moz-math-display",
|
||||||
need_clone="True")}
|
need_clone="True")}
|
||||||
|
|
||||||
${helpers.single_keyword("-moz-math-variant",
|
${helpers.single_keyword("-moz-math-variant",
|
||||||
"""normal bold italic bold-italic script bold-script
|
"""none normal bold italic bold-italic script bold-script
|
||||||
fraktur double-struck bold-fraktur sans-serif
|
fraktur double-struck bold-fraktur sans-serif
|
||||||
bold-sans-serif sans-serif-italic sans-serif-bold-italic
|
bold-sans-serif sans-serif-italic sans-serif-bold-italic
|
||||||
monospace initial tailed looped stretched""",
|
monospace initial tailed looped stretched""",
|
||||||
|
@ -2200,6 +2200,7 @@ ${helpers.single_keyword("-moz-math-variant",
|
||||||
products="gecko",
|
products="gecko",
|
||||||
spec="Internal (not web-exposed)",
|
spec="Internal (not web-exposed)",
|
||||||
animation_value_type="none",
|
animation_value_type="none",
|
||||||
|
need_clone="True",
|
||||||
needs_conversion=True)}
|
needs_conversion=True)}
|
||||||
|
|
||||||
<%helpers:longhand name="-moz-script-min-size" products="gecko" animation_value_type="none"
|
<%helpers:longhand name="-moz-script-min-size" products="gecko" animation_value_type="none"
|
||||||
|
|
|
@ -174,6 +174,22 @@ impl<'a, 'b: 'a> StyleAdjuster<'a, 'b> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// When mathvariant is not "none", font-weight and font-style are
|
||||||
|
/// both forced to "normal".
|
||||||
|
#[cfg(feature = "gecko")]
|
||||||
|
fn adjust_for_mathvariant(&mut self) {
|
||||||
|
use properties::longhands::_moz_math_variant::computed_value::T as moz_math_variant;
|
||||||
|
use properties::longhands::font_style::computed_value::T as font_style;
|
||||||
|
use properties::longhands::font_weight::computed_value::T as font_weight;
|
||||||
|
if self.style.get_font().clone__moz_math_variant() != moz_math_variant::none {
|
||||||
|
let mut font_style = self.style.mutate_font();
|
||||||
|
// Sadly we don't have a nice name for the computed value
|
||||||
|
// of "font-weight: normal".
|
||||||
|
font_style.set_font_weight(font_weight::Weight400);
|
||||||
|
font_style.set_font_style(font_style::normal);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// This implements an out-of-date spec. The new spec moves the handling of
|
/// This implements an out-of-date spec. The new spec moves the handling of
|
||||||
/// this to layout, which Gecko implements but Servo doesn't.
|
/// this to layout, which Gecko implements but Servo doesn't.
|
||||||
///
|
///
|
||||||
|
@ -299,6 +315,7 @@ impl<'a, 'b: 'a> StyleAdjuster<'a, 'b> {
|
||||||
{
|
{
|
||||||
self.adjust_for_table_text_align();
|
self.adjust_for_table_text_align();
|
||||||
self.adjust_for_contain();
|
self.adjust_for_contain();
|
||||||
|
self.adjust_for_mathvariant();
|
||||||
}
|
}
|
||||||
#[cfg(feature = "servo")]
|
#[cfg(feature = "servo")]
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue