Commit graph

388 commits

Author SHA1 Message Date
Euclid Ye
72a9f36c43
webdriver: Reduce IPC for viewport boundary check (#38113)
Testing: No behaviour change.

---------

Signed-off-by: Euclid Ye <euclid.ye@huawei.com>
2025-07-16 10:06:49 +00:00
Kenzie Raditya Tirtarahardja
7dae7f9983
WebDriver: Implement some missing steps of wait for navigation to complete (#38079)
Based on
https://w3c.github.io/webdriver/#dfn-wait-for-navigation-to-complete. We
still have not implement the timer parameter, but I think it makes sense
to implement Step 8.4 of `Navigation To` first.

---------

Signed-off-by: PotatoCP <Kenzie.Raditya.Tirtarahardja@huawei.com>
2025-07-16 09:19:57 +00:00
Euclid Ye
2e3c280f46
webdriver: improve perform pointermove & wheel actions with more accurate coordinates (#38095)
1. Create `get_origin_relative_coordinates` according to
[spec](https://w3c.github.io/webdriver/#dfn-get-coordinates-relative-to-an-origin)
to be reused
2. Add previously missing offset for PointerOrigin::Element
3. Refactor code for perform pointermove/wheel to be closer to spec.
4. Handle some issues with spec:
https://github.com/w3c/webdriver/issues/1758

Testing: Several new passing cases as we are more precise with
coordinates now.
Fixes: Part of #38042.

---------

Signed-off-by: Euclid Ye <euclid.ye@huawei.com>
2025-07-16 02:03:34 +00:00
batu_hoang
8e2d2bde6f
Webdriver GoBack and GoForward commands wait for navigation complete (#37950)
After sending `GoBack` or `GoForward` command, webdriver wait for the
navigation complete.
It can be achieved by waiting for
`WebViewDelegate::notify_history_changed`

Testing: 
`tests/wpt/meta/webdriver/tests/classic/back/back.py`
`tests/wpt/meta/webdriver/tests/classic/forward/forward.py`

---------

Signed-off-by: batu_hoang <longvatrong111@gmail.com>
Signed-off-by: Josh Matthews <josh@joshmatthews.net>
Signed-off-by: batu_hoang <hoang.binh.trong@huawei.com>
Co-authored-by: Josh Matthews <josh@joshmatthews.net>
2025-07-15 10:41:50 +00:00
batu_hoang
f155c95e1b
webdriver: Element click waits for navigation complete (#37935)
Step 11 in https://w3c.github.io/webdriver/#dfn-element-click

> [Try](https://w3c.github.io/webdriver/#dfn-try) to [wait for
navigation to
complete](https://w3c.github.io/webdriver/#dfn-wait-for-navigation-to-complete)
with session.

This fixes issue in which element_click triggers navigation, but
incoming commands still interact with old page.

Testing:
https://github.com/longvatrong111/servo/actions/runs/16175767947
https://github.com/longvatrong111/servo/actions/runs/16175770044

Signed-off-by: batu_hoang <longvatrong111@gmail.com>
2025-07-15 06:51:05 +00:00
Euclid Ye
8877adccf2
script: Improve webdriver_handler::get_element_in_view_center_point (#38058)
1. Some rounding was wrongly used which can be a source of inaccuracy. 
2. Use `window.InnerWidth` instead of `body.ClientWidth` according to
spec.

Testing: Many new passing cases.
Fixes: Part of #38042.

---------

Signed-off-by: Euclid Ye <euclid.ye@huawei.com>
2025-07-15 00:14:17 +00:00
Kenzie Raditya Tirtarahardja
099d20fe94
Webdriver: limit tick action duration to ECMA maximum safe integer (#37977)
Workaround to prevent
`webdriver/tests/classic/perform_actions/invalid.py` from TIMEOUT. I
don't see the spec telling us to limit this number, so I assume the
correct fix is to handle it on parsing.

Testing: `webdriver/tests/classic/perform_actions/invalid.py`.

Signed-off-by: PotatoCP <kenzieradityatirtarahardja18@gmail.com>
2025-07-11 03:23:49 +00:00
Kenzie Raditya Tirtarahardja
a475175949
Webdriver: Send Keys use webview::notify_input_event (#37911)
Previously, we SendKeys will be forwarded to constellation by the
embedder. Now we use webview.notify_input_event, which will send
WebDriverCommandMsg::ForwardInputEvent for the KeyboardEvent and
CompositionEvent.

Fixes: part of https://github.com/servo/servo/issues/37370

---------

Signed-off-by: PotatoCP <kenzieradityatirtarahardja18@gmail.com>
2025-07-10 12:37:01 +00:00
batu_hoang
2e44aba753
webdriver: Implement support for simple dialogs (#37913)
Implement webdriver user prompt: accept alert, dismiss alert, get alert
text.

Tests:
https://github.com/longvatrong111/servo/actions/runs/16175408035
https://github.com/longvatrong111/servo/actions/runs/16175409545

Signed-off-by: batu_hoang <longvatrong111@gmail.com>
2025-07-10 03:15:46 +00:00
batu_hoang
4499fdeb2b
webdriver: Evaluate script commands via the WebView API in servoshell (#37663)
Let `WebDriverCommandMsg::ScriptCommand` goes through embedder first.
Give `embedder` the ability to release `webdriver` from waiting for a
response of `ExecuteScript`.

Tests: https://github.com/longvatrong111/servo/actions/runs/16071375821
No regression compared to CI run on main branch.

Fixes: https://github.com/servo/servo/issues/37370

cc: @xiaochengh

---------

Signed-off-by: batu_hoang <longvatrong111@gmail.com>
Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Co-authored-by: Martin Robinson <mrobinson@igalia.com>
2025-07-09 14:05:39 +00:00
Euclid Ye
68ec88465e
WebDriver Chore: use enum instead of compile time constant for browsing_context_script_command (#37940)
This reduces unnecessary generated code and binary size. See
https://github.com/servo/servo/pull/37712#discussion_r2171957828

Testing: No Behaviour change

---------

Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com>
2025-07-08 17:47:23 +00:00
Kenzie Raditya Tirtarahardja
1773ea44f8
Webdriver: Keyboard Action use webview::notify_input_event instead of directly sent to constellation (#37908)
Previously, we KeyboardAction will be forwarded to constellation by the
embedder. Now we use `webview.notify_input_event`, which will send
`WebDriverCommandMsg::ForwardInputEvent` for KeyboardAction

Fixes: part of https://github.com/servo/servo/issues/37370

---------

Signed-off-by: PotatoCP <kenzieradityatirtarahardja18@gmail.com>
2025-07-08 06:54:57 +00:00
batu_hoang
8df5e1e74d
webdriver: Properly insert the user agent into the capabilities data structure (#37876)
Add user agent into webdriver capabilities.

Testing:
`/mach test-wpt -r --product servodriver
./tests/wpt/tests/webdriver/tests/classic/new_session/response.py`

Signed-off-by: batu_hoang <longvatrong111@gmail.com>
2025-07-04 18:09:59 +00:00
batu_hoang
940eff9497
Move webdriver actions commands to servoshell (#37669)
Move webdriver actions commands to servoshell.

Testing: Test with webdriver enable in the CI
[Test result
1](https://github.com/longvatrong111/servo/actions/runs/15875355256)
[Test result
2](https://github.com/longvatrong111/servo/actions/runs/15875356595)
[Test result
3](https://github.com/longvatrong111/servo/actions/runs/15875361886)

Fixes: https://github.com/servo/servo/issues/37370

Signed-off-by: batu_hoang <longvatrong111@gmail.com>
2025-07-04 16:29:38 +00:00
Euclid Ye
94f35ba998
webdriver: Get the window position as well as the size when resolving "Get Window Rect" (#37812)
1. Rename `GetWindowSize` to `GetWindowRect`
2. Return the WindowRect in device pixels correctly. Previously, it
returns `(0, 0, ScreenWidth, ScreenHeight)` which is a static value.
3. Add `fn window_rect` to `WindowPortsMethods`. Implement it for both
Headless Window and Headed Window.

Testing: Tested manually with powershell script. Result is now dynamic
and reflects the truth.
Fixes: Task 1 & 2 of https://github.com/servo/servo/issues/37804

---------

Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com>
2025-07-02 10:01:27 +00:00
Euclid Ye
9543482f51
webdriver: Greatly improve execution speed for all tests using SetWindowSize (#37712)
1. Remove the unnecessary new thread which use GetWindowRect command and
blocks for 500ms. Previously this is necessary because constellation
forward "resize" to embedder, and WebDriver wait for a constant
sufficient time to `GetWindowRect` in the new thread. This caused long
delay because there are many subtests and SetWindowRect is called
between each.
2. Remove `resize_timeout`
3. Return current dimension instead of 0 from embedder when it fails to
resize.
4. Do resizing as long as one of width/height is `Some`, according to
spec.

Testing: All Conformance test with new passing cases.
Fixes: https://github.com/servo/servo/pull/37663#issuecomment-2999120615

---------

Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com>
2025-07-01 06:26:01 +00:00
Euclid Ye
d781d1b1cb
[WebDriver] Implement XPath Locator Strategy (#37783)
1. Implement XPath Locator Strategy
2. Use it for "Find Element(s)", "Find Element(s) from Element", "Find
Element(s) from Shadow Root"

Testing: `tests\wpt\tests\webdriver\tests\classic\find_element*\find.py`

---------

Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com>
2025-06-30 17:20:52 +00:00
Euclid Ye
0329f33520
[WebDriver] Reuse "Find Elements" handler in "Find element" (#37737)
All "Find Element ..." in
[spec](https://w3c.github.io/webdriver/#find-element-from-element) has
exactly same step has "Find Elements ...", except they extract the first
element if there is any. We now reuse the handler instead of running
numerous repetitive steps, same as what we did for ["Find Element from
Shadow
Root"](https://w3c.github.io/webdriver/#find-element-from-shadow-root)
in #37578.

This reduces binary size by 98KB for Release profile in Windows and
improves maintainability.

Testing: `./mach test-wpt -r
.\tests\wpt\tests\webdriver\tests\classic\find_element* --product
servodriver`

---------

Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com>
2025-06-27 08:45:58 +00:00
Euclid Ye
f9880637e9
[WebDriver] Fully implement "switch to (parent) frame" (#37685)
1. Separate the handling of ["switch to parent
frame"](https://w3c.github.io/webdriver/#switch-to-parent-frame) from
the rest as the processing is a bit different
2. Implement "Select frame by 16-bits numbered ID" for ["switch to
frame"](https://w3c.github.io/webdriver/#switch-to-frame)
3. Implement other missing steps

Testing: All WebDriver Conformance test with new passing cases

---------

Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com>
2025-06-26 07:44:16 +00:00
batu_hoang
62a009399f
webdriver: Move navigation commands to servoshell (#37665)
- Move webdriver `GetViewportSize`, `LoadURL` and `Refresh` to
servoshell.
- Add `GoBack` and `GoFoward` commands.

Testing: Need to finish moving webdriver to servoshell then evaluate
again
Fixes: https://github.com/servo/servo/issues/37370

Signed-off-by: batu_hoang <longvatrong111@gmail.com>
2025-06-25 12:35:13 +00:00
batu_hoang
d970584332
webdriver: Move NewWebView, FocusWebView, GetWindowSize, and SetWindowSize to servoshell (#37555)
Follow up to: https://github.com/servo/servo/pull/36714
Moving webdriver [context
commands](https://www.w3.org/TR/webdriver2/#contexts) to be handled in
embedder:

- [x] New Window command - `WebdriverCommandMsg::NewWebView`
- [x]  Switch To Window command - `WebdriverCommandMsg::FocusWebView`
- [x] Resizing commands

cc: @xiaochengh

---------

Signed-off-by: batu_hoang <longvatrong111@gmail.com>
2025-06-25 10:29:34 +00:00
Euclid Ye
94a7428912
[WebDriver] Grant top_level_script_command and browsing_context_script_command freedom to not verify existence of pipeline (#37632)
Sometimes, it is redundant to verify existence of pipeline over and over
again.
Sometimes, it is just wrong to check it. See [Switch to Parent
Frame](https://w3c.github.io/webdriver/#switch-to-parent-frame), where
we only care about existence of parent frame.
1. This PR adds a constant compile-time bool flag to enable this. This
will be essential to fix "no_browsing_context" next.
2. Fix some wrong usage of `top_level_script_command` in `is_selected`
and `is_enabled`.
3. Add and unify some WARN info related to pipeline in Constellation

Testing: All WebDriver test with new passing cases

---------

Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com>
2025-06-24 06:42:34 +00:00
Euclid Ye
5e252d0ef6
[WebDriver: Release Action] Fix panic by work around buggy spec (#37624)
1. Narrow the lifetime of `input_cancel_list` to avoid Runtime multiple
BorrowMut error.
2. Work around the buggy spec by removing matching item in
`input_cancel_list` when dispatch `keyUp` and `mouseUp`. See
https://github.com/servo/servo/issues/37579#issuecomment-2990762713

Testing: All WebDriver WPT test.
Fixes: #37579

---------

Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com>
2025-06-23 08:33:18 +00:00
Euclid Ye
3feec90528
[WebDriver:Release Actions] Fix wrong comments and Improve codestyle (#37585)
[Spec](https://w3c.github.io/webdriver/#release-actions)
Testing: No behaviour change.

Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com>
2025-06-21 18:31:19 +00:00
Euclid Ye
ce4da2bf97
[WebDriver] Implement "Find Element(s) From ShadowRoot" (#37578)
Also renamed all "CSS" selector variants of `WebDriverScriptCommand` to
avoid confusion.

Testing: Mostly `./mach test-wpt -r
tests\wpt\tests\webdriver\tests\classic\find_*_from_shadow_root\find.py
--product servodriver`
But many other test also relies on finding element(s) from shadow root,
so I ran the entire test.
All deleted lines are from test expectations.

---------

Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com>
2025-06-20 11:54:39 +00:00
Euclid Ye
b331cb4603
[WebDriver: handle_get_shadow_root] Fix Serialization problem (#37564)
1. Correctly Serialize the ShadowRoot. Previously, it contains a nested
element identifier "element-6066-11e4-a52e-4f735466cecf"
2. Improve coding style with what I learnt from Josh today

Testing: Passing way more "Find Elements from Shadow Root" test locally
now
Fixes: #37559

---------

Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com>
2025-06-20 03:07:36 +00:00
batu_hoang
d0100797e8
[webdriver] Move Webdriver to ServoShell (#36714)
Moving `webdriver` to `servoshell`:

- Let `servoshell` manage lifecycle of `webdriver`
- One by one, move the handling of webdriver commands from
`constellation` to `embedder`

Partially fix: https://github.com/servo/servo/issues/37370
Partially fix webdriver test timeout with `no_top_browsing_context`

cc: @xiaochengh

---------

Signed-off-by: batu_hoang <longvatrong111@gmail.com>
2025-06-19 09:52:01 +00:00
batu_hoang
49be5ca05a
Implement webdriver release action (#37484)
- Implement webdriver release action.
- Improve `Input Cancel List`.

Testing: `./mach test-wpt -r --product servodriver
./tests/wpt/tests/webdriver/tests/classic/release_actions/sequence.py`

cc: @xiaochengh

---------

Signed-off-by: batu_hoang <longvatrong111@gmail.com>
2025-06-19 07:03:38 +00:00
Kenzie Raditya Tirtarahardja
cdc8b45965
[WebDriver] Add synchronization for key action (#37403)
Implement action synchronization for key event. Previously only done for
pointer https://github.com/servo/servo/pull/36932 and wheel
https://github.com/servo/servo/pull/37260.

---------

Signed-off-by: PotatoCP <kenzieradityatirtarahardja18@gmail.com>
2025-06-18 07:26:44 +00:00
Euclid Ye
e26532e19b
webdriver_server: Implement find element(s) from element according to spec (#37521)
Report `InvalidArgument` and `NoSuchElement` properly for [Find Element
from
Element](https://w3c.github.io/webdriver/#find-element-from-element) +
[Find Elements from
Element](https://w3c.github.io/webdriver/#find-elements-from-element)

Testing: `./mach test-wpt -r
.\tests\wpt\tests\webdriver\tests\classic\element_click
.\tests\wpt\tests\webdriver\tests\classic\find_* --product servodriver`

---------

Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com>
2025-06-18 06:39:55 +00:00
batu_hoang
152467bc67
Webdriver get focused webview id only request once (#37506)
The retry in previous implementation doesn't have a good reason, it
seems like webdriver just want to try its luck.
If get focused webview return None, better just return it.
There is a case webdriver still runs when all webview are closed.

cc: @xiaochengh

Signed-off-by: batu_hoang <longvatrong111@gmail.com>
2025-06-18 03:51:08 +00:00
Euclid Ye
f8f7c6ebd1
[WebDriver] Properly report error for find_element & find_elements; Get correct visible text when matching links (#37452)
1. Properly report new types of errors for `find_element` and
`find_elements`. Previously never reported.
1.1. `InvalidSelector`
1.2. `NoSuchElement`
1.3. `InvalidArgument`

2. Get the visible text for `<a>` correctly in
`script::webdriver_handler` so that matching would work.

Testing: `./mach test-wpt -r --log-raw "D:\servo test log\all.txt"
webdriver/tests/classic/find_element/find.py
webdriver/tests/classic/find_elements/find.py --product servodriver`

---------

Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com>
2025-06-16 05:23:26 +00:00
Euclid Ye
9352a9db7c
script: Support webdriver's Get Element Text operation for non-HTML elements (#37470)
Fix `WebDriverScriptCommand::GetElementText` similar to
https://github.com/servo/servo/pull/37452#discussion_r2146350739, by
correctly retrieving rendered text.

Testing: `./mach test-wpt -r --log-raw "D:\servo test
log\gt_ele_txt.txt" webdriver/tests/classic/get_element_text --product
servodriver`

Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com>
2025-06-15 05:32:29 +00:00
Euclid Ye
5d42ab05fb
[WebDriver] Improve get active element (#37425)
Report `NoSuchElement` if the active element is null, according to spec.

Testing: `./mach test-wpt -r --log-raw "D:\servo test log\all.txt"
.\tests\wpt\tests\webdriver\tests\classic\get_active_element --product
servodriver`
Partly fixes: #37420. We can pass `get_active_element` test once #37424
is done.

Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com>
2025-06-15 05:17:59 +00:00
batu_hoang
6818d5c600
Wait enough time for tick duration in webdriver dispatch actions (#37423)
Add step `wait at least tick duration milliseconds have passed`
https://w3c.github.io/webdriver/#dfn-dispatch-actions-inner

Testing: Fix intermittent timeout in:

`/tests/wpt/tests/webdriver/tests/classic/perform_actions/pointer_dblclick.py`

cc: @xiaochengh , @jdm

Signed-off-by: batu_hoang <longvatrong111@gmail.com>
2025-06-13 08:40:23 +00:00
batu_hoang
4c598037a5
Verify webview still open in webdriver switch frame command (#37411)
SwitchToParentFrame webdriver commands do not handle the case where the
current top-level browsing context has been closed.

Tests:

`./tests/wpt/tests/webdriver/tests/classic/switch_to_parent_frame/switch.py`
`./tests/wpt/tests/webdriver/tests/classic/switch_to_frame/switch.py`

Signed-off-by: batu_hoang <longvatrong111@gmail.com>
2025-06-13 08:32:59 +00:00
Euclid Ye
f242c120b6
[WebDriver] Improve some session/window handling (#37406)
Improve some session/window handling according to spec.

Testing:`./mach test-wpt -r --log-raw "D:\servo test log\all.txt"
.\tests\wpt\tests\webdriver\tests\classic\ --product servodriver`

---------

Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com>
2025-06-12 09:06:51 +00:00
Euclid Ye
c1ee354c38
webdriver: Assume more consistently that the BrowsingContext exists (#37389)
1. Tidy up some WebDriver handling with browsing context
2. Enable more wpt-test which no longer panic

Testing: `./mach test-wpt -r --log-raw "D:\servo test log\all.txt"
.\tests\wpt\tests\webdriver\tests\classic\ --product servodriver`

---------

Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com>
2025-06-11 14:23:47 +00:00
Euclid Ye
5f1452f9d3
[WebDriver: Dispatch Action] Check if browsing context still open for each tick action (#37393)
As titled. This is what
[spec](https://w3c.github.io/webdriver/#dfn-dispatch-actions-inner)
requires. The motivation is that the previous action might have changed
the browsing context.

Testing: `./mach test-wpt -r --log-raw "D:\servo test log\all.txt"
.\tests\wpt\tests\webdriver\tests\classic\ --product servodriver`

---------

Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com>
2025-06-11 09:53:06 +00:00
Kenzie Raditya Tirtarahardja
15eadb56a4
[webdriver] Add synchronization for wheel action (#37260)
Implement action synchronization for wheel event. Previously only done
for pointer here https://github.com/servo/servo/pull/36932.

Testing:
`tests/wpt/meta/webdriver/tests/classic/perform_actions/wheel.py`

---------

Signed-off-by: PotatoCP <kenzieradityatirtarahardja18@gmail.com>
2025-06-11 09:03:08 +00:00
Euclid Ye
56bbc49f21
[WebDriver] Properly report error: "No such window" (#37385)
For WebDriver, return "No Such Window" properly according to spec.

Testing: `./mach test-wpt -r --log-raw "D:\servo test log\all.txt"
.\tests\wpt\tests\webdriver\tests\classic\ --product servodriver`

---------

Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com>
2025-06-10 19:43:03 +00:00
Euclid Ye
a3c792e5aa
servoshell: Do not focus and raise new auxiliary WebDriver-created WebViews (#37284)
For Desktop port of `request_open_auxiliary_webview`, stay on the
original WebView if the request originates WebDriver.

This is to make sure `webdriver_server::handle_new_window` does not
focus the new window, according to spec. See
c7eba2dbba/tests/wpt/tests/webdriver/tests/classic/new_window/new_window.py (L31-L37)

**To clarify**: this won't change the behaviour when user interacts, but
only affects WebDriver [New
Window](https://w3c.github.io/webdriver/#new-window).

Testing: `./mach test-wpt -r --log-raw "D:/servo log/all.txt"
./tests/wpt/tests/webdriver/tests/classic --product servodriver` based
on 96b0973037

---------

Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com>
2025-06-09 11:07:09 +00:00
Euclid Ye
4e9993128b
[WebDriver] Unify Cookie related Error types (#37339)
Remove `embedder/webdriver.rs::WebDriverCookieError` and use universal
`ErrorStatus` from webdriver crate. This is needed as we might need to
send back more universal error such as `NoSuchWindow`.

Testing: No behaviour change.

Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com>
2025-06-09 06:23:31 +00:00
batu_hoang
aeca81c091
[webdriver] Implement get shadow root (#37280)
Implement Get Element Shadow Root
https://www.w3.org/TR/webdriver2/#dfn-get-element-shadow-root

cc: @xiaochengh, @yezhizhen, @PotatoCP 

Testing:
`\tests\wpt\tests\webdriver\tests\classic\get_element_shadow_root\get.py`
is blocked by `no_browsing_context` and `closed_window`
pass for other sub-tests.

Signed-off-by: batu_hoang <longvatrong111@gmail.com>
2025-06-07 20:54:36 +00:00
Kenzie Raditya Tirtarahardja
097bd9d87f
Fix mistakes in webdriver element send keys (#37286)
Fix mistakes from https://github.com/servo/servo/pull/37224. We should
return in the middle of send keys if the element is either file input or
non typeable form control.

Fixes:
https://github.com/servo/servo/pull/37224#pullrequestreview-2903871157

Signed-off-by: PotatoCP <kenzieradityatirtarahardja18@gmail.com>
2025-06-06 12:39:15 +00:00
Kenzie Raditya Tirtarahardja
d66e4fc459
Implement wb element send keys for file input (#37224)
We can now send keys to file input, which results in uploading file with
given filename. Needs
`pref=dom_testing_html_input_element_select_files_enabled` flag to work.

https://w3c.github.io/webdriver/#element-send-keys

Testing:
`tests/wpt/meta/webdriver/tests/classic/element_send_keys/{events,
file_upload}.py.`

Signed-off-by: PotatoCP <kenzieradityatirtarahardja18@gmail.com>
2025-06-05 06:48:14 +00:00
batu_hoang
e0d96163c7
Fix events filter in wait_for_user_agent_handling_complete (#37241)
Fix a mistake from https://github.com/servo/servo/pull/37095
cc: @xiaochengh

Signed-off-by: batu_hoang <longvatrong111@gmail.com>
2025-06-04 06:39:31 +00:00
batu_hoang
5ef66ce386
Fix webdriver wait for response from constellation (#37095)
Webdriver actions only wait for response from constellation if
`dispatch_tick_actions` sends at least 1 event.

Testing: 
`./mach test-wpt -r --product servodriver
./tests/wpt/tests/webdriver/tests/classic/perform_actions/perform.py `

cc: @xiaochengh, @yezhizhen

Signed-off-by: batu_hoang <longvatrong111@gmail.com>
2025-06-03 11:51:12 +00:00
batu_hoang
ad95a74389
Implement actions_by_tick for webdriver (#37153)
Implement `actions by tick` according to the spec. 
The major change is `dispatch_actions` should receive a `actions by
ticks` as param.

https://w3c.github.io/webdriver/#dispatching-actions
> The algorithm to [dispatch
actions](https://w3c.github.io/webdriver/#dfn-dispatch-actions) takes a
list of actions grouped by
[tick](https://w3c.github.io/webdriver/#dfn-ticks), and then causes each
action to be run at the appropriate point in the sequence.

Reference for types in webdriver:
https://hackmd.io/b59NiPcLR_Gagh7r6r7BEw?view

cc: @xiaochengh

---------

Signed-off-by: batu_hoang <longvatrong111@gmail.com>
2025-06-03 08:20:00 +00:00
Mukilan Thiyagarajan
8a20e42de4
Add support for static SVG images using resvg crate (#36721)
This change adds support for rendering static SVG images using the
`resvg` crate, allowing svg sources in the `img` tag and in CSS
`background` and `content` properties. There are some limitations in
using resvg:

1. There is no support for animations or interactivity as these would
require implementing the full DOM layer of SVG specification.
2. Only system fonts can be used for text rendering. There is some
mechanism to provide a custom font resolver to usvg, but that is not
explored in this change.
3. resvg's handling of certain edge cases involving lack of explicit
`width` and `height` on the root svg element deviates from what the
specification expects from browsers. For example, resvg uses the values
in `viewBox` to derive the missing width or height dimension, but
without scaling that dimension to preserve the aspect ratio. It also
doesn't allow overriding this behavior.

Demo screenshot:
![servo - resvg
img](https://github.com/user-attachments/assets/8ecb2de2-ab7c-48e2-9f08-2d09d2cb8791)

<details>
<summary>Source</summary>

```
<style>
 #svg1 {
   border: 1px solid red;
 }

 #svg2 {
   border: 1px solid red;
   width: 300px;
 }
 #svg3 {
   border: 1px solid red;
   width: 300px;
   height: 200px;
   object-fit: contain;
 }
 #svg4 {
   border: 1px solid red;
   width: 300px;
   height: 200px;
   object-fit: cover;
 }
 #svg5 {
   border: 1px solid red;
   width: 300px;
   height: 200px;
   object-fit: fill;
 }
 #svg6 {
   border: 1px solid red;
   width: 300px;
   height: 200px;
   object-fit: none;
 }
</style>
</head>
<body>
        <div>
          <img id="svg1" src="https://raw.githubusercontent.com/servo/servo/refs/heads/main/resources/servo.svg" alt="Servo logo">
        </div>
        <div>
          <img id="svg2" src="https://raw.githubusercontent.com/servo/servo/refs/heads/main/resources/servo.svg" alt="Servo logo">
          <img id="svg3" src="https://raw.githubusercontent.com/servo/servo/refs/heads/main/resources/servo.svg" alt="Servo logo">
          <img id="svg4" src="https://raw.githubusercontent.com/servo/servo/refs/heads/main/resources/servo.svg" alt="Servo logo">
        </div>
        <div>
          <img id="svg5" src="https://raw.githubusercontent.com/servo/servo/refs/heads/main/resources/servo.svg" alt="Servo logo">
          <img id="svg6" src="https://raw.githubusercontent.com/servo/servo/refs/heads/main/resources/servo.svg" alt="Servo logo">
        </div>
</body>
```

</details>

---------

Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>
Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Co-authored-by: Martin Robinson <mrobinson@igalia.com>
2025-05-27 11:02:40 +00:00