Commit graph

4496 commits

Author SHA1 Message Date
Tim van der Lippe
dbb886fad2
Implement initial version of navigator.sendBeacon (#38301)
Gated behind the feature flag `dom_navigator_sendbeacon_enabled` as the
`keep-alive` fetch parameter is crucial for real-life use cases such as
analytics requests.

Part of #4577
Part of #38302

Signed-off-by: Tim van der Lippe <tvanderlippe@gmail.com>
2025-08-02 15:14:07 +00:00
Euclid Ye
58425f6ae2
Replace all sort with unstable sort (#38427)
["When applicable, unstable sorting is preferred because it is generally
faster than stable sorting and it doesn’t allocate auxiliary
memory."](https://doc.rust-lang.org/std/vec/struct.Vec.html#method.sort)

Binary also reduced by 1KB in Release.

Testing: No behaviour change as semantically all current usage does not
have any pair with `std::cmp::Ordering::Equal`.

Signed-off-by: Euclid Ye <euclid.ye@huawei.com>
2025-08-02 12:41:03 +00:00
Euclid Ye
625d636b04
compositor: Add more doc for size of different RenderingContext implementation (#38399)
For more details, see
https://github.com/servo/servo/issues/38369#issuecomment-3138378527.

Fixes:
https://github.com/servo/servo/issues/38369#issuecomment-3138458772
Testing: Just adding docs.

Signed-off-by: Euclid Ye <euclid.ye@huawei.com>
2025-08-01 09:07:32 +00:00
Kenzie Raditya Tirtarahardja
05ad9026f5
cargo: Upgrade keyboard-types to 0.8.0 and xcomponent-sys to 0.3.4 (#38375)
With some adjustment for `NamedKey`. The two crates need to be bumped
together to avoid duplicate of `keyboard-types` action.

---------

Signed-off-by: PotatoCP <Kenzie.Raditya.Tirtarahardja@huawei.com>
2025-08-01 08:14:38 +00:00
Euclid Ye
d38781d71d
servoshell: Revert #38307 to fix resize bug (#38381)
Also added some comments to make things clear.
For details, see
https://github.com/servo/servo/issues/38369#issuecomment-3138378527

Testing: Tested on X11 Ubuntu, Wayland Ubuntu, macOS, Windows.
Fixes: #38369

Co-authored-by: minghuaw <michael.wu1107@gmail.com>

---------

Signed-off-by: Euclid Ye <euclid.ye@huawei.com>
Co-authored-by: minghuaw <michael.wu1107@gmail.com>
2025-07-31 08:55:00 +00:00
shuppy
c09e117bfe
script: Create a debugger script for the SpiderMonkey Debugger API (#38331)
to use the [SpiderMonkey Debugger
API](https://firefox-source-docs.mozilla.org/js/Debugger/), we need to
call it from an internal debugger script that we will supply. this
script must run in the same runtime as the debuggee(s), but in a
separate
[compartment](https://udn.realityripple.com/docs/Mozilla/Projects/SpiderMonkey/Compartments)
([more
details](https://hacks.mozilla.org/2020/03/future-proofing-firefoxs-javascript-debugger-implementation/)).

this patch defines a new DebuggerGlobalScope type and a new debugger
script resource. when creating each script thread, we create a debugger
global, load the debugger script from resources/debugger.js, and run
that script in the global to initialise the Debugger API.

subsequent patches will use the debugger script as an RPC mechanism for
the Debugger API.

Testing: no testable effects yet, but will be used in #37667
Fixes: part of #36027

---------

Signed-off-by: Delan Azabani <dazabani@igalia.com>
Co-authored-by: atbrakhi <atbrakhi@igalia.com>
2025-07-31 06:17:23 +00:00
batu_hoang
37ac4ffeb4
Rework on webdriver wait for navigation complete (#38234)
For current implementation, when a command may trigger a navigation,
webdriver only waits for document readiness state.
However, not all navigations make change in document.
This PR handles more cases for waiting for a navigation, and apply to
`element_click`.

- Before sending a command which may trigger a navigation, `webdriver`
sets `load status send` to `embedder`, `constelltation` and `script
thread` to listen to `navigation events`.
- Webdriver check if there is a navigation with `script thread`.
- If the navigation is loading a new url, webdriver checks if the
request is approved with `constellation`, then waits for document
readiness state.
- If the navigation is a hashchange, webdriver waits untill all new
generated dom events have been processed.

Testing: 
`tests/wpt/tests/webdriver/tests/classic/element_click/navigate.py`
`tests/wpt/tests/webdriver/tests/classic/element_click/user_prompts.py`
https://github.com/longvatrong111/servo/actions/runs/16488690749

cc: @xiaochengh

---------

Signed-off-by: batu_hoang <hoang.binh.trong@huawei.com>
2025-07-30 07:24:07 +00:00
Euclid Ye
8b3e7b1c6a
webdriver: Keep constellation alive and Open new top-level browsing context with new session request when none is open (#37410)
Keep Constellation alive even when all browsing context closed in
WebDriver mode. In this case, when creating a new session, we would open
a new top-level browsing context.

Fixes: #37408
Testing: `./mach test-wpt -r
.\tests\wpt\tests\webdriver\tests\classic\close_window\close.py
--product servodriver`

---------

Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com>
Signed-off-by: Euclid Ye <euclid.ye@huawei.com>
2025-07-30 06:41:58 +00:00
Euclid Ye
a5d4c49ec6
cargo: Use workspace dependency for winit and upgrade to 0.30.12 (#38261)
Use workspace dependency to sync the `winit` version between examples &
libservo.
Upgrade winit to 0.30.12.

Fixes: The hope is lost as it doesn't fix anything..

---------

Signed-off-by: Euclid Ye <euclid.ye@huawei.com>
2025-07-29 09:45:22 +00:00
Euclid Ye
61273a4321
servoshell: Remove redundant WindowEvent::Resized handler (#38307)
They are redundant as marked in #38174 as rendering related rect already
updated in `minibrowser::update`. As a result, we are able to remove
`window_rendering_context` and `inner_size` fields from `struct Window`.

Testing: No regression/behaviour change in all tests running with headed
window.
Fixes:
https://github.com/servo/servo/issues/38255#issuecomment-3117642340

Signed-off-by: Euclid Ye <euclid.ye@huawei.com>
2025-07-29 08:44:42 +00:00
Euclid Ye
213b532712
cargo: Remove last traces of webdriver from libservo (#38314)
The feature which enables optional dependency & function is never used
and can be safely removed.

Testing: It can still builds.

Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com>
2025-07-28 14:47:56 +00:00
sagudev
a67998b520
canvas: Gate raqote backend behind feature (enabled for now) (#38312)
We want to eventually remove raqote backend, but for now we can gate it
behind a feature (still enabled by default in servoshell) like the rest
of backends. `dom_canvas_backend=auto` will select first available
backend. Builds on top of https://github.com/servo/servo/pull/38310 to
support cases where no backend is available.

Testing: It compiles with or without feature

---------

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
2025-07-28 11:54:40 +00:00
sagudev
056b1538c0
canvas: Add vello_cpu backend (#38282)
vello_cpu does not have any tests timeouts, because we do not need
download stuff from GPU as all work happens on CPU. So performance wise
it's better then classic vello at least for our usecase. There are some
vello bugs, but I think we will be able to sort them out within
upstream, eventually. Interestingly enough there are no new PASS like
they were with classic vello.

Difference with raqote can be observed here:
https://github.com/sagudev/servo/actions/runs/16549241085/attempts/1#summary-46802486798

## Known vello problems:

- https://github.com/linebender/vello/issues/1119
- https://github.com/linebender/vello/issues/1056
-
`/html/canvas/element/fill-and-stroke-styles/2d.gradient.interpolate.coloralpha.html`
- `kurbo::Cap::Butt` is defect (only visible with big lineWidth)
https://github.com/linebender/vello/issues/1063
  - `/html/canvas/element/line-styles/2d.line.cross.html`
  - `/html/canvas/element/line-styles/2d.line.miter.acute.html`
- other lack of strong correct problems
(https://github.com/linebender/vello/issues/1063#issuecomment-2998084736):
  - `/html/canvas/element/path-objects/2d.path.rect.selfintersect.html`
- `putImageData(getImageData(...), ...)` is lossy (precision problems,
might be due to ImageData being unmultiplied)
-
`/html/canvas/element/pixel-manipulation/2d.imageData.put.unchanged.html`

Testing: Tested using vello_cpu_canvas subsuite

---------

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
2025-07-27 19:56:38 +00:00
Euclid Ye
a3de3ffa75
webdriver: Implement maximize window for both headless&headed window (#38271)
- Implement [Maximize
Window](https://w3c.github.io/webdriver/#maximize-window)
- Previously, headless window screen size is same as inner size if not
specified in preference. We make it double as required by the test to
not have max window initially.
- Some other random cleanup.

Testing: webdriver Stress test for maximize window (headed + headless).

---------

Signed-off-by: Euclid Ye <euclid.ye@huawei.com>
2025-07-26 12:21:17 +00:00
sagudev
d678901122
canvas: Add vello backend (#36821)
Add vello backend by implementing Backend traits in canvas crate (so
this lives in canvas_paint_thread - embedded process). Current
implementation uses normal wgpu, so we block on GPU work. Vello backend
is gated behind `vello` feature and `dom_canvas_vello_enabled` pref.

Feature-wise this backend is on on par with raqote (sometimes better
sometimes worse), but performance wise it's worse.

## Known vello problems:

- image roundtrip does not work (fixed in
https://github.com/linebender/vello/pull/974)
- https://github.com/linebender/vello/issues/1066 (fixed)
- clip layers are not working properly:
https://github.com/linebender/vello/issues/1061
  - `/html/canvas/element/pixel-manipulation/2d.imageData.put.*`
  - `/html/canvas/element/path-objects/2d.path.clip.intersect.html`
- https://github.com/linebender/vello/issues/1056
-
`/html/canvas/element/fill-and-stroke-styles/2d.gradient.interpolate.coloralpha.html`
- `kurbo::Cap::Butt` is defect (only visible with big lineWidth)
https://github.com/linebender/vello/issues/1063
  - `/html/canvas/element/line-styles/2d.line.cross.html`
  - `/html/canvas/element/line-styles/2d.line.miter.acute.html`
- other lack of strong correct problems
(https://github.com/linebender/vello/issues/1063#issuecomment-2998084736):
  - `/html/canvas/element/path-objects/2d.path.rect.selfintersect.html`
- There is currently no way to do put image properly in vello as we
would need to ignore all clips and other stuff (we try to work around
this on best effort basis)
https://github.com/linebender/vello/issues/1088
  - `/html/canvas/element/pixel-manipulation/2d.imageData.put.*`
- precision problems
  - `/html/canvas/element/path-objects/2d.path.stroke.scale2.html`
  - `/html/canvas/element/path-objects/2d.path.arc.scale.1.html`

## Known servo problems

- bad performance due to blocking on GPU work
  - some get/put intensive tests `TIMEOUT`
- proper shadow support (non-blocker as we already are living without it
now)
- support for rect shadow is there but unimplemented currently as that's
the state in raqote

Testing: `mach try vello` will run normal WPT (with raqote) +
vello_canvas subsuite that runs only on `/html/canvas/element`. All
subsuite expectations are stored separately.
Fixes: #36823
Fixes: #35230

---------

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
2025-07-26 04:53:10 +00:00
Leo Ring
87bbe0b374
servoshell: Properly set RenderingContext size after resizing (#38257)
The tab bar would disappear on resizes, this just reverts the change
which introduced the bug.

Testing: servoshell doesn't currently have tests, so this change does
not come with a test.
Fixes: https://github.com/servo/servo/issues/38255

Signed-off-by: Leo Ring <leoring03@gmail.com>
2025-07-25 12:05:50 +00:00
Euclid Ye
928934d4b0
servoshell: Respond resize with authentic result and Adjust minimum window size (#38258)
- We no longer pretend that resize is always successful and simplify the
result computation.
- Adjust minimum window size to match other browsers and the test
expectation.
- Restrict some unnecessary access specifier.

Testing: ` ./mach test-wpt -r
"tests\wpt\tests\webdriver\tests\classic\set_window_rect\set.py"
--log-raw "D:\servo test log\set.txt" --product servodriver
{--headless}`
Fixes: #37804 as Task 8 is last task.

---------

Signed-off-by: Euclid Ye <euclid.ye@huawei.com>
2025-07-25 02:31:18 +00:00
Euclid Ye
3bc104c8e4
servoshell: Add window position for headless window (#38249)
Add virtual `window_position` to headless window so that `moveTo` and
WebDriver window command can work properly.

Testing: `./mach test-wpt -r
"tests\wpt\tests\webdriver\tests\classic\set_window_rect\set.py"
--product servodriver --headless`
Fixes: Task 7 of #37804.

---------

Signed-off-by: Euclid Ye <euclid.ye@huawei.com>
2025-07-24 17:57:58 +00:00
Josh Matthews
be38bd4636
servo: Track async webview focus operations (#38243)
https://github.com/servo/servo/pull/38160 added a webdriver-specific API
to support waiting on focus operations to complete. These changes
replace that with a generalized pattern, where a unique ID is created
for each focus operation and the embedder can receive notifications
about each focus operation when it is complete, regardless of whether
the focus was actually changed.

Testing: Existing test coverage from
https://github.com/servo/servo/pull/38160/ is unchanged.

---------

Signed-off-by: Josh Matthews <josh@joshmatthews.net>
2025-07-24 06:01:11 +00:00
Euclid Ye
0b8986c8da
servoshell: Consider window decorations when handling resize requests from web content (#38174)
Also fix some docs. This is used by JS `resizeTo`, `resizeBy` and
webdriver [set window
rect](https://w3c.github.io/webdriver/#set-window-rect).

Testing: Can now pass more tests for headed window.
Fixes: Well.. Originally the attempt is to address
https://github.com/servo/servo/issues/38093#issuecomment-3092284104. But
it turns out as a more general problem to be fixed in another PR.

---------

Signed-off-by: Euclid Ye <euclid.ye@huawei.com>
2025-07-24 05:42:04 +00:00
Euclid Ye
f726737f24
Reduce redundancy in servoshell webdriver message forwarding and add log for script::handle_send_keys_non_typeable (#38238)
There was a new commit for after
https://github.com/servo/servo/pull/38189#discussion_r2224805172, but
that does not seem to update/stop MQ.
Also removed `forward_webdriver_command` in servoshell according to
https://github.com/servo/servo/pull/38212#discussion_r2221854327.

---------

Signed-off-by: Euclid Ye <euclid.ye@huawei.com>
2025-07-24 04:22:04 +00:00
Narfinger
6ace7ad577
OHOS: Clean up some compile warnings (#38240)
This cleans up some compile warnings about unused functions.

Testing: Does not change functionality, OHOS and Linux still compile
(hopefully the other builds too).

---------

Signed-off-by: Narfinger <Narfinger@users.noreply.github.com>
Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>
Co-authored-by: Jonathan Schwender <schwenderjonathan@gmail.com>
2025-07-24 03:29:49 +00:00
Euclid Ye
4ff6b1d4a7
Implement setting position through webdriver for headed window (#38209)
Previously, we pretend we are able to set position in response. Now we
can really do it.

Testing: Able to set position accurately when tested locally.
Fixes: Task 5 of #37804.

---------

Signed-off-by: Euclid Ye <euclid.ye@huawei.com>
2025-07-22 18:26:37 +00:00
Euclid Ye
57fc569818
Remove Webdriver Server's access to Constellation (#38212)
`WebDriverCommandMsg::TakeScreenshot` was the last thing blocking us
from removing constellation access in webdriver server. Now we can
happily remove it.

Surprisingly, this reduces binary size by 185KB for release profile in
Windows. #37737 removes a net total of 300 lines, but only reduced 98KB.

Testing: No regression after testing.

Signed-off-by: Euclid Ye <euclid.ye@huawei.com>
2025-07-22 10:17:19 +00:00
Euclid Ye
b0a29393a9
WebDriver: Wait focus to complete when switching window (#38160)
Previously the webdriver do not wait for focus to complete, which can
cause some instability.

No matter interact as human or webdriver, the focus chain always goes
as: Embedder forwards -> Constellation (do some updates) -> Embedder (do
some updates).

---------

Signed-off-by: Euclid Ye <euclid.ye@huawei.com>
2025-07-21 04:18:21 +00:00
batu_hoang
f0e10e63e2
webdriver: Implement send alert text (#38140)
Implement webdriver `SendAlertText` command

Tests:
https://github.com/longvatrong111/servo/actions/runs/16342669929
https://github.com/longvatrong111/servo/actions/runs/16342671477

cc: @xiaochengh

---------

Signed-off-by: batu_hoang <hoang.binh.trong@huawei.com>
Signed-off-by: batu_hoang <longvatrong111@gmail.com>
2025-07-17 21:24:50 +00:00
Euclid Ye
5911cd891f
servoshell: Fix scroll speed for Desktop (#37982)
According to discussion
https://github.com/servo/servo/pull/34063#discussion_r2187147615, this
PR
1. adds `PIXEL_DELTA_FACTOR` to increase scroll speed for
`MouseScrollDelta::PixelDelta`, which is used by macOS and
high-precision mouse.
2. adds `LINE_WIDTH` to increase x-axis scroll speed for
`MouseScrollDelta::LineDelta`, which is used by Linux and Windows.
3. Increase mouse scroll speed in general to match other browsers
4. Reduce keyboard scroll offset to scroll exactly "one line", to match
other browsers.

Testing: Example in #35037 can now scroll in x-axis as fast as y-axis,
similar to other browsers.
Fixes: part of #38072.

---------

Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com>
Signed-off-by: Euclid Ye <euclid.ye@huawei.com>
2025-07-17 17:43:30 +00:00
Euclid Ye
fe2c13c777
doc: Add doc for compositor/webview/embedder related to window/rect/inner_size/rendering_context (#38110)
Add docs before actually fixing #38089, #38090, #37978, #38093.

Testing: Just adding docs.

---------

Signed-off-by: Euclid Ye <euclid.ye@huawei.com>
2025-07-17 13:40:28 +00:00
batu_hoang
345733a5c5
webdriver: Add handle any user prompts step for all commands (#38035)
- Add `handler any user prompt` step for all commands.
- Enable webdriver tests which were blocked by `handle any user prompt`
step.

---------

Signed-off-by: batu_hoang <hoang.binh.trong@huawei.com>
2025-07-17 09:47:47 +00:00
sagudev
86ea2641f8
servoshell: Update egui to 0.32 (#38119)
We also need to bump egui-file-dialog and accesskit_winit. Changes are
done based on migration paths provided by egui.

Testing: No tests for servoshell
Fixes: #38117

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
2025-07-16 19:42:16 +00:00
Abdelrahman Hossam
2ea95c8813
servoshell: Send all button events to the WebView regardless of what button is pressed (#38053)
Sending all mouse button events (Left, Right, Middle, Back, Forward) to
the constellation for processing. Before, only left and right mouse
buttons were handled.

Testing: There is no new test for this. Manually testing was done. We
currently
do not have a good way to test user interaction in servoshell.
Fixes: #37996

Signed-off-by: abdelrahman1234567 <abdelrahman.hossameldin.awadalla@huawei.com>
2025-07-16 06:53:55 +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
Euclid Ye
547ce67514
servoshell: reduce duplication for conversion between physical/logical position/size (#38082)
With helper functions introduced in #38020, this is now becoming
reality.

Testing: No behaviour change.
Fixes: #37937

Signed-off-by: Euclid Ye <euclid.ye@huawei.com>
2025-07-15 11:27:11 +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
Andrei Volykhin
bf0e3f84d0
imagebitmap: Remove ImageBitmap from experimental web platform features (#38050)
Enable by default the DOM "ImageBitmap" interface previously gated
behind
"dom.imagebitmap.enabled" preference as experimental web platform
feature.

https://html.spec.whatwg.org/multipage/imagebitmap-and-animations.html#imagebitmap

NOTE: Non blocking non supported functionality:
- vector HTMImageElement, bitmap/vector SVGImageElement
- EXIF image orientation

Testing: Covered by existing WPT tests

Fixes: #34112

Signed-off-by: Andrei Volykhin <andrei.volykhin@gmail.com>
2025-07-14 10:20:02 +00:00
Michael Mc Donnell
c2df8a1bf5
Add Linux .desktop file (#38038)
I'm trying to use Servo as a daily driver. I like to pin the most often
used apps to the my taskbar (Dash to Panel in Gnome). I also launch apps
from the menu (Arc Menu). Adding a .desktop file make it show up in the
menu. I could not get pinning to work until I set the name with `winit`.
This is because the name is used to match it with the icon. I used the
Gnome Looking Glass (lg) command to determine that the name was not set.

Testing: I followed the instructions that I put in the .desktop file. I
copied the .desktop file to the right folder, set up a link to the svg
icon, and adjusted the paths to point to the compiled executable.

---------

Signed-off-by: Michael Mc Donnell <michael@mcdonnell.dk>
2025-07-13 23:07:12 +00:00
Euclid Ye
c5aeac3cea
script: Get the window rectangle from the WebViewDelegate instead of via the compositor (#37960)
Previously, `screenX`, `screenY`, `outerHeight`, `outerWidth`, `moveBy`,
`resizeBy` ask compositor for window rectangle, which then return
"inner" rectangle after consulting Embedder.

This PR 
1. removes `GetClientWindowRect` from compositor, and directly let
script ask embedder.
2. add `window_size` to `ScreenGeometry`
3. add a lot of docs to `ScreenGeometry`

Testing: `tests\wpt\mozilla\tests\mozilla\window_resizeTo.html` can now
pass for Headed Window.
Fixes: #37824

---------

Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com>
Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Co-authored-by: Martin Robinson <mrobinson@igalia.com>
2025-07-11 18:31:24 +00:00
Narfinger
90a73f7021
OHOS: Fix speedometer hang sometimes. (#37995)
This fixes the speedometer hang on CI.
Sometimes on CI we have the servoshell app not being in the foreground
(because popups have higher priority). Then, for some reason the
eventloop does not get pumped after some time.
This fixes this and is consistent with the current code in android.

Here is a succesful run
https://github.com/Narfinger/servo/actions/runs/16214904687/job/45782241427.
This needs also https://github.com/servo/servo/pull/37994 to be
successful but these two PR are independent.

Testing: Having the usb popup on the screen while running speedometer
without this changes hangs consistently (until input which calls
present_if_needed). With this change the hang does not occur anymore.
Fixes: I think https://github.com/servo/servo/issues/37727 is the same
issue and I confirmed that in the above case testinput does nothing
useful. We will see if this occurs again.

Signed-off-by: Narfinger <Narfinger@users.noreply.github.com>
2025-07-11 09:22:48 +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
Euclid Ye
07247cd4fd
servoshell: Enable headless event loop for Windows (#37975)
Testing: For windows, it now passes
`/_mozilla/mozilla/window_resizeTo.html` in headless mode but fails in
headed window as expected in
https://github.com/servo/servo/pull/37899#issuecomment-3052566865.

Fixes: #37973 
Fixes: #26431 
Fixes: #20365

Signed-off-by: Euclid Ye yezhizhenjiakang@gmail.com 
Co-authored-by: Josh Matthews josh@joshmatthews.net

Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com>
Co-authored-by: Josh Matthews <josh@joshmatthews.net>
2025-07-10 04:41:41 +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
Narfinger
4cddd5fd5e
OHOS: Make IME more robust against errors (#37959)
OHOS: Allow ime to be more robust against errors. For example, when a
system popup is in front, no keyboard can be displayed, hence, erroring
out. Before we panicked, now we just log the error and continue.

This should hopefully fix some of the recent ohos ci errors.

Testing: Tested on a certain CI device that shows a popup.

Signed-off-by: Narfinger <Narfinger@users.noreply.github.com>
2025-07-09 12:24:45 +00:00
Euclid Ye
2c52efb113
servoshell: Consider both OS decoration width and height when resizing (#37961)
Previously, we only consider OS decoration height. But when testing
#37960, I find that the decoration width is also non-zero.

Testing: Need to wait W3C spec change
https://github.com/web-platform-tests/wpt/pull/53421 related to
webdriver rectangle. When combined with #37960, this can fix at least
`window_resizeTo.html`.

Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com>
2025-07-09 11:35:29 +00:00
Euclid Ye
3526b7e86e
servoshell: Use DeviceIndependentPixel for WebDriver Rect related requests (#37893)
[Spec](https://w3c.github.io/webdriver/#set-window-rect) expects CSS
pixel for input and output. Previously, we use Device Pixel for them
instead.

Testing: Tested manually with different screen DPR and compared with
other browsers.
Fixes: Task 4 of https://github.com/servo/servo/issues/37804

---------

Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com>
2025-07-09 03:56:27 +00:00
Euclid Ye
ec6ac0fced
servoshell: Fix screen_geometry for headed_window (#37934)
This function is used to compute `screenLeft`, `screenTop`, `screenY`,
`screenX`. Previously, it wrongly computes viewport position instead of
window position, which didn't match
f7c86c4393/components/shared/embedder/lib.rs (L717-L720)

Testing: More webdriver test would pass once #37893 is merged.
Fixes: the position part of #37824.

---------

Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com>
2025-07-08 18:51:14 +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
Jonathan Schwender
11bb83d422
mach: macos: Don't let gstreamer override symbols (#37903)
Using DYLD_FALLBACK_LIBRARY_PATH means we first try to link to the
normal libraries and only fallback to looking up symbols in gstreamer if
the symbols were not found elsewhere.
This prevents some linking issues.

Testing: Covered by existing tests. Fix for issue #37811 manually
verified by the reporter.

Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>
2025-07-08 06:12:03 +00:00
Euclid Ye
87f2871661
servoshell: Fix typo in window-size command-line argument help (#37916)
Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com>
2025-07-07 14:17:26 +00:00