style: More fine-grained viewport units invalidation

This should speed up window resize significantly.

Differential Revision: https://phabricator.services.mozilla.com/D118878
This commit is contained in:
Emilio Cobos Álvarez 2023-05-22 10:01:09 +02:00 committed by Oriol Brufau
parent 85b7a60a69
commit 25edb3c21b
6 changed files with 88 additions and 1 deletions

View file

@ -5,6 +5,7 @@
//! `<length>` computed values, and related ones.
use super::{Context, Number, ToComputedValue};
use crate::computed_value_flags::ComputedValueFlags;
use crate::values::animated::ToAnimatedValue;
use crate::values::computed::NonNegativeNumber;
use crate::values::generics::length as generics;
@ -36,6 +37,7 @@ impl ToComputedValue for specified::NoCalcLength {
length.to_computed_value(context, FontBaseSize::CurrentStyle)
},
specified::NoCalcLength::ViewportPercentage(length) => {
context.builder.add_flags(ComputedValueFlags::USES_VIEWPORT_UNITS);
length.to_computed_value(context.viewport_size_for_viewport_unit_resolution())
},
specified::NoCalcLength::ServoCharacterWidth(length) => {