style: Make viewport-relative units zoomable via "zoom text only"

They're not font relative, so it we probably want them to be zoomed.

Differential Revision: https://phabricator.services.mozilla.com/D148796
This commit is contained in:
Emilio Cobos Álvarez 2022-06-14 08:38:11 +00:00 committed by Martin Robinson
parent 82d7f2154d
commit 5de65d9f2c
4 changed files with 47 additions and 25 deletions

View file

@ -790,6 +790,19 @@ impl NoCalcLength {
}
}
/// Whether text-only zoom should be applied to this length.
///
/// Generally, font-dependent/relative units don't get text-only-zoomed,
/// because the font they're relative to should be zoomed already.
pub fn should_zoom_text(&self) -> bool {
match *self {
Self::Absolute(..) |
Self::ViewportPercentage(..) => true,
Self::ServoCharacterWidth(..) |
Self::FontRelative(..) => false,
}
}
/// Parse a given absolute or relative dimension.
pub fn parse_dimension(
context: &ParserContext,