aboutsummaryrefslogtreecommitdiffstats
path: root/components
Commit message (Collapse)AuthorAgeFilesLines
...
* refactor: use is_zero() instead of comparing with Au::Zero() (#36347)Barigbue Nbira13 days6-14/+15
| | | | | | | | | | | Use `is_zero()` instead of comparing with `Au::Zero()` for zero checks. Testing: This change does not cause behaviour change, a test is not necessary. Fixes: #36300 --------- Signed-off-by: Barigbue <barigbuenbira@gmail.com>
* libservo: Move animation tracking from `WindowMethods` to delegates (#36400)Martin Robinson13 days9-78/+115
| | | | | | | | | | | | | | | | | | This changes removes animation tracking from the `WindowMethods` trait and moves it to `ServoDelegate` and `WebViewDelegate`. - Animation changes per-`WebView` are now triggered in the compositor only when the value is updated there, rather than right after ticking animations. - Both `WebView` and `Servo` now expose an `animation()` method, so tracking animation state actually becomes unecessary in many cases, such as that of desktop servoshell, which can just read the value when the event loop spins. Testing: No tests necessary as the API layer is still untested. Later, tests will be added for the `WebView` API and this can be tested then. Signed-off-by: Martin Robinson <mrobinson@igalia.com> Signed-off-by: Martin Robinson <mrobinson@igalia.com>
* script: Correctly convert a jsval to a `Promise` (#36403)Gae2413 days1-4/+6
| | | | | | | | | | | Fixes an oversight of #36097, in which converting to a Promise would fail if the value passed wasn't actually a Promise, while in binding code we actually call `Promise::new_resolved` on the value. Testing: There are wpt tests that should pass now --------- Signed-off-by: Gae24 <96017547+Gae24@users.noreply.github.com>
* libservo: Move `EventLooperWaker` from `webxr_traits` to `embedder_traits` ↵Martin Robinson14 days6-27/+8
| | | | | | | | | | | | (#36420) Now that `webxr` is integrated into the Servo directory, `webxr` can depend on `embedder_traits` instead of having it re-export this type conditionally (and sometimes duplicating it). Testing: This just moves a data type, so no tests are necessary. Signed-off-by: Martin Robinson <mrobinson@igalia.com> Signed-off-by: Martin Robinson <mrobinson@igalia.com>
* layout: Enable using cached fragments when there is a BoxTree update point ↵Martin Robinson14 days11-47/+187
| | | | | | | | | | | | | | | | | | (#36404) This starts to enable the fragment cache for all layout modes, except grid. The main tricky bit here is that update points are absolutes and these need to be laid out again in their containing blocks. We punt a little bit on this, by forcing ancestors of update points to rebuild their Fragments. This is just the first step. Testing: We do not currently have layout performance tests, but will try to run some tests manually later. Behavior is covered by the WPT. Co-authored-by: Oriol Brufau <obrufau@igalia.com> Signed-off-by: Martin Robinson <mrobinson@igalia.com> Signed-off-by: Martin Robinson <mrobinson@igalia.com> Co-authored-by: Oriol Brufau <obrufau@igalia.com>
* Add serde and wgsl features to wgpu-core (#36411)Oriol Brufau14 days2-3/+5
| | | | | | | | | | | This fixes errors when running `./mach clippy -r -p layout_2020` and `./mach clippy -r -p script`. Also addressing an unused import warning when running the latter. Testing: These changes do not require tests because it's just a compile error fix. Signed-off-by: Oriol Brufau <obrufau@igalia.com>
* script: copy include! files from script_bindings to script's OUT_DIR (#36384)sagudev2025-04-084-15/+53
| | | | | | | | | | | | | | | | | | | | copy generated `include!`d files from script_bindings's OUT_DIR, to script's OUT_DIR to allow Rust Analyzer to load them. This is done to bypass limitation of Rust Analyzer: https://github.com/rust-lang/rust-analyzer/issues/17040 Also build script will now be rerun only when there are actual changes to concrete bindings due to emitted `cargo::rerun-if-changed` (not for each change in script crate). Testing: It compiles so it works, I tested manually and RA now works as expected (although we need to from type alias to concrete union-types definitions) Fixes: https://servo.zulipchat.com/#narrow/channel/263398-general/topic/rust-analyzer.20failed.20to.20include.20codes.20in.20script_bindings --------- Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
* Remove unsafe annotation add to unsafe blocks (#36399)Barigbue Nbira2025-04-081-17/+23
| | | | | | | | | | | | Remove the `unsafe` annotation from the `cross_origin_get` function and add `unsafe` blocks around unsafe code within the function Testing: Testing is not required as this change does not alter behaviour. Fixes: #36358 --------- Signed-off-by: Barigbue <barigbuenbira@gmail.com>
* Unify the way html5ever and xml5ever block on script elements (#36284)Simon Wülker2025-04-086-25/+23
| | | | | | | | | | | | Companion PR for https://github.com/servo/html5ever/pull/591 Testing: Covered by WPT Part of https://github.com/servo/servo/issues/6414, https://github.com/servo/servo/issues/24898, preparation for https://github.com/servo/html5ever/pull/590 --------- Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
* Devtools: initial Debugger > Sources panel (#36164)delan azabani2025-04-086-7/+143
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds support for listing scripts in the Sources panel. Classic scripts, both external and inline, are implemented, but worker scripts and imported module scripts are not yet implemented. For example: ```html <!-- sources.html --> <!doctype html><meta charset=utf-8> <script src="classic.js"></script> <script> console.log("inline classic"); new Worker("worker.js"); </script> <script type="module"> import module from "./module.js"; console.log("inline module"); </script> <script src="https://servo.org/js/load-table.js"></script> ``` ```js // classic.js console.log("external classic"); ``` ```js // worker.js console.log("external classic worker"); ``` ```js // module.js export default 1; console.log("external module"); ``` ![image](https://github.com/user-attachments/assets/2f1d8d7c-501f-4fe5-bd07-085c95e504f2) --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: --> - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [x] These changes partially implement #36027 <!-- Either: --> - [ ] There are tests for these changes OR - [x] These changes require tests, but they are blocked on #36325 Signed-off-by: Delan Azabani <dazabani@igalia.com> Co-authored-by: atbrakhi <atbrakhi@igalia.com>
* add CanGc as argument to methods in DissimilarOriginWindow, ↵Yerkebulan Tulibergenov2025-04-087-15/+31
| | | | | | | | | | | DocumentFragment, DocumentType, DOMRect, DOMRectReadOnly, DOMStringMap (#36395) add CanGc as argument to methods in DissimilarOriginWindow, DocumentFragment, DocumentType, DOMRect, DOMRectReadOnly, DOMStringMap Testing: These changes do not require tests because they are a refactor. Addressed part of https://github.com/servo/servo/issues/34573. Signed-off-by: Yerkebulan Tulibergenov <yerkebulan@gmail.com>
* refactor: add CanGc as argument to methods in Document (#36392)Yerkebulan Tulibergenov2025-04-076-55/+61
| | | | | | | | Add CanGc as arguments in methods in Document Testing: These changes do not require tests because they are a refactor. Addressed part of https://github.com/servo/servo/issues/34573. Signed-off-by: Yerkebulan Tulibergenov <yerkebulan@gmail.com>
* fix: meta referrer updating to follow spec (#36390)Sebastian C2025-04-072-37/+28
| | | | | | | | | | Previously the referrer policy used tree order but the spec only cares about the most-recently-updated or most-recently-added meta referrer. Testing: change has existing WPT tests --------- Signed-off-by: Sebastian C <sebsebmc@gmail.com>
* Split up the URLPattern implementation (#36391)Simon Wülker2025-04-075-2427/+2466
| | | | | | | | | The current implementation is already rather large at ~2.5k lines (~2k LoC). There is still quite a lot of functionality left to implement, so let's split it up while it's still manageable. Testing: Covered by existing web platform tests Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
* Create a parser for URLPatterns (#36382)Simon Wülker2025-04-071-9/+449
| | | | | | | | | | | This change implements the pattern parser, completing the "parsing pipeline" for URL patterns. Testing: Primarily `urlpattern/urlpattern-hasregexpgroups.any.js`, some other subtests start to pass too. --------- Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
* layout: Add initial support for the `::marker` pseudo-element (#36317)Martin Robinson2025-04-077-25/+14
| | | | | | | | | | | | | | | This change adds support for the `::marker` pseudo-element and ensure that markers are cached into the box tree. This is only initial support, there are a few things missing such as animations, transitions, and support the `content` CSS property. Testing: There are WPT tests for this change. Signed-off-by: Martin Robinson <mrobinson@igalia.com> Signed-off-by: Martin Robinson <mrobinson@igalia.com>
* Streams: add an underlying sink type (#36385)Gregory Terzian2025-04-072-50/+105
| | | | | | | | | | | | Introduces the concept of different types of underlying sinks for the writable controller, and a minor fix to the abort algorithm. The dead code is already used in the wip at https://github.com/servo/servo/pull/36181/, and will also be used in a another wip in parallel to implement transform stream, so the concept is introduced here with dead code to facilitate the work in parallel and prevent too much merge conflicts down the road. Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com>
* Remove trailing space in CSSStyleSheet::AddRule() (#36383)Usman Yahaya Baba2025-04-071-1/+1
| | | | | | | | -Remove trailing space in CSSStyleSheet::AddRule() Testing: The change made does not require testing Fixes: https://github.com/servo/servo/issues/36380 Signed-off-by: Uthman Yahaya Baba <uthmanyahayababa@gmail.com>
* layout: Scale images in `image_set` by their specified resolution (#36374)ToBinio2025-04-072-12/+30
| | | | | | | | | | | | | | | | | | | | | | | This PR makes it so the `resolution` factor in `image-set` also affects the image size. For instance, in the example below: ```css background-image: image-set("./small.png" 1x, "./large.png" 2x); ``` if `large.png` is used, an image which is 32x32 will be rendered as 16x16. This is specified in <https://drafts.csswg.org/css-images-4/#image-set-notation>. Testing: - `css/css-images/image-set/image-set-resolution-002.html` --------- Signed-off-by: tobinio <Tobias.frischmann1@gmail.com> Signed-off-by: Martin Robinson <mrobinson@igalia.com> Co-authored-by: Martin Robinson <mrobinson@igalia.com> Co-authored-by: Josh Matthews <josh@joshmatthews.net>
* Add a tokenizer for URLPatterns (#36362)Simon Wülker2025-04-071-4/+543
| | | | | | | | | | | | Not a lot of new tests start to pass because the actual parser is still missing, so we're only passing tests for invalid inputs. The parser will be added in the next PR. This is part 3 of upstreaming the changes in https://github.com/simonwuelker/servo/tree/urlpattern --------- Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
* dom: Implement `ClipboardItem` (#36336)Gae242025-04-065-0/+214
| | | | | | | | | | | implement the `ClipboardItem` interface Testing: covered by existing wpt tests part of #36084 --------- Signed-off-by: Gae24 <96017547+Gae24@users.noreply.github.com>
* Add CanGc as arguments in methods in devtools.rs, CharacterData, ↵Yerkebulan Tulibergenov2025-04-066-30/+42
| | | | | | | | | | | | | CSSStyleRule, CSSStyleSheet (#36375) Add CanGc as arguments in methods in devtools.rs, CharacterData, CSSStyleRule, CSSStyleSheet Testing: These changes do not require tests because they are a refactor. Addressed part of https://github.com/servo/servo/issues/34573. --------- Signed-off-by: Yerkebulan Tulibergenov <yerkebulan@gmail.com>
* Fix radio group validity update when removing or selecting an input (#36252)elomscansio2025-04-064-38/+104
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This PR fixes an issue where radio inputs in the same group failed to correctly update their `validity.valueMissing` state when: - A **checked radio button was removed** from the DOM. - A **different radio button was selected** by user interaction. This behavior caused mismatches with how browsers like Firefox handle radio group validation. --- ### Changes in This PR #### Radio group revalidation on DOM removal - Updated `unbind_from_tree()` to revalidate other radio buttons in the same group when a checked input is removed. - Uses `UnbindContext::parent` as the DOM root to ensure the correct context is used during traversal. #### New helper: `find_related_radios()` - Encapsulates logic for finding other inputs in the same group. - Used during both removal and attribute changes for consistency. #### Validation on `checked`/`value` updates - Introduced `update_related_validity_states()` to revalidate all group members when a radio's `checked` or `value` is changed. #### Web Platform Test (WPT) coverage - Created a new WPT file: `radio-group-valueMissing.html`. - Tests follow recommended `test()` pattern: - **Precondition**: Assert initial `valueMissing`. - **Action**: Remove or select a radio. - **Postcondition**: Assert expected `valueMissing`. #### Manifest updated - The WPT manifest now includes the new test. --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: --> - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [X] These changes fix #36110 <!-- Either: --> - [X] There are tests for these changes Signed-off-by: Emmanuel Elom <elomemmanuel007@gmail.com>
* `compositing`: Combine `webrender_traits` and `compositing_traits` (#36372)Martin Robinson2025-04-0653-596/+561
| | | | | | | | | | | | | | | These two traits both exposed different parts of the compositing API, but now that the compositor doesn't depend directly on `script` any longer and the `script_traits` crate has been split into the `constellation_traits` crate, this can be finally be cleaned up without causing circular dependencies. In addition, some unit tests for the `IOPCompositor`'s scroll node tree are also moved into `compositing_traits` as well. Testing: This just combines two crates, so no new tests are necessary. Fixes: #35984. Signed-off-by: Martin Robinson <mrobinson@igalia.com> Signed-off-by: Martin Robinson <mrobinson@igalia.com>
* Remove unsafe from cross_origin_property_fallback (#36373)Usman Yahaya Baba2025-04-061-2/+2
| | | | | | | | | | | | Remove unsafe from cross_origin_property_fallback - Refactors `cross_origin_property_fallback` to remove the `unsafe` annotation from the function signature, as it now uses safe wrappers instead of raw pointers - Adds an `unsafe` block around `MutableHandle::from_raw` Testing: Changes does not require test Fixes: https://github.com/servo/servo/issues/36359 Signed-off-by: Uthman Yahaya Baba <uthmanyahayababa@gmail.com>
* Process colorSchemeSimulation in TargetConfigurationActor (#36297)Usman Yahaya Baba2025-04-063-7/+44
| | | | | | | | | | | | | | | | Implements Steps 1,4&6 of https://github.com/servo/servo/issues/35867: - Adds `pub simulate_color_scheme` to `BrowsingContextActor` using `script_chan`. - Processes `colorSchemeSimulation` flag in `TargetConfigurationActor`’s `updateConfiguration`. - Routes `colorSchemeSimulation` from `RootActor` via `TabDescriptorActor` to `BrowsingContextActor`. Testing: Compiles and lints clean. Fixes: https://github.com/servo/servo/issues/35867 --------- Signed-off-by: Uthman Yahaya Baba <uthmanyahayababa@gmail.com>
* Remove unsafe from maybe_cross_origin_get_prototype (#36366)Usman Yahaya Baba2025-04-061-8/+6
| | | | | | | | | | | | | Remove unsafe from maybe_cross_origin_get_prototype -Refactors `maybe_cross_origin_get_prototype` to remove the `unsafe` annotation from the function signature and `get_proto_object` argument -Adds `unsafe` blocks around calls `D::GlobalScope::from_context` and `MutableHandleObject::from_raw` Testing: Changes does not require test Fixes: https://github.com/servo/servo/issues/36357 Signed-off-by: Uthman Yahaya Baba <uthmanyahayababa@gmail.com>
* Add CanGc as arguments in methods in Attr and Node (#36371)Yerkebulan Tulibergenov2025-04-0620-111/+137
| | | | | | | | | | | | | Add CanGc as argument to methods in `Attr` and `Node`. Addressed part of https://github.com/servo/servo/issues/34573. --- - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [x] These changes do not require tests because they are a refactor. Signed-off-by: Yerkebulan Tulibergenov <yerkebulan@gmail.com>
* Fix: Add support for stylesheet MIME type quirk in quirks mode (#36338)saku2025-04-061-1/+11
| | | | | | | | | | | | | | | | | This PR implements the HTML spec quirk for stylesheets: https://html.spec.whatwg.org/multipage/#link-type-stylesheet The implementation adds a check in `stylesheet_loader.rs` to handle this quirk condition correctly, and adds a new WPT test to verify that same-origin non-CSS MIME type resources are properly treated as CSS in quirks mode. Testing: Added a new WPT test (`quirk-origin-check-positive.html`) that verifies the positive case for this quirk. Fixes: https://github.com/servo/servo/issues/36324 --------- Signed-off-by: saku-1101 <sakupi1101@outlook.jp>
* Move `ScriptToConstellationMsg` to `constellation_traits` (#36364)Martin Robinson2025-04-0576-1212/+1212
| | | | | | | | | | | | | | | | | | | | | | | | | | | This is the last big change necessary to create the `constellation_traits` crate. This moves the data structure for messages that originate from the `ScriptThread` and are sent to the `Contellation` to `constellation_traits`, effectively splitting `script_traits` in half. Before, `script_traits` was responsible for exposing the API of both the `ScriptThread` and the `Constellation` to the rest of Servo. - Data structures that are used by `ScriptToConstellationMsg` are moved to `constellation_traits`. The dependency graph looks a bit like this: `script_layout_interface` depends on `script_traits` depends on `constellation_traits` depends on `embedder_traits`. - Data structures that are used in the embedding layer (`UntrustedNodeAddress`, `CompositorHitTestResult`, `TouchEventResult` and `AnimationState`) are moved to embedder_traits, to avoid a dependency cycle between `webrender_traits` and `constellation_traits`. - Types dealing with MessagePorts and serialization are moved to `constellation_traits::message_port`. Testing: This is covered by existing tests as it just moves types around. Signed-off-by: Martin Robinson <mrobinson@igalia.com> Signed-off-by: Martin Robinson <mrobinson@igalia.com>
* Refactor:Refactors report_cross_origin_denial method to use unsafe block ↵kaushikashok452025-04-051-5/+7
| | | | | | | | | | | | | | | | (#36365) The method report_cross_origin_denial was marked as unsafe, have instead moved the unsafe code within the method into an unsafe block within the method and removed the unsafe marking for the method. Testing: No testing needed Fixes: This PR resolves #36356. Signed-off-by : Ashok Kaushik kaushikashok45@gmail.com --------- Signed-off-by: ashok.kaushik <ashok.kaushik@zohocorp.com> Co-authored-by: ashok.kaushik <ashok.kaushik@zohocorp.com>
* Stub out Trusted Types interfaces (#36355)Tim van der Lippe2025-04-0517-2/+516
| | | | | | | | | | | | Some methods are implemented fully, while others are implemented partly. With these implementations, there are no observed crashes when running the trusted-types web-platform-tests. Most notably, the tests/wpt/tests/trusted-types/idlharness.window.js is now fully passing. Part of #36258 Signed-off-by: Tim van der Lippe <tvanderlippe@gmail.com>
* structuredclone::read throws a DataClone error on failure (#36361)Kingsley Yung2025-04-051-10/+8
| | | | | | | | | In the structured clone writing API, the read function should throw a DataClone error on failure, just like the write function. Testing: It doesn't require tests. Fixes: #36217 Signed-off-by: Kingsley Yung <kingsley@kkoyung.dev>
* Make the memory reporting multi-process aware (#35863)webbeef2025-04-0513-359/+445
| | | | | | | | | | | | | | | | | | | | | | | | | | So far the memory reporter aggregates reports from all processes, and runs the system reporter only in the main process. Instead it is desirable to have per-process reports. We do so by: - creating a ProcessReports struct that holds includes the pid in addition to the reports themselves. - running the system memory reporter also in content processes. - updating the about:memory page to create one report per process, and add useful information like the pid and the urls loaded in a given process. <!-- Please describe your changes on the following line: --> --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: --> - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors ![image](https://github.com/user-attachments/assets/0bafe140-539d-4d6a-8316-639309a22d4a) Signed-off-by: webbeef <me@webbeef.org>
* Check all ancestor navigable trustworthiness for mixed content (#36157)Sebastian C2025-04-0536-48/+287
| | | | | | | | | | | | | | | | | | | | | | | | | | Propagate through documents a flag that represents if any of the ancestor navigables has a potentially trustworthy origin. The "potentially trustworthy origin" concept appears to have gotten confused in a couple of places and we were instead testing if a URL had "potentially trustworthy" properties. The main test for the ancestor navigables is [mixed-content/nested-iframes](https://github.com/web-platform-tests/wpt/blob/master/mixed-content/nested-iframes.window.js) --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: --> - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [X] These changes fix #36108 <!-- Either: --> - [X] There are tests for these changes --------- Signed-off-by: Sebastian C <sebsebmc@gmail.com>
* script: Implement input preprocessing for URLPatterns (#36225)Simon Wülker2025-04-042-52/+686
| | | | | | | | | | | | Implements https://urlpattern.spec.whatwg.org/#process-a-urlpatterninit and the component canonicalization functions. These handle percent-encoding and such for the components of a `URLPattern`. No new tests pass, because the tokenizer and parser are still missing. This is part 2 of upstreaming the changes in https://github.com/simonwuelker/servo/tree/urlpattern Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
* constellation: Only return focused browsing contexts that exist. (#36330)Josh Matthews2025-04-041-1/+9
| | | | | | | | | | | | | | | | | | The webdriver server relies on the constellation to report which browsing context is focused, and assumes that a focused context is ready for interaction. However, new browsing contexts exist in a weird state where they are not tracked by the constellation until the initial load is complete, which leads to the constellation rejecting attempts to navigate a browsing context right after it's created. These changes ensure the constellation does not report a browsing context as focused until it's actually created and ready for interaction. Testing: Run `./mach test-wpt --product servodriver tests/wpt/mozilla/tests/mozilla/DOMParser.html`, which now runs to completion. Fixes: #34551 Fixes: #36328 Signed-off-by: Josh Matthews <josh@joshmatthews.net>
* Implement TestUtils (#36301)Sebastian C2025-04-044-0/+63
| | | | | | | | | | | | | | | | Implement the TestUtils namespace from https://testutils.spec.whatwg.org/. This should make the `js/builtins/weakrefs` tests run faster and more consistently. This change will enable other WPT tests but no tests exist currently for TestUtils itself. Fixes: #36290 --------- Signed-off-by: Sebastian C <sebsebmc@gmail.com> Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> Co-authored-by: sagudev <16504129+sagudev@users.noreply.github.com>
* constellation: Rename messages sent to the `Constellation` (#36341)Martin Robinson2025-04-0436-363/+414
| | | | | | | | | | | | | | | | | | | | Messages that are sent to the `Constellation` have pretty ambiguous names. This change does two renames: - `ConstellationMsg` → `EmbedderToConstellationMessage` - `ScriptMsg` → `ScriptToConstellationMessage` This naming reflects that the `Constellation` stands in between the embedding layer and the script layer and can receive messages from both. Soon both of these message types will live in `constellation_traits`, reflecting the idea that the `_traits` variant for a crate is responsible for exposing the API for that crate. Testing: No new tests are necessary here as this just renames two enums. Signed-off-by: Martin Robinson <mrobinson@igalia.com> Signed-off-by: Martin Robinson <mrobinson@igalia.com>
* Prevent zombie processes in multi-process mode. (#36329)webbeef2025-04-046-44/+177
| | | | | | | | | | | | | This introduces a process manager that holds for each process a "lifeline": this is the receiving end of a ipc channel that is not used to send anything, but only to monitor the process presence. We turn that ipc receiver into a crossbeam one to integrate the monitoring into the constellation run loop. The sender side is made part of the initial "UnprivilegedContent" data structure sent to the new process, both for content and for service worker processes. When a process dies we currently wait() on it to let the OS do a clean shutdown. Signed-off-by: webbeef <me@webbeef.org>
* script: Remove code dealing with `CompositorUntrustedNode` (#36343)Martin Robinson2025-04-042-36/+5
| | | | | | | | | | | | There used to be two kinds of untrusted nodes, but these have been unified, so the duplicate methods dealing with them in `script` can be removed. Testing: This is covered by existing tests as it shouldn't change any behavior. Signed-off-by: Martin Robinson <mrobinson@igalia.com> Signed-off-by: Martin Robinson <mrobinson@igalia.com>
* constellation: Stop assuming that the viewport is shared by all WebViews ↵Martin Robinson2025-04-0425-256/+271
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (#36312) The `Constellation` previously held a `window_size` member, but this assumes that all `WebView`s have the same size. This change removes that assumption as well as making sure that all `WebView`s pass their size and HiDIP scaling to the `Constellation` when they are created. In addition - `WindowSizeData` is renamed to `ViewportDetails`, as it was holding more than just the size and it didn't necessarily correspond to a "window." It's used for tracking viewport data, whether for an `<iframe>` or the main `WebView` viewport. - `ViewportDetails` is stored more consistently so that conceptually an `<iframe>` can also have its own HiDPI scaling. This isn't something we necessarily want, but it makes everything conceptually simpler. The goal with this change is to work toward allowing per-`WebView` HiDPI scaling and sizing. There are still some corresponding changes in the compositor to make that happen, but they will in a subsequent change. Testing: This is covered by existing tests. There should be no behavior changes. Fixes: This is part of #36232. Signed-off-by: Martin Robinson <mrobinson@igalia.com> Signed-off-by: Martin Robinson <mrobinson@igalia.com>
* script: Remove dependency on `webgpu` (#36332)Martin Robinson2025-04-0423-346/+351
| | | | | | | | | | | | | After #36320, `script` only depends on `webgpu` for its type aliases to `wgpu_core` and `wgpu_types`. This change removes the dependency on `webgpu` in favor of depending directly on the upstream crates. This makes it so that you can change `webgpu` without recompiling `script`. Testing: This change is covered by existing WebGPU tests and is mainly just changing the way dependencies are accessed. Signed-off-by: Martin Robinson <mrobinson@igalia.com> Signed-off-by: Martin Robinson <mrobinson@igalia.com>
* layout: Restrict stretch alignment to flex items with computed auto size ↵Oriol Brufau2025-04-044-64/+64
| | | | | | | | | | | | | | | | | | | | (#36288) We were allowing `align-self: stretch` to stretch flex items whose cross size behaves as `auto`, including cyclic percentages. However, https://github.com/w3c/csswg-drafts/issues/4525 resolved that stretching should only happen when the cross size computes to `auto`. So this patch exposes this information in `ContentBoxSizesAndPBM`, and refactors the flexbox stretching logic. Fixes: #36285 Testing: - `/css/css-flexbox/quirks-auto-block-size-with-percentage-item.html` - `/css/css-flexbox/stretch-requires-computed-auto-size.html` Signed-off-by: Oriol Brufau <obrufau@igalia.com>
* webgpu: Add a `webgpu_traits` crate (#36320)Martin Robinson2025-04-0450-565/+618
| | | | | | | | | | | | | | | This breaks the `script_traits` dependency on `webgpu`. In general, the `traits` crates shouldn't depend on Servo non-`traits` crates. This is necessary to move "script to constellation" messages to the `constellation_traits` crate, making it the entire API for talking to the constellation. This will break a circular dependency when that happens. Testing: Successfully building is enough of a test for this one as it is mainly moving types around. Signed-off-by: Martin Robinson <mrobinson@igalia.com> Signed-off-by: Martin Robinson <mrobinson@igalia.com>
* Separate `WebviewManager` from `Webview` in `compositor` and `constellation` ↵Shubham Gupta2025-04-047-239/+253
| | | | | | | | | (#36302) Create a separate file for `WebviewManager` to improve clarity. Testing: This change is just a refactor, so no new tests are needed. Signed-off-by: Shubham Gupta <shubham13297@gmail.com>
* Move generated bindings to script_bindings (#36323)Josh Matthews2025-04-0443-1826/+1923
| | | | | | | | | | | | | | | | | | | | | This is the final step of #1799, where the majority of the generated code for the JS bindings is now compiled as part of the script_bindings build step. The remaining pieces in script must live there because they refer to concrete DOM types; all code in script_bindings is generic over the [DomTypes](https://doc.servo.org/script/dom/bindings/codegen/DomTypes/trait.DomTypes.html) trait. My testing with incremental builds shows me a 12 second reduction in build times on my 2024 M4 Macbook Pro when modifying code in the script crate after these changes. Before this PR those changes took 20 seconds to rebuild Servo, and now they take 8 seconds. Testing: Existing WPT tests ensure no regressions. Fixes: #1799 --------- Signed-off-by: Josh Matthews <josh@joshmatthews.net>
* Webdriver delete cookie (#36306)Euclid Ye2025-04-047-4/+65
| | | | | | | | | | 1. Implement `WebDriverCommand::DeleteCookie` 2. Remove unnecessary clone for `WebDriverCommand::GetNamedCookie` Fixes: #36287 --------- Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com>
* Fix: `display: inline-grid` considered an atomic inline (#36298)Barigbue Nbira2025-04-032-1/+8
| | | | | | | | | | | | | | | | | | This change ensures that `display: inline-grid` is considered an atomic inline - Add `is_atomic_inline_level()` logic to `box_fragment.rs` to improve accuracy. - Update `stacking_context.rs` to use the new `is_atomic_inline_level()` method instead of the one from stylo. - Update `repeat-auto-fill-005.html` test expectation. - Remove .ini expectations for tests that are no longer failing. Testing: covered by WPT Fixes: #35310 --------- Signed-off-by: Barigbue <barigbuenbira@gmail.com>
* fix: root element not establishing stacking context (#35390) (#36174)Michael Rees2025-04-035-0/+23
| | | | | | | | | | | | | | | | | - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [X] These changes fix #35390 - [X] There are tests for these changes [Successful WPT run](https://github.com/reesmichael1/servo/actions/runs/14097679625) (which includes the new test files) (I didn't make the formatting changes intentionally--those came from `mach format` following `mach test-tidy`.) --------- Signed-off-by: Michael Rees <mrees@noeontheend.com>