Expose preferred text scale as a CSS environment value - #1
Open
lanyue-llk wants to merge 2 commits into
Open
lanyue-llk wants to merge 2 commits into
lanyue-llk wants to merge 2 commits into
Conversation
This was referenced Sep 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Expose
env(preferred-text-scale)as a numeric CSS environment value on Servo devices, defaulting to 1. Embedders can update the preference throughDevice::set_preferred_text_scale; CSS that does not reference the variable keeps its original size. Gecko is unchanged.This is rebased directly onto the Stylo branch currently consumed by Moli,
lexmount/stylo:moliat3c8bbb450a52f9a4dcb2de51061216a1d2727def. The embedder remains responsible for invalidating computed styles when the preference changes.The change includes a standalone Stylo device/environment test for default and updated values, unknown names, and invalid input, plus a public-CDP Moli test covering computed font size, unaffected fixed font sizes, and preservation across media preference changes. The rebased head was formatted; Moli CI provides the integration build and test result.
Dependency provenance: Moli PR #640 resolves all seven Stylo-family Git dependencies from
lexmount/stylo:moli@3c8bbb450a52f9a4dcb2de51061216a1d2727def. This PR targets that exact branch rather than Stylomain, so it retains Moli's existingcontent / counter()support and other branch-specific fixes.Moli PR #731 calls
Device::set_preferred_text_scalefrom its style environment update. While this PR is open, Moli pins the contributor fork at immutable commit3d44ed308. After integration, Moli can return tolexmount/stylo:moliat the resulting commit.Review illustrations and evidence
完整验证报告:逐项根因、Chromium 对照与原始证据
以下为 ImageGen 生成的机制示意图;执行结果与原始证据见报告。
文字缩放:环境值、样式失效与重新计算
Moli 将缩放偏好传入 Stylo Device 并触发样式重算;Stylo 提供 env(preferred-text-scale)。只有引用该环境值的 CSS 参与缩放,普通固定字号保持原值。
图中 Moli 的环境更新与样式失效由 Moli #731 实现;本 PR 仅负责 Stylo Device 的环境值及默认值。