Skip to content

feat(style): expose preferred text scale environment - #1

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

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

Conversation

@lanyue-llk

@lanyue-llk lanyue-llk commented Sep 24, 2026 •

Copy link
Copy Markdown

Purpose

Expose preferred text scale through Stylo's CSS environment so Moli can update dependent styles through normal cascade and invalidation.

Overall design

stylo #1: change overview

Full-size overview · All current PR diagrams

Implementation flow (Mermaid)
flowchart LR
  M["Moli per-target emulation"] --> U["Device update API"]
  U --> V["Validate scale; invalid values become 1"]
  V --> E["env preferred-text-scale"]
  E --> C["CSS substitution and cascade"]
  C --> R["Recompute dependent styles"]
  F["Fixed author font sizes"] --> C
Loading

Scope and integration

  • Add the preferred text scale environment value and embedder update API.
  • Validate values at the Device boundary.
  • Keep fixed author sizes separate from values that depend on the environment.
  • Retain the current WebMCP selector APIs required by the consumer's main branch.

Moli #731 pins head 0db9840e674f6ad45c4df06961501b1a26bd2827 and owns per-target updates and invalidation.

Reproduce the consumer badcase

The original browser-client scenario is v4_cdp_emulation_setemulatedostextscale. Moli lacked the command/state propagation and Stylo lacked the environment value. The full reproduction therefore runs through Moli #731's integration test, which pins this Stylo revision.

Input Expected font size / width for env-based element Fixed author font
scale 1.5 24px / 30px 16px
scale 2 32px / 40px 16px
clear scale 16px / 20px 16px

The fixture uses font-size:calc(16px * env(preferred-text-scale,1)) and width:calc(20px * env(preferred-text-scale,1)). It also updates color-scheme media preferences to check that scale changes preserve other environment state.

git clone https://github.com/lexmount/moli.git moli-review-text-scale
cd moli-review-text-scale
git checkout --detach fb2f6b397f359f2e7b98c59dce76b0a10fa03449
cargo nextest run -p moli-protocol \
  -E 'test(os_text_scale_updates_css_environment_and_preserves_media_preferences) | test(context_media_keeps_each_page_text_scale_across_reload)'

Use the repository's Rust toolchain and cargo-nextest. Expected result: both selected tests pass; failures show expected/actual CSS values. Fixtures are local and need no website deployment. #731's pinned Cargo dependency is the Stylo #1 head 0db9840e674f6ad45c4df06961501b1a26bd2827; the same source also preserves the WebMCP selector APIs.

Evaluation reports

The consumer integration tests distinguish fixed font sizes from environment-dependent sizes and exercise recomputation after scale changes.

@lanyue-llk lanyue-llk changed the title Expose preferred text scale as a CSS environment value feat(style): expose Moli environment and computed style signals Sep 30, 2026
@lanyue-llk
lanyue-llk force-pushed the codex/preferred-text-scale branch from 4e9bf17 to 3d44ed3 Compare September 30, 2026 04:15
@lanyue-llk lanyue-llk changed the title feat(style): expose Moli environment and computed style signals feat(style): expose preferred text scale environment Sep 30, 2026
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.

2 participants