Bug 1915096 - Ensure CSS Zoom (effective_zoom) is applied correctly when font-size is specified by keywords. r=emilio

Differential Revision: https://phabricator.services.mozilla.com/D241936
This commit is contained in:
Swarup Ukil
2025-03-19 16:06:34 +00:00
parent f419fc95e6
commit ae20e24979
3 changed files with 14 additions and 1 deletions

View File

@@ -594,7 +594,8 @@ impl KeywordInfo {
#[cfg(feature="gecko")]
debug_assert_ne!(self.kw, FontSizeKeyword::Math);
let base = context.maybe_zoom_text(self.kw.to_length(context).0);
base * self.factor + context.maybe_zoom_text(self.offset)
let zoom_factor = context.style().effective_zoom.value();
CSSPixelLength::new(base.px() * self.factor * zoom_factor) + context.maybe_zoom_text(self.offset)
}
/// Given a parent keyword info (self), apply an additional factor/offset to

View File

@@ -0,0 +1,5 @@
<!DOCTYPE html>
<title>CSS zoom applies to font-size when specified by keywords</title>
<div style="font-size: medium">
<div style="zoom: 2">This is some zoomed medium text</div>
</div>

View File

@@ -0,0 +1,7 @@
<!DOCTYPE html>
<title>CSS zoom applies to font-size when specified by keywords</title>
<link rel="help" href="https://drafts.csswg.org/css-viewport/">
<link rel="match" href="font-size-keyword-specified-ref.html">
<div style="zoom: 2">
<div style="font-size: medium">This is some zoomed medium text</div>
</div>