aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbors-servo <lbergstrom+bors@mozilla.com>2017-05-25 02:07:08 -0500
committerGitHub <noreply@github.com>2017-05-25 02:07:08 -0500
commit334d9088b8c843829c47f649a0fe3e5e1a229d2b (patch)
tree5d74d092bb51a5f4a549afce69759eab2da5eddc
parent9e7f02ba77f09b1ca6bb090dfb7beebe15c5dc62 (diff)
parent8125cf89b46d0ca4d38348d9d15ee177258e0fec (diff)
downloadservo-334d9088b8c843829c47f649a0fe3e5e1a229d2b.tar.gz
servo-334d9088b8c843829c47f649a0fe3e5e1a229d2b.zip
Auto merge of #17026 - bzbarsky:mathvariant, r=Manishearth
mathvariant attributes should affect computed font style and weight in stylo <!-- Please describe your changes on the following line: --> --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [X] These changes fix https://bugzilla.mozilla.org/show_bug.cgi?id=1367301 <!-- Either: --> - [ ] There are tests for these changes OR - [X] These changes do not require tests because this is stylo-only and Gecko tests it. <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- 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/17026) <!-- Reviewable:end -->
-rw-r--r--components/style/properties/longhand/font.mako.rs3
-rw-r--r--components/style/style_adjuster.rs17
2 files changed, 19 insertions, 1 deletions
diff --git a/components/style/properties/longhand/font.mako.rs b/components/style/properties/longhand/font.mako.rs
index d9990d9dfdc..bbeb892d1a9 100644
--- a/components/style/properties/longhand/font.mako.rs
+++ b/components/style/properties/longhand/font.mako.rs
@@ -2192,7 +2192,7 @@ ${helpers.single_keyword("-moz-math-display",
need_clone="True")}
${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
bold-sans-serif sans-serif-italic sans-serif-bold-italic
monospace initial tailed looped stretched""",
@@ -2201,6 +2201,7 @@ ${helpers.single_keyword("-moz-math-variant",
products="gecko",
spec="Internal (not web-exposed)",
animation_value_type="none",
+ need_clone="True",
needs_conversion=True)}
<%helpers:longhand name="-moz-script-min-size" products="gecko" animation_value_type="none"
diff --git a/components/style/style_adjuster.rs b/components/style/style_adjuster.rs
index 78d44c8007e..8d148c5360c 100644
--- a/components/style/style_adjuster.rs
+++ b/components/style/style_adjuster.rs
@@ -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 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_contain();
+ self.adjust_for_mathvariant();
}
#[cfg(feature = "servo")]
{