Commit graph

10697 commits

Author SHA1 Message Date
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
f81ae1f57f
webdriver chore: check browsing context existence before handling user prompt when required (#38142)
Thanks to Trong with #38035, we can finally handle user prompt. This PR
is mainly dirty work:
1. Add browsing context check before handling user prompt when required,
according to spec.
2. Reduce IPC by removing redundant context existence check.
3. Add many missing docs.

Testing: New passing cases and turn some ERROR into FAIL.

---------

Signed-off-by: Euclid Ye <euclid.ye@huawei.com>
2025-07-17 17:07:05 +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
Tim van der Lippe
18d1a62add
Inherit CSP for blob workers (#38033)
Workers created from Blobs inherit their CSP. Now we inherit the CSP and
set the correct base API url. The base API url should be used when
determining the
report-uri endpoint. Otherwise, the blob URL would be used as a base,
which is invalid and the report wouldn't be sent.

Also create a helper method to concatenate two optionals of CSPList,
which was used in several places.

Part of #4577

Signed-off-by: Tim van der Lippe <tvanderlippe@gmail.com>
2025-07-17 08:14:20 +00:00
Kenzie Raditya Tirtarahardja
439cb00e31
WebDriver: Set current browsing context for NavigateTo and Refresh command (#38107)
Previously we didn't change the current browsing context id in our
WebDriver Session after the commands `Navigate To` and `Refresh`

Signed-off-by: PotatoCP <Kenzie.Raditya.Tirtarahardja@huawei.com>
2025-07-17 07:57:31 +00:00
Abdelrahman Hossam
c76c44d0fb
script: Ensure that keyboard modifiers, screen point, and client point are set in WheelEvents (#37947)
- Updating the WheelEvent initialization to correctly handle keyboard
modifiers when the wheel event is triggered. The changes ensure that the
modifiers (Ctrl, Alt, Shift, Meta) are properly set based on the current
state of the keyboard when the wheel event is created. This is
particularly important for scenarios where the wheel event is influenced
by key presses, such as scrolling with the Ctrl key pressed to zoom in
or out.

- Updating the `screen_point` and `client_point` as it was always 0,0
before. Now, it shows the correct position of the mouse pointer while
triggering the wheel event.

Test: Manual Test case and existing WPT tests
(classic/perform_actions/wheel.py[test_scroll_with_key_pressed])
Fixes: #37827

Signed-off-by: abdelrahman1234567 <abdelrahman.hossameldin.awadalla@huawei.com>
2025-07-17 05:32:03 +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
Josh Matthews
189e649222
indexeddb: Allow deleting unknown DBs. (#38076)
The current behaviour is too strict according to the spec and is the
cause of many intermittent test errors.

Testing: Existing coverage is sufficient.
Fixes: #37706

---------

Signed-off-by: Josh Matthews <josh@joshmatthews.net>
2025-07-16 01:22:18 +00:00
Shubham Gupta
34829dfce7
renderer: Have the viewport meta element establish the initial zoom of new pages (#37315)
This patch contains 2 components: 

1. Instead of passing `self.pinch_zoom_level().get()` while checking
`zoom_result`, initialize it in `combined_magnification`. Ideally, this
part shouldn't have any effect on behavior.

2. Separates the logic for PinchZoom and ViewportZoom. So, when a new
page is opened, it will start with its own viewport zoom scale (rather
than the previous scale multiples).
i.e `self.pinch_zoom_level().get() * 1.0 * magnification`
```rust
        let mut combined_magnification = 1.0;
        ... 
                ScrollZoomEvent::ViewportZoom(magnification) => {
                    combined_magnification *= magnification
                },
        ...        
        let pinch_zoom_result = match self.set_pinch_zoom_level(self.pinch_zoom_level().get() * combined_magnification)
``` 





Testing: This change adds a new WPT test.
Fixes: #37314

---------

Signed-off-by: Shubham Gupta <shubham13297@gmail.com>
2025-07-15 13:54:05 +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
Andrei Volykhin
c817d7b9ce
canvas: Add initial support of ImageBitmapRenderingContext (#37998)
Add support of the ImageBitmapRenderingContext as "bitmaprenderer"
canvas context mode to RenderingContext/OffscreenRenderingContext
https://html.spec.whatwg.org/multipage/#imagebitmaprenderingcontext

It is initial implementation with public interface API but without
any display presentation support for HTMLCanvasElement.

Testing: Improvements in the following tests:
-
html/canvas/element/manual/imagebitmap/createImageBitmap-origin.sub.html
- html/canvas/offscreen/manual/text/canvas.2d.offscreen*
-
html/canvas/offscreen/manual/the-offscreen-canvas/offscreencanvas.transfer.to.imagebitmap.nocrash.html
- imagebitmap-renderingcontext/*

Signed-off-by: Andrei Volykhin <andrei.volykhin@gmail.com>
2025-07-15 08:03:49 +00:00
batu_hoang
aa098ba2a3
webdriver: Allow script thread to fail to send response for ExecuteScript (#38054)
When script thread executes script sent from webdriver, if an alert
appears, webdriver can stop waiting for the script response and process
the next command.

This PR allows script thread to fail to send response for
`ExecuteScript` if the channel is closed.

cc: @xiaochengh

Signed-off-by: batu_hoang <hoang.binh.trong@huawei.com>
2025-07-15 04:14:03 +00:00
Josh Matthews
312985faff
IndexedDB: communicate transaction errors and async response data more precisely (#38027)
Digging into several crashing tests revealed that committing
transactions is a fallible operation. Propagating those errors led to
exposing many new errors caused by the IDBRequest implementation
assuming that all successful responses contained a structured clone. The
end result is a bunch of new test failures that were previously hidden.

Testing: Existing test coverage is sufficient.

---------

Signed-off-by: Josh Matthews <josh@joshmatthews.net>
2025-07-15 02:04:28 +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
Martin Robinson
5bc3c3088a
compositor: Do not wait for animation termination to take screenshots (#38055)
WPT tests are expected to create screenshots as soon as everything is
loaded. If an animation is happening adding the "reftest-wait" class to
the root element is appropriate way to delay the screenshot. Previously,
the
test harness was waiting for all animations to finish, but that is just
leading to many timeouts. Removing that code fixes the timeouts.

Two Servo-specific tests are also updated as they were written with
Servo's previous behavior in mind.

Testing: There are test result updates for this change. Many TIMEOUTS
now either correctly
PASS OR FAIL.
Fixes: #36931.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
2025-07-14 12:18:18 +00:00
leo030303
93e5b672a7
layout: Fix bug where whitespace didn't have line decorations (#38007)
This PR fixes the issue where underlines weren't appearing on
whitespaces. This was due to whitespace being ignored in the `glyphs`
function of `components/layout/display_list/mod.rs` when the fragment
didn't have a selection. I added in a check to include the whitespace if
there's a selection or if there are any line decorations. I also renamed
the field from `ignore_whitespace` to `include_whitespace` to make it a
bit clearer since it was being reversed everywhere it was used anyway.

**Before:**
<img width="1235" height="169" alt="image"
src="https://github.com/user-attachments/assets/51d47781-355f-4915-8100-f3a7db81027f"
/>

**After:**
<img width="1235" height="169" alt="image"
src="https://github.com/user-attachments/assets/9b44fe77-d600-4080-9f3a-2c9b33924f51"
/>


Testing: `/css/css-text/white-space/pre-wrap-018.html` is now passing.
Also verified manually by running
`data:text/html;base64,PGRpdiBzdHlsZT0idGV4dC1kZWNvcmF0aW9uOiB1bmRlcmxpbmU7Ij5IZWxsbyBXb3JsZCE8L2Rpdj4=
`
Fixes: https://github.com/servo/servo/issues/33463

---------

Signed-off-by: Leo Ring <leoring03@gmail.com>
Signed-off-by: leo030303 <59373587+leo030303@users.noreply.github.com>
Co-authored-by: Oriol Brufau <obrufau@igalia.com>
2025-07-13 13:34:51 +00:00
Servo WPT Sync
973465a9b6
Sync WPT with upstream (13-07-2025) (#38026)
Automated downstream sync of changes from upstream as of 13-07-2025
[no-wpt-sync]

Signed-off-by: WPT Sync Bot <ghbot+wpt-sync@servo.org>
2025-07-13 02:09:35 +00:00
Euclid Ye
d38ffb82b2
script: Get the screen metrics from the WebViewDelegate instead of via the compositor (#38020)
Similar to #37960, previously, `AvailHeight`, `AvailWidth`, `Height`,
`Width` ask compositor for screen metrics. This PR moves the request to
embedder.

This simplifies code, and reduces workload of compositor, which is
busier most of time.

Testing: No behaviour change. Updated some tests. `Width/Height` matches
other browsers.

---------

Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com>
2025-07-12 16:07:39 +00:00
Tim van der Lippe
2c116f4011
Fix reporting when only the report-only CSP header is present (#38002)
This was a bit confusing at first, but the report-only only
had an effect if it was used in conjunction with the regular
CSP header. This is incorrect, as the report-only header
can be present on its own.

Additionally, there was double-logic for parsing the CSP list
values, since we can only concatenate CSP lists if we have
an initial value, which requires a concrete policy value.

Therefore, abstract that way by looping over both headers and
handling the case where initially it is `None` and, if the
CSP header is not present, still `None` when we parse
the `report-only` header.

Additionally, update a WPT test. It was expecting the image
to load, yet was showing the fail image.

Part of #4577

Signed-off-by: Tim van der Lippe <tvanderlippe@gmail.com>
2025-07-12 10:38:30 +00:00
sagudev
9b5b26386c
canvas: Use wrapped kurbo::BezPath for path everywhere (#37967)
This PR removes existing path(segment) abstractions in favor of
`kurbo::BezPath`, well actually wrapped `kurbo::BezPath`, to ensure
building of valid paths. This allows us better Path2D building in script
and doing all validation and segmentation there and also allows us
remove blocking is_point_in_path on Path2D as we can now do this in
script. Current path is still done on canvas thread side as it will be
harder to move to script (will be done as a follow up), but it now uses
this new path abstraction.

Using kurbo also allows us to ditch our manual svgpath parser with the
one provided by kurbo.

Same code is stolen from: https://github.com/servo/servo/pull/36821.

Testing: Existing WPT tests
Fixes: #37904

wpt run: https://github.com/sagudev/servo/actions/runs/16172191716

---------

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
2025-07-12 10:37:47 +00:00
sagudev
12d262ec23
chore: Fix expectation of dom/xslt/large-cdata.html and disable HOS in CI (#38016)
I've seen two multiple runs failing that reported this test as stable
FAIL (and in worst case it's intermittent TIMEOUT, but it does not look
like it). We also disable HOS in CI, because they currently do not work:
[#general > CI runners @
💬](https://servo.zulipchat.com/#narrow/channel/263398-general/topic/CI.20runners/near/528443964)

Testing: Just expectation fix.

---------

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
2025-07-12 09:40:34 +00:00
Josh Matthews
7eedeca715
layout: Reverse vertical orientation of gradients using corner directions. (#37802)
Found and manually tested by comparing rendering between Firefox and
Servo.

Testing: Existing WPT coverage is sufficient.
Fixes: #37782

Signed-off-by: Josh Matthews <josh@joshmatthews.net>
2025-07-11 20:02:13 +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
Servo WPT Sync
c631220311
Sync WPT with upstream (11-07-2025) (#38001)
Automated downstream sync of changes from upstream as of 11-07-2025
[no-wpt-sync]

Signed-off-by: WPT Sync Bot <ghbot+wpt-sync@servo.org>
2025-07-11 16:06:40 +00:00
Tim van der Lippe
8edc6ba1b2
Return correct source position for element CSP violations (#37970)
The scripted_caller only has information if the context is coming
from a script. If an element fetch listener processes CSP
violations, then this information doesn't exist. Instead, we should
use the global URL and the line number. WPT tests don't appear
to expect a column number, as they are all zero. Not all elements
are updated, as I am not actually sure all of them need it.

The source position remains an Option, since there are also code
paths that don't correspond to element or script sources. Maybe
in the future we can always determine the source position, but
let's take small steps towards that.

Part of #4577

Signed-off-by: Tim van der Lippe <tvanderlippe@gmail.com>
Co-authored-by: Josh Matthews <josh@joshmatthews.net>
2025-07-11 08:42:51 +00:00
sagudev
75c13f1422
canvas: Properly bound all image pattern axis by inserting clip (#37668)
Before we only handled no-repeat for rect, this means we rendered
https://sagudev.github.io/briefcase/no-repeat.html incorrectly (like
firefox). Now if one of the axis is bounded (does not repeat) we clip it
and let other axis be unbounded (technically we clip it to end of
canvas).

This is also needed for vello backend.

Testing: Tests in WPT exists and another test is added.

---------

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
Co-authored-by: Martin Robinson <mrobinson@igalia.com>
2025-07-11 06:49:09 +00:00
Kingsley Yung
464d71ecfc
Implement cookie expiry date parsing algorithm (#37715)
The cookie-rs library parses the cookie expiry date based on the format
from RFC 2616 (for HTTP/1.1), which is stricter than the format from RFC
6265 (for HTTP cookie).

This patch implements the cookie expiry date algorithm from RFC 6265.
When Cookie::parse fails in parsing the expiry date, we try to parse the
expiry again with this algorithm, to provide extra compatibility with
legacy systems.

Testing: Pass a WPT test that was expected to fail before, and add a
unit test.
Fixes: #36452

---------

Signed-off-by: Kingsley Yung <kingsley@kkoyung.dev>
2025-07-11 05:18:11 +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
minghuaw
5b507dc871
script: Update name validation for attribute, element, and doctype (#37747)
A recent update in the spec (https://github.com/whatwg/dom/pull/1079)
introduced new rules for name validation of attribute, element, and
doctype. This PR implements the new name validation rules in
`components/script/dom/bindings/domname.rs`. The old XML name validation
rules are not fully removed because there remains a few usage of it in
`ProcessingInstructions` and `xpath`.

Testing: Covered by WPT tests
Fixes: #37746

---------

Signed-off-by: minghuaw <michael.wu1107@gmail.com>
Signed-off-by: Minghua Wu <michael.wu1107@gmail.com>
Co-authored-by: Xiaocheng Hu <xiaochengh.work@gmail.com>
2025-07-11 02:45:52 +00:00
Oriol Brufau
e14556959d
layout: Lay out grid items with a consistent tentative block size (#37981)
When laying out a grid item, the tentative block size that is used to
determine the intrinsic inline sizes was different than the one used in
the containing block for the contents. The latter is now used for both
cases.

Testing: A test is now passing.

Signed-off-by: Oriol Brufau <obrufau@igalia.com>
2025-07-10 19:46:21 +00:00
TIN TUN AUNG
f88dd2a12c
add support for apng and webp animated image decoding (#37637)
Add support for APNG animated image decoding. Rework `load_from_memory`
image decoding api, to handle all the image format that currently
supported.

Testing: This change should allow `apng` and `webp` format image start
moving, and should make some WPT test related to APNG pass.

Partially address: https://github.com/servo/servo/issues/37493

[wpt try
run](https://github.com/rayguo17/servo/actions/runs/15840339570)

cc @xiaochengh

Signed-off-by: rayguo17 <rayguo17@gmail.com>
2025-07-10 08:54:16 +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
Servo WPT Sync
84f0cd5801
Sync WPT with upstream (10-07-2025) (#37974)
Automated downstream sync of changes from upstream as of 10-07-2025
[no-wpt-sync]

Signed-off-by: WPT Sync Bot <ghbot+wpt-sync@servo.org>
2025-07-10 03:09:13 +00:00
Tim van der Lippe
70c57c6136
Add support for Reporting-Endpoints (#37965)
Does not yet handle failures of endpoints, which requires us to update
metadata. I don't see that metadata being used anywhere, so I am not
sure if there is WPT coverage for it.

Part of #37238

Signed-off-by: Tim van der Lippe <tvanderlippe@gmail.com>
2025-07-09 19:07:29 +00:00
Andrei Volykhin
26f4da8249
script: Propagate a pending JS exception on structured cloning (#37964)
During the object (de)serialization steps on structured cloning
https://html.spec.whatwg.org/multipage/#safe-passing-of-structured-data
it is possible to throw a JS exception.

`self.postMessage({ get whatever() { throw customError } }));`

Require to propagate a pending JS exception and not throw the default
"DataCloneError" DOM exception.

Testing: Improvements in the following tests
- html/infrastructure/safe-passing-of-structured-data/*
- html/webappapis/structured-clone/structured-clone.any.js*
- wasm/serialization/arraybuffer/transfer.window.js
- webmessaging/without-ports/026.html
- workers/semantics/structured-clone/dedicated.html

Signed-off-by: Andrei Volykhin <andrei.volykhin@gmail.com>
2025-07-09 14:47:55 +00:00
Ngo Iok Ui (Wu Yu Wei)
34c31ee418
WebGL2: support TexImage3D (#37718)
Add TexImage3D method to WebGL2RenderingContext

Testing: conformance2 should pass. Also it should get
http://webglsamples.org/WebGL2Samples/#texture_2d_array and
http://webglsamples.org/WebGL2Samples/#texture_3d running.
Fixes: #26511

Now Servo can run texture_2d_array and texture_3d samples!

![圖片](https://github.com/user-attachments/assets/41b87563-08b8-4db3-b503-12f3a61dbed7)

![圖片](https://github.com/user-attachments/assets/3c62a4de-35ea-488d-b2e5-00e3aed52090)

And it can now run three.js too!

![圖片](https://github.com/user-attachments/assets/d880aa92-a154-4895-aa06-b7919d1fc869)

---------

Signed-off-by: Wu Yu Wei <yuweiwu@pm.me>
2025-07-09 14:22:03 +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
Andrei Volykhin
a5b02047f9
script: Allow to throw a custom exception on structured cloning (#37948)
The structured cloning with transfer list
https://html.spec.whatwg.org/multipage/#structuredserializewithtransfer
throws a "DataCloneError" DOM expection by default if
serialization/transferral
is not possible, but a platform object can throw a custom excepton on
its serialization/transfer steps.

One example is OffscreenCanvas, which can throw
an "InvalidStateError" exception if the context mode is not none on
transfer steps.

https://html.spec.whatwg.org/multipage/#the-offscreencanvas-interface:transfer-steps

Testing: Improvements in the following tests
-
html/canvas/offscreen/manual/the-offscreen-canvas/offscreencanvas.transferrable*

Fixes: #37919

Signed-off-by: Andrei Volykhin <andrei.volykhin@gmail.com>
2025-07-09 11:43:09 +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
Martin Robinson
0db02702e7
layout: When setting post-layout / renderer scroll offsets limit by scroll area (#37829)
Previously when scroll offsets were restored to a new scroll tree
post-layout or when receiving scroll offsets from the compositor, they
were not clamped to the available scroll area. This change fixes that.

Testing: This change fixes some WPT subtests.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
2025-07-08 19:27:42 +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
Andrei Volykhin
4054f9a5a0
canvas: Make OffscreenCanvas transferable (without placeholder) (#37872)
Follow the specification and make OffscreenCanvas objects are
transferable,
but not in case if there are a weak reference to placeholder canvas
element.
To handle it properly need to implement dedicated frame
provider/dispatcher
between canvas element (script thread) and offscreen canvas (dedicated
worker thread).

https://html.spec.whatwg.org/multipage/#the-offscreencanvas-interface:transferable-objects

Testing: Improvements in the following tests
-
html/canvas/element/drawing-images-to-the-canvas/2d.drawImage.detachedcanvas.html
-
html/canvas/offscreen/manual/convert-to-blob/offscreencanvas.convert.to.blob*
-
html/canvas/offscreen/manual/the-offscreen-canvas/offscreencanvas.transfer*
-
html/infrastructure/safe-passing-of-structured-data/transfer-errors.window.js

Part of #24276

Signed-off-by: Andrei Volykhin <andrei.volykhin@gmail.com>
2025-07-08 14:47:29 +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
Oriol Brufau
fe9d49fccc
layout: Require specific layout info in BoxFragment::new() (#37917)
It was very easy to forget about using `.with_specific_layout_info()` to
set the specific layout info, so it's better to make it a parameter.

In fact this already happened in the past: #36993 fixed the missing
specific layout info for flex items.

This patch fixes it for floats and atomic inlines. It also propagates it
in other cases where not doing so was not a big deal because the
specific layout info was None, but that was a fragile assumption.

Testing: Various WPT improvements
Fixes: #37898

Signed-off-by: Oriol Brufau <obrufau@igalia.com>
2025-07-07 15:25:15 +00:00
batu_hoang
9afe027567
servoshell: Do handle prompts and other requests in headless mode when WebDriver is active (#37886)
Webdriver CI uses headless window, which skips the handling for alert
box.
It leads to unexpected `OK` in test results, which should be still
timeout.
This PR removes the skip, so test result in local and CI are
synchronized.

Testing:
7 unexpected `OK` are removed
https://github.com/longvatrong111/servo/actions/runs/16079192271
compared to CI on main:
https://github.com/longvatrong111/servo/actions/runs/16078898742

Fixes: https://github.com/servo/servo/issues/37875
Partially fixes: https://github.com/servo/servo/issues/37387

---------

Signed-off-by: batu_hoang <longvatrong111@gmail.com>
2025-07-07 13:23:00 +00:00
Tim van der Lippe
fcb2a4cd95
Implement initial version of ReportingObserver (#37905)
The specification moved around lately with how it defines its reports
and report bodies. They became dictionaries, but are currently missing
some fields [1].

Most tests won't be passing yet, since the `Reporting-Endpoints` header
isn't used yet. In fact, the specification leaves it up to the browser
to figure out when to run this task [2]. I am not sure if there some
background scheduling we can do here.

Confirmed with content-security-policy/reporting-api/
report-to-directive-allowed-in-meta.https.sub.html that the callback is
invoked. The test doesn't pass, since
the `describe_scripted_caller` is empty for HTML elements. Thus the
`source_file` is empty, whereas it should be equivalent to the current
document URL.

Part of #37328

Signed-off-by: Tim van der Lippe <tvanderlippe@gmail.com>

[1]: https://github.com/w3c/reporting/issues/286
[2]: https://w3c.github.io/reporting/#report-delivery
2025-07-07 10:43:30 +00:00
Servo WPT Sync
ee8bd14f3b
Sync WPT with upstream (06-07-2025) (#37901)
Automated downstream sync of changes from upstream as of 06-07-2025
[no-wpt-sync]

---------

Signed-off-by: WPT Sync Bot <ghbot+wpt-sync@servo.org>
Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
Co-authored-by: sagudev <16504129+sagudev@users.noreply.github.com>
2025-07-06 08:33:30 +00:00
sagudev
48cf50309f
script: Also update canvas contents when laying out right after / during long parsing (#37899)
Before #37703 we were actually doing update rendering of canvases/images
as part of `allow_layout_if_necessary` so let's keep doing that until we
fix this properly as this will be much more involved and we want usable
canvases in the mean time.

Testing: Manual testing + WPT tests
Fixes: #37891

---------

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
2025-07-05 18:09:22 +00:00
sagudev
e1a891ea96
canvas: Use snapshot in canvas backends (#37863)
This removes assumption about pixel format from backend abstraction to
actual backend implementation. This is important for vello.

Testing: WPT tests

---------

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
2025-07-04 20:22:20 +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