feat(css): expose preferred text scale in the Servo environment - #1
Closed
lanyue-llk wants to merge 4 commits into
Closed
lanyue-llk wants to merge 4 commits into
lanyue-llk wants to merge 4 commits into
Conversation
lanyue-llk
commented
Sep 22, 2026
lanyue-llk
left a comment
Author
There was a problem hiding this comment.
已核对 PR 目标、Stylo 现有 env() 路径、Servo Device setter 约定及 CSSWG 的 preferred-text-scale 定义。改动范围小且分层合理;下面两处分别涉及公开 API 的输入契约和本仓库的回归保护。
lanyue-llk
force-pushed
the
codex/preferred-text-scale
branch
from
September 24, 2026 10:49
402a73d to
3d44ed3
Compare
Author
|
该 PR 的目标分支不是 Moli 实际消费的 Stylo 基线。文字缩放提交已真正 rebase 到 |
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 extends the exact revision currently pinned by Moli (
wpt/property-rule-escaped-names); it does not pull in unrelated Stylo changes. The embedder remains responsible for invalidating computed styles when the preference changes.Validated with rustfmt, a standalone Stylo device/environment test for default and updated values, unknown names, and invalid input, plus a public-CDP Moli test that checks 1.5 → 2 → reset, computed font size and width, unaffected fixed font sizes, and preservation across media preference changes. Chromium 151 was used as the behavioral reference.
Dependency provenance: Moli PR #640 pins all seven Stylo-family Git dependencies to
ldm0/stylo@671d13d31b3b00e7b1e0088ba2b36a4e35c0858c; that is the head of this PR’s target branchwpt/property-rule-escaped-names. The repository is an active fork of servo/stylo, not an unused substitute. Default branchmainis not the revision Moli currently consumes.Moli PR #731 calls
Device::set_preferred_text_scalefrom its style environment update. While this PR is open, Moli pins the contributor forklanyue-llk/styloat immutable commit402a73dba5624bbfb0a16639f03bd48db63af1b0. After this change is integrated into the consumed branch, the dependency can return toldm0/stylousing the actual resulting commit and updated lockfile; this PR does not switch Moli to Stylo main.Review illustrations and evidence
完整验证报告:逐项根因、Chromium 对照与原始证据
以下为 ImageGen 生成的机制示意图;执行结果与原始证据见报告。
文字缩放:环境值、样式失效与重新计算
Moli 将缩放偏好传入 Stylo Device 并触发样式重算;Stylo 提供 env(preferred-text-scale)。只有引用该环境值的 CSS 参与缩放,普通固定字号保持原值。
图中 Moli 的环境更新与样式失效由 Moli #731 实现;本 PR 仅负责 Stylo Device 的环境值及默认值。