mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
style: Make all font-metrics-affecting properties cascade early.
And make font-size computation work on the whole font of the parent, not just accounting for the parent's font-size. Differential Revision: https://phabricator.services.mozilla.com/D20656
This commit is contained in:
parent
aa5ea337da
commit
d3f254d2e4
4 changed files with 36 additions and 38 deletions
|
@ -131,15 +131,9 @@ impl FontRelativeLength {
|
|||
) -> (Au, CSSFloat) {
|
||||
fn query_font_metrics(
|
||||
context: &Context,
|
||||
reference_font_size: Au,
|
||||
base_size: FontBaseSize,
|
||||
) -> FontMetricsQueryResult {
|
||||
context.font_metrics_provider.query(
|
||||
context.style().get_font(),
|
||||
reference_font_size,
|
||||
context.style().writing_mode,
|
||||
context.in_media_query,
|
||||
context.device(),
|
||||
)
|
||||
context.font_metrics_provider.query(context, base_size)
|
||||
}
|
||||
|
||||
let reference_font_size = base_size.resolve(context);
|
||||
|
@ -164,7 +158,7 @@ impl FontRelativeLength {
|
|||
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) {
|
||||
let reference_size = match query_font_metrics(context, base_size) {
|
||||
FontMetricsQueryResult::Available(metrics) => metrics.x_height,
|
||||
// https://drafts.csswg.org/css-values/#ex
|
||||
//
|
||||
|
@ -180,7 +174,7 @@ impl FontRelativeLength {
|
|||
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) {
|
||||
let reference_size = match query_font_metrics(context, base_size) {
|
||||
FontMetricsQueryResult::Available(metrics) => metrics.zero_advance_measure,
|
||||
// https://drafts.csswg.org/css-values/#ch
|
||||
//
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue