Commit graph

28709 commits

Author SHA1 Message Date
Euclid Ye
125df89836
Chore: Remove unused GetFocusTopLevelBrowsingContext from EmbedderToConstellationMessage (#37716)
This is a legacy message used only by WebDriver to focus the webview,
when session just created. Right now this is just dead_code which is not
detected by Lint.

Testing: No behaviour change.

Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com>
2025-06-26 09:45:59 +00:00
Martin Robinson
3cda9f2fb2
layout: Add a ReflowPhases bitflags (#37696)
This is used to capture information about what layout phases are
necessary for a given `ReflowGoal`. It's moved closer to where these
decisions are made and it should be easier to understand what the values
mean. They had gotten a bit out of sync with how queries and layout were
implemented.

Testing: This shouldn't change observable behavior and thus should be
covered
by existing WPT tests.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
2025-06-26 09:31:16 +00:00
sagudev
03dbf9b6f7
webgl: Replace webrender API with compositor API for images handling (#37714)
Like in #37713, instead of updating images directly with webrender api
we use the compositor api. We still keep webrender api available in
webgl, because that's where we do shutdown, due to GL.

Testing: Existing WPT tests

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
2025-06-26 09:06:24 +00:00
Martin Robinson
3e1cdacd07
script|layout: Do not force restyle when doing script queries (#37677)
Instead of doing a restyle whenever layout is requested, only do one if
script believes that the `Document` has changed in a way that needs a
restyle. In addition, track the different reasons this might be the
case. This will be used later to provide better debugging output.

In layout, when a restyle isn't requested, provide:
 - an early return if layout is up-to-date enough for the reflow goal.
 - skipping restyle and reflow if it isn't necessary.

Testing: This should not change observable behavior, and thus is covered
by existing tests.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Co-authored-by: Oriol Brufau <obrufau@igalia.com>
2025-06-26 08:02:15 +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
Usman Yahaya Baba
253fb247f5
Add common resourceId to network events (#37707)
- Add a `resource_id` field to `EventActor` and `NetworkEventActor`
- Store a `next_resource_id` field in DevtoolsInstance
- Add `resource_id` parameter to `NetworkEventActor::new`
- Increment `next_resource_id` when
`DevtoolsInstance::find_network_event_actor` is called so each network
event has a unique id

Testing: Ran servo in devtools mode and can see the data showing in
`status`,`type`, `transferred` ,`size` and `timeline` columns of each
request, also logged the devtools instance and can see unique
`resourceId` for each request.
Fixes: https://github.com/servo/servo/issues/37661

Signed-off-by: Uthman Yahaya Baba <uthmanyahayababa@gmail.com>
2025-06-26 07:08:16 +00:00
Martin Robinson
f745bad37d
script: Consolidate step 22 of per-Document rendering update (#37703)
The parts of step 22 were a bit scattered throughout the codebase, so
this
change moves them all to a single method which does three things:

1. Update all animating images
2. Flush all dirty canvases (2D, WebGL, and WebGPU)
3. Calls reflow on the `Document`

Testing: This shouldn't change behavior in any major way so it should
be covered by existing WPT tests.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
2025-06-26 06:11:03 +00:00
Usman Yahaya Baba
152eb63fb3
Remove duplication between request/response properties in NetworkEventActor (#37651)
- Remove request/response fields in `NetworkEventActor` which now stores
minimal request metadata needed : `URL`, `method`, `timestamps`, `raw
headers`, `body`.
- Refactor add_request and add_response: `add_request` takes the
incoming DevtoolsHttpRequest and populates
`request_url`, `request_method`, `request_started`,
`request_time_stamp`, `request_body`, `request_headers_raw`
`request_cookies`, `request_headers`,`total_time` and `event_timing`
(via a new helper that computes Timings)
While `add_response` takes the incoming DevtoolsHttpResponse and
populates `response_headers_raw`, `response_body` ,`response_cookies`,
`response_headers`, `response_start`, `response_content`
- Add a call to `resources_updated` to push initial request info in
`handle_network_event`
Testing: Run and logged servo in devtools mode and now, the request
header info isavailable as soon as the request gets initiated
Fixes: https://github.com/servo/servo/issues/37566

---------

Signed-off-by: Uthman Yahaya Baba <uthmanyahayababa@gmail.com>
2025-06-25 20:18:44 +00:00
sagudev
6f53d422b0
Make ImageData more spec compliant (#37620)
I updated webidl, and all changes that bring, currently we still not
support float16array (there is no support in FF either). Most notable
change is refactored new_*/Constructors methods, that should now handle
HeapBufferSource more properly (with less unsafe).

Testing: Existing WPT tests
try run: https://github.com/sagudev/servo/actions/runs/15806083404
Fixes: #37618 (although not tested)

---------

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
2025-06-25 16:48:58 +00:00
Andrei Volykhin
59b99de90a
canvas: Add CanvasTransform 'setTransform(transform)' method (#37692)
Follow the HTML canvas specification and add missing
'setTransform(transform)' method to CanvasTransform interface.

https://html.spec.whatwg.org/multipage/#dom-context-2d-settransform-matrix

The third-party WebIDL doesn't support different extended attributes
on different overloads of methods, so 'Throws' attribute was added
to another 'setTransform(...)' method.
https://bugzilla.mozilla.org/show_bug.cgi?id=1020975

Testing: Improvements in the tests
- css/geometry/DOMMatrix*
-
html/canvas/element/transformations/2d.transformation.setTransform.multiple.html
-
html/canvas/offscreen/transformations/2d.transformation.setTransform.multiple

New failing tests due to disabled 'paint worklet' feature
- css/css-paint-api/setTransform-00*.https.html

Signed-off-by: Andrei Volykhin <andrei.volykhin@gmail.com>
2025-06-25 16:11:54 +00:00
Narfinger
64259de1f7
script: Do not run garbage collection when shutting down a Pipeline (#37691)
Removes a GC cleanup step on exit pipeline that took half a second at
the end
of the Speedmometer benchmark. As layout and script are now run serially
this
does not seem to be needed anymore. See also the very short discussion
on Zulip:
[#performance > GC in
handle_exit_pipeline](https://servo.zulipchat.com/#narrow/channel/416779-performance/topic/GC.20in.20handle_exit_pipeline/with/525697861).

Testing: Tested with Speedometer and the WPT tests should still work.

Signed-off-by: Narfinger <Narfinger@users.noreply.github.com>
2025-06-25 15:13:54 +00:00
Martin Robinson
a66a257b38
script: Properly root nodes with animating images (#37689)
This change fixes an issue and makes a few more minor improvements to
the `ImageAnimationState`:

1. Image rooting and unrooted now happens in one step from
   `Window::update_animations_post_reflow`.
2. The `node_to_animating_image_map` is now stored as a shared `RwLock`
   so that it doesn't need to be taken and then replaced in the
`ImageAnimationState` during reflow. This should prevent a hypothetical
issue
   where image animations are restarted during empty reflows.
3. General naming and idiomatic Rust usage improvements.

Testing: This doesn't really have any obvious behavioral changes,
because all
reflows currently trigger a restyle. It becomes a serious problem with
#37677
and this change fixes the failing test there.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
2025-06-25 13:52:11 +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
Martin Robinson
0346a62214
script: Pass more information to the MouseEvent constructor (#37672)
- Instead of eagerly computing `pageX` and `pageY`, collect the offset
  from the content's initial containing block in the compositor and pass
  that information through to `MouseEvent`. This prevents a layout flush
  that was happening when eagerly trying to fetch `Document` scroll
  offsets.
- Pass keyboard modifiers properly to `MouseEvent`.
- Now all this information is stored and passed as `Point2D` (typed) and
  `Modifiers` which greatly reduces the amount of arguments that need to
  be passed around.

Testing: It is difficult to test input events as they require WebDriver
which
isn't completely working yet. I have manually run Speedometer 2.1 and I
have
verified that this fixes the regression from #37601.
Fixes: #37601.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
2025-06-25 12:29:27 +00:00
Jonathan Schwender
50cf01cf3d
script: const initialize LIVE_REFERENCES (#37688)
With Rust 1.85 it is possible to const initialize Hashmaps if the hash
algorithm does not rely on a random seed.

Testing: No functional changes, covered by existing tests

Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>
2025-06-25 11:27:56 +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
Jonathan Schwender
5ea003752a
Fix write_json_to_file perf regressions (#37687)
cd30b78 improved the memory efficiency of write_json_to_file, but this
causes visible (when profiling) perf regression on my mac, which can
easily be fixed by wrapping the file in a `BufWriter`. This still bounds
peak memory usage, but keeps writing efficient.

Testing: Manual profiling with samply.

Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>
2025-06-25 08:45:20 +00:00
Andrei Volykhin
4ee348a202
imagebitmap: Add 'none' image orientation option (#37634)
The 'none' image orientation option was temporarily deprecated (in 2022)
according to HTML specification with the remark about going to be reused
with
a different meaning in future as the same semantics as CSS 'none'
image-orientation.

https://html.spec.whatwg.org/multipage/#dom-imagebitmapoptions-imageorientation-none
https://www.w3.org/TR/css-images-3/#valdef-image-orientation-none

Official MDN documentation added it back with new meaning (in 2024),
but it wasn't added back to HTML specification (still pending).

https://developer.mozilla.org/en-US/docs/Web/API/Window/createImageBitmap#none

At current moment this option is poor supported on all major browsers,
but there are some
existed WPT tests (ImageBitmap/WebGL) which are actively use it in
createImageBitmap() options.

Chromium (supported):
- stable: same as 'from-image' (but with deprecation warning)
- experimental: ignoring any orientation metadata

Firefox (supported as default option):
- stable: ignoring any orientation metadata ('from-image' do the same)

Testing: Improvements and fails (expects 'from-image' behaviour from
'none' option) in the following tests
-
html/canvas/element/manual/imagebitmap/createImageBitmap-exif-orientation_none.html
- webgl/tests/conformance/textures/misc/exif-orientation.html

Fixes (partialy): #34112

Signed-off-by: Andrei Volykhin <andrei.volykhin@gmail.com>
2025-06-25 07:20:12 +00:00
Jonathan Schwender
922d4b83de
Use FnvHashmap for LiveDOMReferences (#37673)
These maps are keyed on pointers, so using FnvHashMap should be faster
and we don't need the collision resistance properties of the default
hasher.

These maps showed up as hot when profiling the testcase from
https://github.com/servo/servo/issues/37223#issuecomment-3000705438.
Switching the hashing algorithm reduces the time spent hashing, but
overall that is still only a fractional part of the testcase.

Testing: Functionality unchanged. Overall the performance change is to
small to show up in any of our automated performance tests. When
comparing the perf profile of the above linked testcase, one should see
a reduction of time spent hashing (inverse call stack)

Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>
2025-06-25 06:47:20 +00:00
Ashwin Naren
d114feb0fa
[IndexedDB] Reduce heed related panics (#37652)
Allows indexeddb backends to return errors on certain operations.
Currently the errors are not demarcated, as the result type is
`Result<(), ()>`. If this is not appropriate then perhaps having a
string error might be better.

Testing: Some tests might perhaps move from PANIC to FAIL
Fixes: Partially fixes a bit of #37647, more work needs to be done
however

---------

Signed-off-by: Ashwin Naren <arihant2math@gmail.com>
Signed-off-by: Josh Matthews <josh@joshmatthews.net>
Co-authored-by: Josh Matthews <josh@joshmatthews.net>
2025-06-25 00:22:19 +00:00
sagudev
4974b4a1f6
canvas: Remove rect -> line handling (#37664)
This causes wrong rendering on vello. Current backends already handle
one dim zero correctly by themself (this was probably needed for azure),
but if we ever needed this, it should be implemented inside faulty
backend.

Testing: Existing WPT tests

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
2025-06-24 14:13:58 +00:00
sagudev
ef7be66c56
canvas: Use strum::{Display, EnumString} for canvas enums (#37670)
This makes it easier to add variants, I also added some spec links and
reordered enum variants to match the spec.

Testing: Just refactor, but the code is covered by WPT tests.

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
2025-06-24 13:03:41 +00:00
Simon Wülker
2dc62c504f
Implement declarative shadow root support for async HTML parser (#37443)
Implements the
[`TreeSink::attach_declarative_shadow`](https://docs.rs/html5ever/latest/html5ever/interface/trait.TreeSink.html#method.attach_declarative_shadow)
method for the async html parser.

Try run with the async html parser:
https://github.com/simonwuelker/servo/actions/runs/15634240606/job/44046871826.
(There are far fewer failures than in the initial try run from
https://github.com/servo/servo/issues/37418)

Testing: We don't run tests with the async html parser
Part of https://github.com/servo/servo/issues/37418

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
2025-06-24 12:45:50 +00:00
Andrei Volykhin
9487f66eaa
webgl: Ignore pixel storage parameters for ImageBitmap source (#37635)
Follow the WebGL specification and ignore the values of UNPACK_FLIP_Y,
UNPACK_PREMULTIPLY_ALPHA, and UNPACK_COLORSPACE_CONVERSION
if the TexImageSource is an ImageBitmap.
https://registry.khronos.org/webgl/specs/latest/1.0/#6.10

Testing: There are no dedicated test results changes without the PR
#37634
which unblocks new testing scenarios with premultiplied ImageBitmap from
Blob/Canvas/Image sources.

Signed-off-by: Andrei Volykhin <andrei.volykhin@gmail.com>
2025-06-24 11:15:50 +00:00
Andrei Volykhin
3f496f8225
canvas: Reset the current path on canvas context resetting (#37671)
Follow the HTML canvas specification and empty the list of subpaths
in context's current default path (step 2) on canvas context reseting
(reset() or set bitmap dimestion).

https://html.spec.whatwg.org/multipage/#reset-the-rendering-context-to-its-default-state

Testing: Improvements in the tests
- html/canvas/element/canvas-host/2d.canvas.host.initial.reset.path.html
- html/canvas/offscreen/canvas-host/2d.canvas.host.initial.reset.path*

Signed-off-by: Andrei Volykhin <andrei.volykhin@gmail.com>
2025-06-24 11:09:25 +00:00
Tim van der Lippe
fc20d8b2e1
Move CSP code into one entrypoint (#37604)
This refactoring moves various CSP-related methods away from GlobalScope
and Document into a dedicated entrypoint. It also reduces the amount of
imports of the CSP crate, so that types are consolidated into this one
entrypoint. That way, we control how CSP code interacts with the script
crate.

For reviewing purposes, I split up the refactoring into separate
distinct commits that all move 1 method(group) into the new file.

Testing: no change in behavior, only a build improvement + code cleanup

---------

Signed-off-by: Tim van der Lippe <tvanderlippe@gmail.com>
Signed-off-by: Tim van der Lippe <TimvdLippe@users.noreply.github.com>
2025-06-24 08:50:30 +00:00
Ashwin Naren
2265570c88
[IndexedDB] Fix upgrade version operation (#37653)
Rejects version upgrade if the upgraded version is lower than the
current database version. Also returns the actual version instead of the
requested upgrade version.

Testing: WPT tests might cover this
Fixes: #25322

Signed-off-by: Ashwin Naren <arihant2math@gmail.com>
2025-06-24 06:47:03 +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
sagudev
e0f3679d55
canvas: Pass pattern by ref (#37662)
We pass all other options as ref too.

Testing: Just refactor, but the code is covered by WPT tests.

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
2025-06-24 05:20:38 +00:00
Ngo Iok Ui (Wu Yu Wei)
25fe003af2
Fix IndexedDB WPT coverage (#37607)
The settings for WPT IndexedDB coverage is incorrect. We never ran the
IndexedDB tests actually.

Testing: `tests/wpt/tests/IndexedDB`

---------

Signed-off-by: Wu Yu Wei <yuweiwu@pm.me>
Signed-off-by: Josh Matthews <josh@joshmatthews.net>
Co-authored-by: Josh Matthews <josh@joshmatthews.net>
2025-06-24 03:47:45 +00:00
Ashwin Naren
476b05676f
Fix indexeddb threadpool (#37649)
Resolves #37638. Fixes threadpool name and adds a config preference
(`threadpools_indexeddb_workers_max`).

Signed-off-by: Ashwin Naren <arihant2math@gmail.com>
2025-06-23 22:06:16 +00:00
Ashwin Naren
2879aa264d
Fix image_cache threadpool configuration (#37650)
Similar to #37638. It was using `threadpools_async_runtime_workers_max`,
and `threadpools_image_cache_workers_max` was unused, this PR fixes
that.

Signed-off-by: Ashwin Naren <arihant2math@gmail.com>
2025-06-23 22:05:53 +00:00
Narfinger
208d4c620a
Allow console commands to appear in log files (#37631)
This enables console.* commands in javascript to be forwarded to the
logger and not just stdout.
The domain for this will be `script::dom::console` which seems
appropate.

Testing: Logs do not have any tests.

Signed-off-by: Narfinger <Narfinger@users.noreply.github.com>
2025-06-23 18:42:36 +00:00
Jonathan Schwender
cd30b78f78
resource_thread: Optimize writing JSON (#37628)
Instead of serializing everything at once in memory it is more efficient
to use `to_writer_pretty`.
The memory allocations from writing the HSTS file to disk showed up very
visibly in DHAT and
should be fixed by streaming the writing. This change should reduce
allocations.

Testing: This change should not modify behavior, and thus is covered by
existing tests.

---------

Signed-off-by: Jonathan Schwender <55576758+jschwe@users.noreply.github.com>
Co-authored-by: Martin Robinson <mrobinson@igalia.com>
2025-06-23 09:23:07 +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
atbrakhi
c8ee11fe77
DevTools: sources for HTML files should be the whole HTML file (#37456)
To show the contents of inline scripts in the Sources panel, we need to
send the whole HTML file from script to devtools, not just the script
code. This is trickier than the external script case, but we can look to
[how Firefox does
it](https://servo.zulipchat.com/#narrow/channel/263398-general/topic/Getting.20the.20original.20page.20HTML.20from.20script/near/524392861)
for some inspiration. The process is as follows:

- when we execute a script
  - notify devtools to create the source actor
- if it’s an external script, send the script code to the devtools
server
  - if it’s an inline script, don’t send any source contents yet
  - devtools stores the contents in the source actor
- while loading a new document
  - buffer the markup, so we can send it to devtools
- when we finish loading a new document
  - send the buffered markup to the devtools server
- devtools stores the contents in any source actors with no contents yet
- when a source actor gets a `source` request
  - if we have the contents, send those contents to the client
- if we don’t have the contents (inline script that loaded while
devtools was closed)
    - FUTURE: try to fetch the markup out of cache
    - otherwise send `<!-- not available; please reload! -->`

Testing: Several tests added to test the changes, also updates an
existing test with correct assertion
Fixes: https://github.com/servo/servo/issues/36874

---------

Signed-off-by: atbrakhi <atbrakhi@igalia.com>
Signed-off-by: Delan Azabani <dazabani@igalia.com>
Co-authored-by: Delan Azabani <dazabani@igalia.com>
2025-06-21 18:46:35 +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
Tim van der Lippe
d2a688d798
Use undefined as this in trusted type callbacks (#37594)
As discussed in w3c/trusted-types#468 the spec will be aligned to the
other browsers, which call the callback with undefined as this.

That also allows us to cleanup the JSContext arguments across a couple
of methods.

Signed-off-by: Tim van der Lippe <tvanderlippe@gmail.com>
2025-06-21 18:29:09 +00:00
Domenico Rizzo
5579b11cf6
[#26488] Refactors WebGLFramebuffer deletion (#37589)
Testing: No tests added
Fixes: Partially #26488

Signed-off-by: Domenico Rizzo <domenico.rizzo@gmail.com>
2025-06-21 18:27:39 +00:00
sagudev
f370606fa8
canvas: Make draw_options non optional in fill_rect (#37603)
All other draw functions already have them non-optional and we always
passed `Some` anyway.

Testing: Existing WPT tests

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
2025-06-21 09:34:28 +00:00
Ngo Iok Ui (Wu Yu Wei)
927573de97
script: complete resolve_module_specifier (#37552)
Implement whole spec of `resolve_module_specifier`. Servo can now
support script element with import map type!

Testing: `tests/wpt/tests/import-map`
Fixes: #37316 #36394

---------

Signed-off-by: Wu Yu Wei <yuweiwu@pm.me>
2025-06-21 06:17:27 +00:00
Bhuwan Pandit
d7269c0f3b
refact: move create_image_bitmap to ImageBitmap Impl (#37348) (#37602)
This PR moves the `create_image_bitmap` method from `GlobalScope` to a
helper function within the `ImageBitmap` implementation in
`imagebitmap.rs`.

Moving this method improves code organization and maintainability. Given
that `globalscope.rs` is already quite large, relocating
`create_image_bitmap` to `imagebitmap.rs` places it closer to the
`ImageBitmap` struct it primarily operates on.

As mentioned in the issue description (No dedicated tests are required
for this change, as long as the project builds), which it does using
`./mach build`. Also ran `./mach fmt` and `./mach test-tidy` which both
didn't report any issue.

Closes #37348

Signed-off-by: Bhuwan Pandit <bhuwanpandit109@gmail.com>
2025-06-21 04:12:11 +00:00
Ngo Iok Ui (Wu Yu Wei)
0832ec5d96
constellation: add multiprocess support on Windows (#37580)
Thanks to ipc-channel 0.20. It's now possible to enable multiprocess
mode on Windows.

Testing: On Windows, run `./mach build -r && ./mach run -r -- -M` We
don't have any CI workflows run on multiprocess IIRC.

Signed-off-by: Wu Yu Wei <yuweiwu@pm.me>
2025-06-21 02:32:18 +00:00
Martin Robinson
69ff4afa58
Rename script_layout_interface to layout_api (#37591)
Now that we are standardizing on the `_traits` crates becoming `_api`
and exposing the API of the crate that they get their name from [^1],
`script_layout_interface` becomes `layout_api` as it exposes the API for
`layout` that is used by `script` This brings the crate in line with the
naming of the other ones in `shared`.

[^1]:
https://servo.zulipchat.com/#narrow/channel/263398-general/topic/Organizing.20*_traits.20crates/with/396893711

Testing: This should not change any behavior and thus is covered by
existing tests.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
2025-06-20 17:13:05 +00:00
Martin Robinson
309485d2db
pixels: Move Snapshot and related data structures to pixels (#37590)
1. The `shared` directory is for the "_traits" crates, which will likely
   be moved out of this directly at some point and renamed "_api". These
   crates expose the API of crates to avoid circular dependencies.
   `Snapshot` isn't really this.
2. `Snapshot` is essentially a specialied kind of `Image` so it makes
   sense that it is grouped with other image-related things in `pixels`.

Testing: This should not change any behavior so is covered by existing
tests.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
2025-06-20 14:47:06 +00:00
Martin Robinson
80a7de8c9c
libservo: Remove TouchEventType argument from WebView::notify_scroll_event (#37588)
The compositor always does the same thing with these events regardless
of the phase, so I think it is completely unecessary.

Testing: This shouldn't change behavior at all, so is covered by
existing tests.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
2025-06-20 13:59:01 +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
Ngo Iok Ui (Wu Yu Wei)
c9d503c458
fix: panic when mouse leave on Windows (#37587)
Add mouse leave event to the check to prevent panic.

Fixes: #37586

Signed-off-by: Wu Yu Wei <yuweiwu@pm.me>
2025-06-20 11:31:57 +00:00
Josh Matthews
30ad91b595
net: Avoid all-encompassing synchronous IPC return type for IndexedDB operations (#37576)
This is finishing some incomplete cleanup from #33044. Kitchen sink enum
types like IndexedDBThreadReturnType make code harder to read and
require ignoring variants that will never be sent in many cases.

Testing: No behaviour change; existing WPT tests suffice.
Fixes: part of #6963

Signed-off-by: Josh Matthews <josh@joshmatthews.net>
2025-06-20 10:06:56 +00:00
Martin Robinson
3774ef00d4
script: Get scroll offsets from layout (#37509)
No longer store scroll offsets for elements in the DOM. Instead
consistently get and set these in layout's `ScrollTree`. This more
consistently requires layout to run when querying scroll offsets, which
ensures that they are up-to-date and properly bounded by scrollable
overflow area.

Testing: This causes several WPT tests to start passing, and one to
start
failing. In the case of
`/shadow-dom/scroll-to-the-fragment-in-shadow-tree.html`, I believe the
issue
is that we don't properly handle scrolling and shadow DOM elements.
Before, the
faulty scrolling was hiding this issue.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
2025-06-20 09:39:12 +00:00