aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom
Commit message (Collapse)AuthorAgeFilesLines
...
* script: Implement input preprocessing for URLPatterns (#36225)Simon Wülker2025-04-041-51/+685
| | | | | | | | | | | | 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>
* Implement TestUtils (#36301)Sebastian C2025-04-042-0/+50
| | | | | | | | | | | | | | | | 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-0415-106/+113
| | | | | | | | | | | | | | | | | | | | 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>
* 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-047-48/+43
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (#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-0422-345/+349
| | | | | | | | | | | | | 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>
* webgpu: Add a `webgpu_traits` crate (#36320)Martin Robinson2025-04-0428-56/+65
| | | | | | | | | | | | | | | 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>
* Move generated bindings to script_bindings (#36323)Josh Matthews2025-04-0418-2455/+59
| | | | | | | | | | | | | | | | | | | | | 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>
* script: Implement deprecated CSSStyleSheet members (#36313)Oriol Brufau2025-04-031-3/+46
| | | | | | | | | | | | | | | | | | | | | | | Implements `rules`, `addRule()` and `removeRule()` for `CSSStyleSheet`. https://drafts.csswg.org/cssom/#legacy-css-style-sheet-members This is part of #36162 Testing: - `/css/css-cascade/at-scope-parsing.html` - `/css/css-conditional/at-supports-whitespace.html` - `/css/css-nesting/invalidation-004.html` - `/css/css-nesting/parsing.html` - `/css/css-nesting/serialize-group-rules-with-decls.html` - `/css/css-syntax/custom-property-rule-ambiguity.html` - `/css/css-syntax/invalid-nested-rules.html` - `/css/css-syntax/trailing-braces.html` - `/css/css-syntax/var-with-blocks.html` - `/css/css-transitions/parsing/starting-style-parsing.html` - `/css/cssom/CSSStyleSheet.html` - `/css/cssom/idlharness.html` - `/css/cssom/insertRule-across-context.html` Signed-off-by: Oriol Brufau <obrufau@igalia.com>
* Support single-value `<select>` elements (#35684)Simon Wülker2025-04-036-89/+334
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | https://github.com/user-attachments/assets/9aba75ff-4190-4a85-89ed-d3f3aa53d3b0 Among other things this adds a new `EmbedderMsg::ShowSelectElementMenu` to tell the embedder to display a select popup at the given location. This is a draft because some small style adjustments need to be made: * the select element should always have the width of the largest option * the border should be part of the shadow tree Apart from that, it's mostly ready for review. <details><summary>HTML for demo video</summary> ```html <html> <body> <select id="c" name="choice"> <option value="first">First Value</option> <option value="second">Second Value</option> <option value="third">Third Value</option> </select> </body> </html> ``` </details> --- <!-- 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] Part of https://github.com/servo/servo/issues/3551 - [ ] There are tests for these changes OR - [ ] These changes do not require tests because ___ <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> --------- Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
* Use Window in new methods instead of GlobalScope for interfaces with … ↵Richard Dushime2025-04-0237-235/+221
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (#36133) …Window-only constructors <!-- 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 - [x] These changes fix #36118 (GitHub issue number if applicable) <!-- Either: --> - [ ] There are tests for these changes OR - [ ] These changes do not require tests because ___ <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> --------- Signed-off-by: richarddushime <mudaherarich@gmail.com> Signed-off-by: Richard Dushime <45734838+richarddushime@users.noreply.github.com>
* script: Create `CSSStyleOwner::Null` for `getComputedStyle` (#36272)Martin Robinson2025-04-022-3/+68
| | | | | | | | | | | | | | | | | | | | This new `CSSStyleOwner` variant is used when the pseudo-element argument fails to parse properly or is for some unknown or unsupported pseudo-element. Testing: There are tests for this change. Various tests start to pass and some start to fail. New failures are due to partial or fully missing support for pseudo-elements such as: - `::selection` - `::first-letter` and `::first-line` - `::marker` 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>
* dom: Firing "click" event as synthetic pointer event (#36274)Andrei Volykhin2025-04-025-53/+73
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | According to specification https://html.spec.whatwg.org/multipage/webappapis.html#fire-a-click-event "Firing a click event at target means firing a synthetic pointer event named click at target" So need to replace synthetic mouse event with "click" type to pointer event. https://w3c.github.io/pointerevents/#the-click-auxclick-and-contextmenu-events https://www.w3.org/TR/uievents/#event-type-click Firing "click" event could be triggered from script or by UA: - element.click() (https://html.spec.whatwg.org/multipage/interaction.html#dom-click) - form implicit submission (https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#implicit-submission) - keyboard activation (space) --- - [x] ./mach build -d does not report any errors - [x] ./mach test-tidy does not report any errors - [x] There are tests for these changes tests/wpt/tests/shadow-dom/event-composed.html tests/wpt/tests/uievents/interface/click-event.htm Signed-off-by: Andrei Volykhin <andrei.volykhin@gmail.com>
* libservo: Start moving `WindowMethods` to `WebViewDelegate` (#36223)Martin Robinson2025-04-022-12/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `WindowMethods` is used by the embedding layer to get information from the embedder. This change moves the functionality for getting screen size and `WebView` offsets to `WebViewDelegate`. This is important because `WebView`s might be on different screens or have different offsets on the screen itself, so it makes sense for this to be per-`WebView` and not global to the embedder. HiDPI and animation state functionality will move to the embedder in subsequent changes. Signed-off-by: Martin Robinson <mrobinson@igalia.com> <!-- 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 - [x] These changes do not require tests because they just modify the `WebView` API surface a bit. <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> Signed-off-by: Martin Robinson <mrobinson@igalia.com>
* libservo: Remove a couple `EmbedderMethods` (#36276)Martin Robinson2025-04-018-26/+7
| | | | | | | | | | | | | | | | | | | | | | | - Remove `EmbedderMethods::get_user_agent_string`. This is now part of the `Preferences` data structure, which should allow it to be per-`WebView` in the future. - Remove `EmbedderMethods::get_version_string`. This was used to include some data along with WebRender captures about the Servo version. This isn't really necessary and it was done to replace code in the past that output the WebRender version, so also isn't what the original code did. I think we can just remove this entirely. The idea with these changes is that `EmbedderMethods` can be removed in a followup and the rest of the methods can be added to `ServoDelegate`. These two methods are ones that cannot be added to a delegate as they are used during `Servo` initialization. Testing: There is currently no testing for libservo. These changes are meant as preparation for adding a suite of `WebView` unit tests. Signed-off-by: Martin Robinson <mrobinson@igalia.com> Signed-off-by: Martin Robinson <mrobinson@igalia.com>
* Turn `CSSStyleRule` into a `CSSGroupingRule` subclass (#36254)Oriol Brufau2025-04-015-42/+82
| | | | | | | | | | | | | | | Note that `StyleRule` may not have the `CssRules` readily available, they may need to be created. So the previous approach of providing `CSSGroupingRule` with the `CssRules` is no good: it would require writing them in advance, just in case they end up being used. Therefore, this removes the `CSSGroupingRule::rules` field. Instead, they are lazily obtained in `CSSGroupingRule::rulelist()` by downcasting and calling the appropriate method for the subclass. Testing: covered by WPT Fixes: #36245 Signed-off-by: Oriol Brufau <obrufau@igalia.com>
* canvas: Implement line dash setters and getters (#36257)Steven Novaryo2025-04-013-0/+60
| | | | | | | | | | | Implement `setLineDash`, `getLineDash`, and `lineDashOffset` from `CanvasPathDrawingStyles` mixin, according to the spec https://html.spec.whatwg.org/multipage/canvas.html#canvaspathdrawingstyles. Testing: Existing WPT. --------- Signed-off-by: stevennovaryo <steven.novaryo@gmail.com>
* Implement CSSNestedDeclarations (#36248)Oriol Brufau2025-04-013-1/+101
| | | | | | | | | | | This is the CSSOM interface that represents a nested declarations rule. https://drafts.csswg.org/css-nesting/#the-cssnestrule Testing: `/_mozilla/mozilla/interfaces.https.html`. And once `CSSStyleRule` becomes a `CSSGroupingRule` subclass, this will be further covered by `/css/css-nestting/`. This is part of #36245 Signed-off-by: Oriol Brufau <obrufau@igalia.com>
* Fix null realm assertion when activating a service worker (#36256)Josh Matthews2025-04-011-3/+3
| | | | | | | | | | | Ensure there is an active realm when dispatching the `activation` DOM event to the ServiceWorker global. Testing: Existing WPT coverage. Fixes: #36114 Fixes: #36235 Fixes: #36231 Signed-off-by: Josh Matthews <josh@joshmatthews.net>
* script: Use `RegExpFlag_UnicodeSets` when validating regular expressions in ↵MDCODE2472025-04-011-3/+3
| | | | | | | | | | | | | | | `HTMLInputElement` (#36236) Changed `RegExpFlag_Unicode` to `RegExpFlag_UnicodeSets` in all instances. Testing: Ran `./mach test-wpt tests/wpt/tests/html/semantics/forms/constraints/form-validation-validity-patternMismatch.html` and all tests passed successfully. Fixes: #36075 --------- Signed-off-by: MDCODE247 <ammedabubakard500@gmail.com>
* Remove ServoParser::do_parse_sync (#36255)Simon Wülker2025-04-011-8/+0
| | | | | | The indirection through ServoParser::parse_sync does nothing, so the method can simply be called directly. Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
* dom: Set "composed" flag on construction for some event types (#36239)Andrei Volykhin2025-03-314-3/+12
| | | | | | | | | | | | | | | | | | | | "Composed" flag (https://dom.spec.whatwg.org/#composed-flag) should be properly set on event construction phase from optional "EventInit" dictionary (https://dom.spec.whatwg.org/#dom-eventinit-composed). The limited set of event types (Custom/Error/Focus/Mouse) will be affected by this CL (used in WPT tests). --- - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [X] There are WPT shadow-dom tests which have new issues related to event "relatedTarget" property tests/wpt/tests/shadow-dom/event-composed-path-with-related-target.html tests/wpt/tests/shadow-dom/event-with-related-target.html Signed-off-by: Andrei Volykhin <andrei.volykhin@gmail.com>
* script: Fix resize observer depth calculation for Shadow DOM. (#36230)Josh Matthews2025-03-311-1/+1
| | | | | | | | | Follow the specification more closely by using the flat tree when calculating depth for the resize observer. Testing: Newly passing WPT test. Fixes: #36092 Signed-off-by: Josh Matthews <josh@joshmatthews.net>
* Remove interior mutability from `ResizeObservation` (#36233)Simon Wülker2025-03-311-17/+16
| | | | | | This is struct is always already wrapped in a RefCell by `ResizeObserver`. It is not exposed to JS itself, so it doesn't need `RefCell`s. Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
* Only invoke resize observer callback when the observed element changed its ↵Simon Wülker2025-03-311-3/+41
| | | | | | | | | | | size (#36226) This change also adds a bunch of spec comments, because our ResizeObserver implementation deviates from the spec significantly in ways that are not immediately intuitive. Fixes https://github.com/servo/servo/issues/36096 Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
* More miscellaneous script splitting changes (#36220)Josh Matthews2025-03-3024-568/+165
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * script: Move HasParent to script_bindings and update imports for InheritTypes. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * script: Make principal creation generic over DOM interface. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * script: Move a bunch of proxy-related code to script_bindings. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * script: Make some proxy-related code generic over the DOM interface. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * script: Move DomSlice to script_bindings. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * script: Move some utility bindings code to script_bindings. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * script: Make enumerating and resolving globals generic over the DOM interface. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * script: Make realm helpers generic over the DOM interface. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * script: Move implementations on concrete DOM types to concrete bindings. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * script: Make additional codegen helpers generic over the DOM interface. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * script: Make iterator creation generic over the DOM interface. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * script: Make reporting an exception a generic operation. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * script: Move AsCCharPtrPtr to script_bindings. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * Formatting. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * Address clippy warnings. Signed-off-by: Josh Matthews <josh@joshmatthews.net> --------- Signed-off-by: Josh Matthews <josh@joshmatthews.net>
* Propagate CanGc arguments through HTMLCollection constructors (#36180)Kunga Derick Abongho2025-03-299-53/+117
| | | Signed-off-by: dericko681 <abonghoderick@gmail.com>
* resolve issue #36074 new_js_regex and matches_js_regex need a CanGc argument ↵Kunga Derick Abongho2025-03-2958-434/+598
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (#36111) * new_js_regex and matches_js_regex need a CanGc argument Signed-off-by: dericko681 <abonghoderick@gmail.com> * new_js_regex and matches_js_regex need a CanGc argument Signed-off-by: dericko681 <abonghoderick@gmail.com> * edit Propagate CanGc arguments through new_js_regex and matches_js_regex Signed-off-by: dericko681 <abonghoderick@gmail.com> * Propagate CanGc arguments through new_js_regex and matches_js_regex Signed-off-by: dericko681 <abonghoderick@gmail.com> * Propagate CanGc arguments through new_js_regex and matches_js_regex Signed-off-by: dericko681 <abonghoderick@gmail.com> * Propagate CanGc arguments through new_js_regex and matches_js_regex Signed-off-by: dericko681 <abonghoderick@gmail.com> --------- Signed-off-by: dericko681 <abonghoderick@gmail.com>
* Miscellaneous script splitting preparation changes (#36216)Josh Matthews2025-03-2918-764/+120
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * script: Move num module to script_bindings. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * script: Make JS reflector creation generic over DOM trait. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * script: Move bindings-specific lock to script_bindings. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * script: Move DOM proto array code to script_bindings. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * script: Move finalizer implementations to script_bindings. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * script: Move some error routines to script_bindings. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * script: Move some DOM interface conversion routines to script_bindings. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * script: Make is_array_like generic over DOM trait. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * script: Use generic interfaces for conditional exposure functions. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * script: Move a bunch of routines used by codegen to script_bindings. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * Formatting. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * Fix clippy warnings. Signed-off-by: Josh Matthews <josh@joshmatthews.net> --------- Signed-off-by: Josh Matthews <josh@joshmatthews.net>
* Remove redundant `rooted_vec` macro (#36214)Greg Morenz2025-03-292-17/+0
| | | | | | | | | | This macro was copied into mozjs in 2023, in servo/mozjs#352 The two versions are identical, and rooting infrastructure generally lives in mozjs. Let's not keep this redundant copy around. The mozjs version is already imported evyerwhere via `#[macro_use]`. Signed-off-by: Greg Morenz <greg-morenz@droid.cafe>
* dom: Track "removed" event listener status (#36163)Andrei Volykhin2025-03-282-97/+107
| | | | | | | | | | | | | | | | | The DOM event listener "removed" status should be supported to track the following situations (with immediate effect of listener removal): - Removing a later event listener while an earlier listener for the same event is running - Nested usage (recursively dispatch another event) of "once" listeners https://dom.spec.whatwg.org/#event-listener-removed During event dispatching requires to clone event listeners list on "invoke" step https://dom.spec.whatwg.org/#concept-event-listener-invoke and the lowercase "event listener" concept in Servo is EventListenerEntry https://dom.spec.whatwg.org/#concept-event-listener Bug: #25479, #25090 Signed-off-by: Andrei Volykhin <andrei.volykhin@gmail.com>
* Animation: Aggregate Animated Image Info to Document (#36141)TIN TUN AUNG2025-03-282-1/+17
| | | Signed-off-by: rayguo17 <rayguo17@gmail.com>
* Stop using `RootedGuard's` DerefMut impl (#36158)Greg Morenz2025-03-282-6/+7
| | | | | | | | | | | | | | | | | * Stop using RootedGuard's DerefMut impl Signed-off-by: Greg Morenz <greg-morenz@droid.cafe> * Update mozjs version Signed-off-by: Greg Morenz <greg-morenz@droid.cafe> * `self.bytes` should not be mutably borrowed over GC pause Signed-off-by: Greg Morenz <greg-morenz@droid.cafe> --------- Signed-off-by: Greg Morenz <greg-morenz@droid.cafe>
* fix: prevent missing value error for radio button inputs without a name (#36197)Barigbue Nbira2025-03-281-0/+3
| | | Signed-off-by: Barigbue <barigbuenbira@gmail.com>
* Replace some uses of window.global() with upcast. (#36179)Aniebiet Afia2025-03-271-1/+1
| | | Signed-off-by: aniebietafia <aniebietafia87@gmail.com>
* fix(parser): Set shadow’s available to element internals in ↵elomscansio2025-03-271-0/+3
| | | | | | | | | | | | | | | attach_declarative_shadow (#36173) Aligns the implementation with step 8.5 of the HTML spec for parsing a <template> element in the InHead state by setting shadow_root.set_available_to_element_internals(true) after assigning the shadow root to the template’s contents. Also removes tests/wpt/meta/shadow-dom/declarative/declarative-shadow-dom-available-to-element-internals.html.ini since the test expectations are now updated accordingly. Spec reference: https://html.spec.whatwg.org/multipage/#parsing-main-inhead Signed-off-by: Emmanuel Elom <elomemmanuel007@gmail.com>
* Start implementing the `URLPattern` API (#36144)Simon Wülker2025-03-273-5/+828
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Start working on a basic URLPattern implementation This is API part of Interop 2025, so we should definitely support it! This change implements the basic workflow for parsing and compiling URL patterns. Parts of it are stubbed out and will be implemented later. For now the API is preference-gated behind "dom_urlpattern_enabled". Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> * Preference-gate the URLPattern API Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> * Update WPT expectations Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> * Fix full wildcard value (Should be ".*" not "*") Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> --------- Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
* Allow setting userscripts directly without the need of files (#35388)Tony2025-03-272-31/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Allow settings userscripts through preferences Signed-off-by: Tony <legendmastertony@gmail.com> * mach fmt instead of cargo fmt Signed-off-by: Tony <legendmastertony@gmail.com> * Fix pref loading not working for array values Signed-off-by: Tony <legendmastertony@gmail.com> * Use pref! in userscripts instead Signed-off-by: Tony <legendmastertony@gmail.com> * Implement the model jdm suggested - Remove userscripts from all places and move it to servoshell - Add in `UserContentManager` struct and passing it through `Servo::new` all the way down to script thread Signed-off-by: Tony <legendmastertony@gmail.com> * Apply suggestions from code review and format Signed-off-by: Tony <legendmastertony@gmail.com> * Revert unrelated change Signed-off-by: Tony <legendmastertony@gmail.com> --------- Signed-off-by: Tony <legendmastertony@gmail.com> Signed-off-by: Tony <68118705+Legend-Master@users.noreply.github.com>
* Make DOMPoint and DOMPointReadOnly serializable (#35989)Josh Matthews2025-03-278-12/+157
| | | | | | | | | | | | | | | | | | | | | | | * script: Make DOMPointReadOnly serializable. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * script: Make DOMPoint serializable. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * script: Shrink worker script event. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * Update components/script/dom/dompoint.rs Co-authored-by: Martin Robinson <mrobinson@igalia.com> Signed-off-by: Josh Matthews <josh@joshmatthews.net> --------- Signed-off-by: Josh Matthews <josh@joshmatthews.net> Co-authored-by: Martin Robinson <mrobinson@igalia.com>
* script: Expose new methods for obtaining a global that require a realm. (#36116)Josh Matthews2025-03-265-17/+27
| | | Signed-off-by: Josh Matthews <josh@joshmatthews.net>
* Add `Path2D` (#35783)Lukas Lihotzki2025-03-265-0/+381
| | | Signed-off-by: Lukas Lihotzki <lukas@lihotzki.de>
* Stop using MutableHandle's DerefMut impl (#36160)Greg Morenz2025-03-261-2/+2
| | | Signed-off-by: Greg Morenz <greg-morenz@droid.cafe>
* Stop using JS::MutableHandle's DerefMut impl (#36161)Greg Morenz2025-03-261-1/+1
| | | Signed-off-by: Greg Morenz <greg-morenz@droid.cafe>
* Fix check in get_array_index_from_id to return early on ASCII char (#36136)Michael Rees2025-03-251-1/+1
| | | | | | | | | | | | | * fix: wrong ascii check in get_array_index_from_id Signed-off-by: Michael Rees <mrees@noeontheend.com> * Update WPT expectations Signed-off-by: Michael Rees <mrees@noeontheend.com> --------- Signed-off-by: Michael Rees <mrees@noeontheend.com>
* feat: add CanGc argument in get_dictionary_property (#36156)Arya Nair2025-03-254-9/+22
| | | | | | | | | | | | | * feat: add CanGc argument in get_dictionary_property Signed-off-by: Arya Nair <aryaajitnair@gmail.com> * feat: add CanGc argument in get_dictionary_property Signed-off-by: Arya Nair <aryaajitnair@gmail.com> --------- Signed-off-by: Arya Nair <aryaajitnair@gmail.com>
* script: Support converting JS values to Rc<Promise> with ↵Josh Matthews2025-03-252-1/+23
| | | | | FromJSValConvertible. (#36097) Signed-off-by: Josh Matthews <josh@joshmatthews.net>
* canvas: Update the image as part of update the rendering (#35996)sagudev2025-03-255-16/+48
| | | | | | | | | | | | | | | | | | | | | | | * Create `update_rendering` in `CanvasState` instead of manually updating in layout Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> * Mark as dirty and do flushes Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> * fixup rebase Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> * Update components/script/dom/htmlcanvaselement.rs Co-authored-by: Martin Robinson <mrobinson@igalia.com> Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> --------- Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> Co-authored-by: Martin Robinson <mrobinson@igalia.com>
* feat(notification): add `EmbedderMsg::ShowNotification` (#36055)Jason Tsai2025-03-241-18/+80
| | | Signed-off-by: Jason Tsai <git@pews.dev>
* fix: radio input element don't trigger validity state (#36103)Jerens Lensun2025-03-231-2/+4
| | | Signed-off-by: jerensl <54782057+jerensl@users.noreply.github.com>
* script: Implement `Element::GetHTML` and `ShadowRoot::GetHTML` (#36106)Simon Wülker2025-03-235-96/+265
| | | | | | | | | | | | | | | | | | | | | * Serialize html fragments without going through html5ever Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> * Implement ShadowRoot::GetHtml / Element::GetHtml Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> * Update WPT expectations Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> * Propagate CanGc annotations Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> --------- Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>