You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[zoom] Adjust line-height and width when the effective zoom changes
Based on CL:5302760 by chrishtr@.
In Blink, lengths are stored on the ComputedStyle with "premultiplied
zoom", meaning that for e.g. width:20px;zoom:200%, the width is stored
as "40". Currently, we do not account for this during inheritance:
we inherit that "40" as-is, even if the effective zoom of the element
we're inheriting into is not the same. Issue 9397 [1] clarified that
this is not correct, and therefore we need to adjust our zoomed values
when inheriting.
This CL solves this problem by using our existing code paths
for creating the computed CSSValue (which already does unzooming)
and for applying that CSSValue onto a ComputedStyle (which already
does zooming).
We need two things for this to work:
1. Special behavior in Longhand::ApplyInherit, which detects if
the effective zoom changed, and if so, inherits via the computed
CSSValue path instead of the regular ComputedStyle-to-ComputedStyle
path. However, Longhand::ApplyInherit is only reached if an explicit
inherit/unset exists in the cascade, but we also need to make the
adjustment for *inherited* properties (e.g. line-height).
Therefore:
2. During cascade expansion, if the effective zoom changes vs. the
parent zoom, we insert explicit 'unset' values at the bottom
of the cascade. This ensures that we always reach ApplyInherit
for affected properties.
This CL only enables the zoom adjustment for one inherited property
(line-height), and one non-inherited property (width) to establish
the pattern. Future CLs will incrementally add the 'affected_by_zoom'
flag to the relevant properties.
Bug: 40946858
[1] w3c/csswg-drafts#9397
Change-Id: Iab4dd978143e56264a5c78377055ecbb0363b276
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5323090
Commit-Queue: Chris Harrelson <[email protected]>
Reviewed-by: Rune Lillesveen <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1267277}
0 commit comments