Skip to content

Expose preferred text scale as a CSS environment value - #1

Open
lanyue-llk wants to merge 2 commits into
lexmount:molifrom
lanyue-llk:codex/preferred-text-scale
Open

lanyue-llk wants to merge 2 commits into
lexmount:molifrom
lanyue-llk:codex/preferred-text-scale

Conversation

@lanyue-llk

Copy link
Copy Markdown

Expose env(preferred-text-scale) as a numeric CSS environment value on Servo devices, defaulting to 1. Embedders can update the preference through Device::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:moli at 3c8bbb450a52f9a4dcb2de51061216a1d2727def. 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 Stylo main, so it retains Moli's existing content / counter() support and other branch-specific fixes.

Moli PR #731 calls Device::set_preferred_text_scale from its style environment update. While this PR is open, Moli pins the contributor fork at immutable commit 3d44ed308. After integration, Moli can return to lexmount/stylo:moli at the resulting commit.

Review illustrations and evidence

完整验证报告:逐项根因、Chromium 对照与原始证据

以下为 ImageGen 生成的机制示意图;执行结果与原始证据见报告。

文字缩放:环境值、样式失效与重新计算

Moli 将缩放偏好传入 Stylo Device 并触发样式重算;Stylo 提供 env(preferred-text-scale)。只有引用该环境值的 CSS 参与缩放,普通固定字号保持原值。

文字缩放:环境值、样式失效与重新计算

图中 Moli 的环境更新与样式失效由 Moli #731 实现;本 PR 仅负责 Stylo Device 的环境值及默认值。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant