Skip to content

core, page-script, wpt: transform-aware scroll overflow and keyboard select navigation - #229

Open
BernardoPe wants to merge 5 commits into
bpereira/compat-rendering-paintfrom
bpereira/compat-transform-scroll-overflow
Open

BernardoPe wants to merge 5 commits into
bpereira/compat-rendering-paintfrom
bpereira/compat-transform-scroll-overflow

Conversation

@BernardoPe

Copy link
Copy Markdown
Collaborator

Stacked on #214 (bpereira/compat-rendering-paint).

Changes

  • Transform-aware scrollable overflow (packages/core/src/layout/scroll.rs): when a node's unclipped subtree contains a CSS transform, compute scrollWidth and scrollHeight by mapping each contributing child's clipped local box through its layout offset and transform per CSS Overflow 3 §2.2, leaving the existing fast path unchanged when no transform is present.
  • WPT enrollment (tests/wpt-expectations.json): enroll /css/css-overflow/overflow-abpos-transform.html and /css/css-overflow/scrollable-overflow-transform-011.html.
  • Keyboard <select> selection (packages/page-script/src/index.ts): handle ArrowDown/ArrowUp/ArrowLeft/ArrowRight, Home/End, and printable typeahead keys on focused <select> elements per HTML §4.10.7, skipping disabled options and <optgroup>s and dispatching trusted input and change events.

Verification

  • //packages/core:core_test + //:rust_lint: 30/30 passed (with 3 new tests in packages/core/src/layout/tests/transform_scroll_overflow.rs).
  • //tests/wpt:retry: both enrolled css-overflow WPT tests verified PASS.
  • //packages/page-script:all: 2/2 passed; //packages/engine/test/e2e:select-default-submit: 4/4 passed.

@github-actions github-actions Bot added the vouch:trusted Author is vouched, a collaborator, or a bot. label Nov 24, 2026
@BernardoPe
BernardoPe force-pushed the bpereira/compat-transform-scroll-overflow branch from 401649d to 2755ee6 Compare November 24, 2026 15:44
@BernardoPe
BernardoPe force-pushed the bpereira/compat-transform-scroll-overflow branch from 2755ee6 to 11eca13 Compare November 24, 2026 16:10
@BernardoPe
BernardoPe added this pull request to stack #211 November 24, 2026 17:24
@BernardoPe
BernardoPe force-pushed the bpereira/compat-transform-scroll-overflow branch from 11eca13 to 0d0a90c Compare November 24, 2026 22:16
@BernardoPe
BernardoPe force-pushed the bpereira/compat-transform-scroll-overflow branch 2 times, most recently from 1f1e39f to 7eacb23 Compare November 24, 2026 22:50
Comment thread packages/core/src/layout/scroll.rs Resolved
Comment thread packages/core/src/layout/scroll.rs Resolved
@BernardoPe
BernardoPe force-pushed the bpereira/compat-transform-scroll-overflow branch from 7eacb23 to c4b0777 Compare November 25, 2026 22:16

@ruifigueira ruifigueira left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

beep-boop-rui-agent-🤖

The blocking findings are fixed. Approving.

@BernardoPe
BernardoPe force-pushed the bpereira/compat-transform-scroll-overflow branch 2 times, most recently from c723bbf to e214a8a Compare November 26, 2026 12:38
@BernardoPe
BernardoPe force-pushed the bpereira/compat-transform-scroll-overflow branch from e214a8a to 65cde82 Compare November 26, 2026 17:47
Comment thread packages/core/src/layout/scroll.rs Resolved
… scrollHeight

Scrollable overflow previously read Taffy's pre-transform `scroll_width()` /
`scroll_height()`, so an absolutely positioned box centered with
`left: 50%; transform: translateX(-50%)` inflated `documentElement.scrollWidth`
by its untransformed right edge, while a box shifted out of view by
`translateX(...)` was omitted.

When a node's unclipped subtree contains a CSS `transform`, compute its
scrollable overflow extent by mapping each contributing child's clipped local
box through its layout offset and `transform` per CSS Overflow 3 §2.2, leaving
the fast path unchanged for subtrees without transforms.

https://drafts.csswg.org/css-overflow-3/#scrollable
Signed-off-by: bpereira <bpereira@cloudflare.com>
Signed-off-by: bpereira <bpereira@cloudflare.com>
…sed select

`dispatchKeyEvent` only handled keyboard input on `<input>` and `<textarea>`,
leaving a focused `<select>` unresponsive to `ArrowDown`/`ArrowUp`/`ArrowLeft`/
`ArrowRight`, `Home`/`End`, and printable typeahead keys.

Handle those keys on enabled `<select>` controls per HTML §4.10.7, skipping
disabled options and disabled `<optgroup>`s, updating `selectedIndex`, and
dispatching trusted `input` and `change` events.

https://html.spec.whatwg.org/multipage/form-elements.html#the-select-element
Signed-off-by: bpereira <bpereira@cloudflare.com>
Skip body clipping in transform-aware scrollable overflow when body's
overflow propagates to the viewport (CSS Overflow 3 §3.3), and seed
inline roots from Taffy's unclipped extent so text lines are preserved
alongside transformed atomic inline boxes.

Signed-off-by: bpereira <bpereira@cloudflare.com>
…scroll

The transform-aware scrollable overflow walk diverged from Taffy in three
ways. `contain: layout`/`paint` was not treated as clipping, a scroll
container's end padding was dropped, and RTL containers measured only the
physical right edge so left overflow collapsed to zero.

Score contributions the way Taffy does: mirror the inline axis for RTL, add
the inline-end and block-end padding for scroll containers, and treat
layout/paint containment as clipping. A transform can legitimately shrink
the scroll size, so the walk still replaces Taffy's untransformed extent
rather than taking it as a floor.

Signed-off-by: bpereira <bpereira@cloudflare.com>
@BernardoPe
BernardoPe force-pushed the bpereira/compat-transform-scroll-overflow branch from 65cde82 to 781f8e7 Compare November 27, 2026 19:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

vouch:trusted Author is vouched, a collaborator, or a bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants