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
--- 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