Bug 1367635 - Part 4: Make structs uncacheable if ex/ch units are used. r=emilio draft
authorCameron McCormack <cam@mcc.id.au>
Wed, 13 Sep 2017 16:05:24 +0800
changeset 664567 c1fc4d0bf4671601b9f120fbcdadd6adbe95e4c9
parent 664566 3477fc2fabda85e946e6f639524b7df01bcca3c3
child 664568 aa91bad6b0a4b018cc625d518b21434e0cf36045
push id79725
push userbmo:cam@mcc.id.au
push dateThu, 14 Sep 2017 03:06:57 +0000
reviewersemilio
bugs1367635
milestone57.0a1
Bug 1367635 - Part 4: Make structs uncacheable if ex/ch units are used. r=emilio Computing them depends on font metrics. MozReview-Commit-ID: 5qTUGtiCKtY
servo/components/style/values/specified/length.rs
--- a/servo/components/style/values/specified/length.rs
+++ b/servo/components/style/values/specified/length.rs
@@ -135,16 +135,19 @@ impl FontRelativeLength {
                     context.rule_cache_conditions.borrow_mut()
                         .set_font_size_dependency(
                             reference_font_size.into()
                         );
                 }
                 (reference_font_size, length)
             },
             FontRelativeLength::Ex(length) => {
+                if context.for_non_inherited_property.is_some() {
+                    context.rule_cache_conditions.borrow_mut().set_uncacheable();
+                }
                 let reference_size = match query_font_metrics(context, reference_font_size) {
                     FontMetricsQueryResult::Available(metrics) => {
                         metrics.x_height
                     },
                     // https://drafts.csswg.org/css-values/#ex
                     //
                     //     In the cases where it is impossible or impractical to
                     //     determine the x-height, a value of 0.5em must be
@@ -152,16 +155,19 @@ impl FontRelativeLength {
                     //
                     FontMetricsQueryResult::NotAvailable => {
                         reference_font_size.scale_by(0.5)
                     },
                 };
                 (reference_size, length)
             },
             FontRelativeLength::Ch(length) => {
+                if context.for_non_inherited_property.is_some() {
+                    context.rule_cache_conditions.borrow_mut().set_uncacheable();
+                }
                 let reference_size = match query_font_metrics(context, reference_font_size) {
                     FontMetricsQueryResult::Available(metrics) => {
                         metrics.zero_advance_measure
                     },
                     // https://drafts.csswg.org/css-values/#ch
                     //
                     //     In the cases where it is impossible or impractical to
                     //     determine the measure of the “0” glyph, it must be