Commit Graph

4 Commits

Author SHA1 Message Date
Jelle Raaijmakers
acd38ad795 Tests/LibWeb: Implement action_sequence in testdriver-vendor.js
This implements WebDriver Actions API support for key sequences with
modifier tracking in our testdriver-vendor.js. The action_sequence
function processes key sources, tracks Shift/Ctrl/Alt/Meta state across
events, and dispatches keys with the appropriate modifiers via
Internals.sendText().

This allows us to pass WPT tests that make use of that API in our own
test-web runner.
2026-01-23 14:21:35 +01:00
Jelle Raaijmakers
746362e5de LibWeb: Handle WebDriver special keys and Mod_Keypad in keyboard events
Add webdriver_key_to_key_code() in Internals.cpp to properly translate
WebDriver special key codes (0xE000-0xE05D) to KeyCode values with
appropriate modifiers. This ensures keys like Enter, Backspace, and
arrow keys are handled correctly when sent via Internals::send_text().

In EventHandler::handle_keydown(), strip Mod_Keypad when determining
Enter key behavior since it only indicates key location (numpad vs
standard keyboard), not a behavior change. The modifier is still passed
through to KeyboardEvent for the location property.

This gains us 656 WPT subtest passes in `editing`.
2026-01-23 14:21:35 +01:00
Jelle Raaijmakers
da01b0c389 LibWeb: Insert newlines for line breaks in preformatted white-space
When inserting a line break in a contenteditable with preformatted
white-space (pre, pre-line, pre-wrap), insert a newline character (\n)
instead of a <br> element. Use <br> only for padding at end of line to
ensure the cursor can be placed on the new line.
2026-01-23 14:21:35 +01:00
Jelle Raaijmakers
b3d834eea5 Tests/LibWeb: Import WPT `editing/plaintext-only/insertLineBreak.html' 2026-01-23 14:21:35 +01:00