Commit graph

78 commits

Author SHA1 Message Date
Andrei Volykhin
1f5087d773
imagebitmap: Make ImageBitmap serializable and transferable (#37101)
According to specification ImageBitmap objects are serializable objects
and transferable objects.

https://html.spec.whatwg.org/multipage/#the-imagebitmap-interface:imagebitmap-11

Testing:
 - html/canvas/element/manual/imagebitmap/*
 - html/infrastructure/safe-passing-of-structured-data/*
 - html/webappapis/structured-clone/*
 - workers/semantics/structured-clone/*

Signed-off-by: Andrei Volykhin <andrei.volykhin@gmail.com>
2025-05-23 20:40:25 +00:00
Simon Wülker
fcc391d852
Allow undefined variants in IDL unions (#37042)
Testing: Includes a test which ensures that unions with a `undefined`
variant compile
Fixes https://github.com/servo/servo/issues/28679
Part of https://github.com/servo/servo/issues/30287

---------

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
2025-05-23 16:16:22 +00:00
Taym Haddadi
5b2305784a
Stream implement pipeThrough (#36977)
Part of https://github.com/servo/servo/issues/34676

https://github.com/servo/servo/pull/36905 needs to be merged first.

---------

Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com>
2025-05-20 14:33:22 +00:00
Simon Wülker
e2424fcec7
Remove the dom_shadowdom_enabled preference (#37043)
The preference was enabled by default in early march 2025, but was kept
around in case something major breaks
(https://github.com/servo/servo/pull/35899#discussion_r1988222297).

In the time since, no major bugs have been reported:
* https://github.com/servo/servo/issues/36722 is a bug in the UA shadow
tree, not the shadow dom itself. It's also independent of the
preference.
* https://github.com/servo/servo/issues/36273 looks like it *might* be
related to the shadow DOM, but it also requires experimental features so
it might be caused by something else entirely.

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
2025-05-18 17:42:21 +00:00
Simon Wülker
edea2caec1
Make getAllTypes unwrap IDL record<K, V> types (#37039)
IDL `record` types can themselves contain types that are not described
anywhere else. An example is in
https://github.com/servo/servo/issues/37038, where the `record` contains
a definition of a union. These inner types must be returned from
`getAllTypes`, otherwise we won't generate code for them.

This PR also adds a few type annotations. I can remove them if
requested, but I think they're helpful.

Testing:  Includes a regression test
Fixes: https://github.com/servo/servo/issues/37038

---------

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
2025-05-18 09:30:20 +00:00
Josh Matthews
a028291466
Don't build testbinding-related code by default (#37034)
Disabling the TestBinding-related bindings and implementations saves 2mb
in a release build. Also, we lost the related test preferences when we
turned the layout-2020 tests on, so the tests have all been failing for
a long time.

Testing: Existing tests in CI.

---------

Signed-off-by: Josh Matthews <josh@joshmatthews.net>
2025-05-17 08:14:19 +00:00
Tim van der Lippe
c985c08737
Implement iframe.srcdoc trusted type sink (#36960)
Part of https://github.com/servo/servo/issues/36258

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

Signed-off-by: Tim van der Lippe <tvanderlippe@gmail.com>
2025-05-13 21:07:13 +00:00
Andrei Volykhin
6468734aea
svg: Add mock SVGImageElement interface (#36975)
Add mock SVGImageElement interface to fix TIMEOUT WPT tests
which are related to ImageBitmap (html/canvas/*).
https://svgwg.org/svg2-draft/embedded.html#InterfaceSVGImageElement

Rationality of this change to fire event "error" on any attempt to fetch
image resource on href attribute change to not block WPT tests
execution.

Some WPT tests use the legacy namespace attribute "xlink:href", so
support for it was added to source code.
https://svgwg.org/svg2-draft/linking.html#XLinkHrefAttribute
 - setAttributeNS("http://www.w3.org/1999/xlink", 'xlink:href', src);

Testing: Covered by existed WPT tests
 - fetch/metadata/generated/svg-image*
 - html/canvas/element/manual/*
 - html/dom/idlharness.https.html
 - html/semantics/embedded-content/the-canvas-element/*
 - html/webappapis/scripting/events/event-handler-all-global-events.html
 - mozilla/interfaces.https.html

Fixes: https://github.com/servo/servo/issues/35881

Signed-off-by: Andrei Volykhin <andrei.volykhin@gmail.com>
2025-05-13 10:43:10 +00:00
Tim van der Lippe
d780fb7695
Implement trusted HTML sinks for Element (#36941)
Also implements a conversion for `TrustedHTMLOrNullIsEmptyString`
to `TrustedHTMLOrString` to avoid introducing a separate
`get_trusted_script_compliant_string` for the new type.

Part of #36258

Signed-off-by: Tim van der Lippe <tvanderlippe@gmail.com>
2025-05-12 10:53:03 +00:00
Keith Yeung
da1c49299b
Update the list of global and window event handlers (#36894)
There's an expanded list of event handlers content attributes that need
to be forwarded to the corresponding window of the body element, and
this PR adds the remaining ones. The full list can be seen in [this
link](https://html.spec.whatwg.org/multipage/webappapis.html#event-handlers-on-elements%2C-document-objects%2C-and-window-objects%3Aevent-handlers-6).

Testing: Covered by various WPT tests

---------

Signed-off-by: Keith Yeung <kungfukeith11@gmail.com>
2025-05-10 15:54:13 +00:00
Taym Haddadi
e5347eceac
WebIDL Fix ImageData constructor to take a Uint8ClampedArray instead of js_object (#31398)
<!-- Please describe your changes on the following line: -->

Fix ImageData constructor to take a Uint8ClampedArray instead of
js_object

---
<!-- 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 #31320

<!-- Either: -->
- [x] These changes do not require tests because there is not behavior
change.

<!-- 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: Taym Haddadi <haddadi.taym@gmail.com>
2025-05-09 11:05:56 +00:00
Taym Haddadi
f3f4cc5500
Script implement TransformStream and TransformStreamDefaultController (#36739)
Part of https://github.com/servo/servo/issues/34676

---------

Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com>
Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com>
Signed-off-by: Taym <haddadi.taym@gmail.com>
Co-authored-by: gterzian <2792687+gterzian@users.noreply.github.com>
2025-05-08 08:45:57 +00:00
Gae24
5b913441d4
async clipboard: implement readText (#36689)
part of #36084
Testing: Only idl harness tests will pass for now

---------

Signed-off-by: Gae24 <96017547+Gae24@users.noreply.github.com>
2025-05-07 15:11:37 +00:00
Josh Matthews
f47e69c112
Improve some webdriver conformance tests results (#36673)
These changes allow test_dom_token_list from
/execute_script/collections.py to pass, and various tests in
/execute_script/arguments.py to expose new failures.

Testing: Not run in CI yet, but verified results from
tests/wpt/tests/webdriver/tests/classic/{execute_script,execute_async_script}
locally.
Fixes: #35738

---------

Signed-off-by: Josh Matthews <josh@joshmatthews.net>
2025-05-07 07:22:29 +00:00
Simon Wülker
03abec4148
Replace urlpattern implementation with rust-urlpattern crate (#36826)
This change implements the full URLPattern API using
https://github.com/denoland/rust-urlpattern, except the two most
important functions (`test` and `exec`). These two are blocked on
https://github.com/servo/servo/issues/28679 due to this union:
539ca27284/components/script_bindings/webidls/URLPattern.webidl (L61).

Testing: Covered by existing web platform tests
Makes https://github.com/servo/servo/pull/36421 obsolete

---------

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
2025-05-06 09:42:55 +00:00
Jimmy D. Buckets
1f6050f931
Implement document.scrollingElement (#35994)
<!-- Please describe your changes on the following line: -->
This implements `document.scrollingElement`
(https://drafts.csswg.org/cssom-view/#dom-document-scrollingelement).

---
<!-- 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 #35700
- [x] There are tests for these changes

<!-- 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: JimmyDdotEXE <50691404+JimmyDdotEXE@users.noreply.github.com>
2025-05-05 12:50:42 +00:00
Tim van der Lippe
1e8896800a
Implement Trusted types worker sinks (#36811)
Part of #36258

Built on top of #36668

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

Signed-off-by: Tim van der Lippe <tvanderlippe@gmail.com>
2025-05-04 17:05:07 +00:00
Tim van der Lippe
c00e0aae61
Implement Trusted types document write sinks (#36824)
Implements the Document.write algorithm covering
Trusted HTML.

Part of #36258

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

Signed-off-by: Tim van der Lippe <tvanderlippe@gmail.com>
2025-05-04 11:50:33 +00:00
Tim van der Lippe
4164f76769
Implement all trusted sinks in HTMLScriptElement (#36668)
As a follow-up to the recent introduction of `script.src`
as trusted sink, this PR refactors machinery to also
support `TrustedScript`. In doing so, all trusted sinks
in `HTMLScriptElement` are now covered.

Instead of calling the callbacks in `policy.createX`,
we now have a `TrustedType` enum that specifies which callback
to invoke. Unfortunately we still have the `USVString` vs
`DOMString` problem, which is why we need to `.map` twice
to retrieve the backing `String` and avoid two different
types.

Additionally, I saw that `script.text` should have called
the "String replace all" algorithm rather than setting the
child contents. So that's also now fixed.

Part of #36258
Requires servo/html5ever#608

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

Signed-off-by: Tim van der Lippe <tvanderlippe@gmail.com>
2025-05-03 08:35:46 +00:00
Kelechi Ebiri
1a3f10bba4
feat: implement ShadowRoot::setHTMLUnsafe (#36240)
Implements #36166

---------

Signed-off-by: TG <ebiritg@gmail.com>
2025-05-01 15:19:41 +00:00
Gregory Terzian
af5d665efa
MessagePort: implement disentanglement (#36654)
Implement
[disentangle](https://html.spec.whatwg.org/multipage/#disentangle)
Remove bespoke gc logic which now becomes unnecessary. 
Adds a wpt test that hits the "disentangle while in transfer" logic.
Updates streams code, fixing an error where disentanglement is
conditional on an error.

Test coverage: there are existing tests in
`/webmessaging/message-channels/close-event/explicitly-closed.tentative.window.js`
for the no transfer case, and the simple completed transfer case, and
this PR adds a test for the more complicated transfer in progress case.

Fix https://github.com/servo/servo/issues/36465

---------

Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com>
2025-04-30 10:49:38 +00:00
Fuguo
0c0ee04b8e
Improve inter-document focus handling (#36649)
*Describe the changes that this pull request makes here. This will be
the commit message.*
rewritten the PR #28571
Implement
[Window#focus](https://html.spec.whatwg.org/multipage/#dom-window-focus),
[Window#blur](https://html.spec.whatwg.org/multipage/#dom-window-blur)
Testing: WPT
Fixes: #8981 #9421

---------

Signed-off-by: kongbai1996 <1782765876@qq.com>
Co-authored-by: yvt <i@yvt.jp>
2025-04-30 04:37:53 +00:00
Sebastian C
281d942981
Implement static Response.json (#36589)
Implements https://fetch.spec.whatwg.org/#dom-response-json
Restructured the constructor to follow the spec more closely with a
separate "initialize the response" algorithm.

Testing: There are existing WPT tests for this.

---------

Signed-off-by: Sebastian C <sebsebmc@gmail.com>
2025-04-25 08:49:21 +00:00
Josh Matthews
dc0c067c9b
Report exceptions for async script executions to webdriver (#27041)
Improving the accuracy of the async script execution for our webdriver
implementation allows us to run many more webdriver tests without
timeouts, which should help with
https://github.com/web-platform-tests/wpt/issues/24257.

Specification:
* https://w3c.github.io/webdriver/#dfn-clone-an-object
* https://w3c.github.io/webdriver/#execute-async-script

---
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes fix #27036 and fix #27035 and fix #27031.
- [x] There are tests for these changes (but we don't run them in CI
yet)

---------

Signed-off-by: Josh Matthews <josh@joshmatthews.net>
2025-04-25 06:50:00 +00:00
webbeef
30fdf48ca6
Implement CSSStyleSheet::replaceSync (#36586)
Implements the `replaceSync` method on CSSStyleSheet

Testing: Covered by wpt tests. Expectations are updated.

Signed-off-by: webbeef <me@webbeef.org>
2025-04-23 15:29:01 +00:00
Tim van der Lippe
6bb087e381
Implement trusted types url setter (#36596)
We now check the sink of script.src for trusted types. This is the first
attribute that we check, other sinks will be implemented in follow-up
changes.

The algorithms currently hardcode various parts. That's because I need
to refactor a couple of algorithms already present in TrustedTypePolicy.
They use callbacks at the moment, which made sense for their initial
use. However, for these new algorithms they don't work. Therefore, I
will align them with the specification by taking in an enum. However,
since that's a bigger refactoring, I left that out of this PR (which is
already quite big).

The other trusted types support (createScript and createHTML) will also
be implemented separately.

Part of #36258

---------

Signed-off-by: Tim van der Lippe <tvanderlippe@gmail.com>
Signed-off-by: Tim van der Lippe <TimvdLippe@users.noreply.github.com>
Co-authored-by: Josh Matthews <josh@joshmatthews.net>
2025-04-21 06:56:40 +00:00
Josh Matthews
76ee127af8
Eagerly define interfaces on non-Window globals (#36604)
These changes make us match Gecko's setup for how Window and non-Window
globals are initialized. Since Window globals are much more common than
Worker globals, using lazy interface definitions can be a useful memory
optimization at the expense of increased complexity for property
lookups.

Also adds the MayResolve hook for all globals, which is an optimization
for the JIT to avoid calling resolve hooks unnecessarily.

Testing: Existing test coverage on global interfaces should suffice.

---------

Signed-off-by: Josh Matthews <josh@joshmatthews.net>
2025-04-21 03:32:21 +00:00
Siddhant N Trivedi
7ee9d07a9a
content/dom: set navigator.onLine attribute to true (#36560)
Sets the navigator.onLine attribute to true.

Testing:
Ran `./mach run https://pinterest.com
--enable-experimental-web-platform-features`. This doesn't show the
"Hmm..you're not connected to the internet" text anymore.
<img width="1027" alt="Screenshot 2025-04-16 at 11 31 02 AM"
src="https://github.com/user-attachments/assets/3745077b-dc51-42ce-88a0-38d5f157fc0c"
/>


part of: #36554

---------

Signed-off-by: Siddhant N. Trivedi <sidntrivedi012@gmail.com>
Signed-off-by: Siddhant N Trivedi <sidntrivedi012@gmail.com>
Co-authored-by: Josh Matthews <josh@joshmatthews.net>
2025-04-19 01:34:13 +00:00
TIN TUN AUNG
f5e6eb289a
media element: support seekable attribute (#36541)
support seekable attribute in `htmlmediaelement`, modify `seek`
algorithm to use `seekable` attribute.

related
[specs](https://html.spec.whatwg.org/multipage/media.html#dom-media-seekable)
Testing: Run WPT Test
Fixes: https://github.com/servo/servo/issues/22297

Will wait for https://github.com/servo/media/pull/435 before turning
this to ready for review.
cc @jdm @xiaochengh

Signed-off-by: rayguo17 <rayguo17@gmail.com>
2025-04-16 05:52:19 +00:00
Andrei Volykhin
6b38289584
canvas: Add "EnforceRange" attribute to CanvasImageData interface (#36546)
Add missing "EnforceRange" attribute to interface methods
https://html.spec.whatwg.org/multipage/canvas.html#canvasimagedata

--
- [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/html/canvas/element/pixel-manipulation/2d.imageData*
tests/wpt/tests/html/canvas/offscreen/pixel-manipulation/2d.imageData*

Signed-off-by: Andrei Volykhin <andrei.volykhin@gmail.com>
2025-04-15 14:44:44 +00:00
Oriol Brufau
10f6f50c61
script: Implement CSSStyleSheet constructor (#36521)
https://drafts.csswg.org/cssom/#dom-cssstylesheet-cssstylesheet

Testing: covered by WPT
This is part of #36162

Signed-off-by: Oriol Brufau <obrufau@igalia.com>
2025-04-15 14:05:13 +00:00
Tim van der Lippe
440739090f
Gate window.trustedTypes behind flag (#36511)
This was missed in #36355 and should have also been gated by the flag.
With these, the wpt.fyi tests should now no longer pass, as the flag
hasn't been removed yet.

Signed-off-by: Tim van der Lippe <tvanderlippe@gmail.com>
2025-04-14 14:19:59 +00:00
Gae24
2bab5d8d52
async clipboard: implement writeText (#36498)
Implement enough of the Clipboard API to have a working `writeText`.

Testing: Unfortunately many clipboard-apis tests require testdriver, so
only idlharness ones will pass now.

---------

Signed-off-by: Gae24 <96017547+Gae24@users.noreply.github.com>
2025-04-14 13:49:43 +00:00
Tim van der Lippe
dcc88b53aa
Implement "Create a Trusted Type" algorithm (#36454)
This algorithm is quite straightforward written in the specification,
but leads to some type awkwardness in Rust. Most notably, the callbacks
have different types and cannot be unified easily. They also return
different string types. Similarly, the returning objects are all unique
types and don't have a common denominator.

Therefore, rather than implementing it in 1-to-1 fashion with the
specification text, it instead uses callbacks to instruct the type
system of what to call when.

This is further complicated by the fact that the callback can exist
or not, as well as return a value or not. This requires multiple
unwrangling, combined with the fact that the algorithm should throw
or not.

All in all, the number of lines is relatively low compared to the
specification algorithm and the Rust compiler does a lot of heavy
lifting figuring out which type is what.

Part of https://github.com/servo/servo/issues/36258

Signed-off-by: Tim van der Lippe <tvanderlippe@gmail.com>
Co-authored-by: Josh Matthews <josh@joshmatthews.net>
2025-04-13 03:55:23 +00:00
Sebastian C
85bd0918f2
Update ProgressEvent to use doubles (#36487)
See: https://github.com/whatwg/xhr/pull/394

Testing: WPT tests exist for this

Signed-off-by: Sebastian C <sebsebmc@gmail.com>
2025-04-13 01:41:39 +00:00
TIN TUN AUNG
972ca77ce1
dom: should change media element's currentSrc to children source element's src in resource selection algorithm. (#36408)
Set the `htmlmediaelement`'s `currenSrc` in
resource-selection-algorithm.
Change the `htmlsourceelement`'s src and srcset to USVString type.

According to
[Spec](https://html.spec.whatwg.org/multipage/media.html#concept-media-load-algorithm),
Step 9.3 for mode is children, should set the `currentSrc` to `src` of
children `htmlsourceelement`.
Also, In the `htmlsourceelement` [interface
definition](https://html.spec.whatwg.org/multipage/embedded-content.html#the-source-element),
the `src` and `srcset` attribute should be type `USVString`.

Testing: More WPT tests related to resource selection algorithm are
passing.
Fix: Some spec fix

[Try](1434753561)
cc @xiaochengh

Signed-off-by: rayguo17 <rayguo17@gmail.com>
2025-04-11 06:32:34 +00:00
Oriol Brufau
2d40fb7fe2
Implement disabled attribute for <link rel="stylesheet"> (#36446)
Adds support for both the content and the IDL attribute.
Note this doesn't cover dynamic updates to `document.styleSheets` and
the owner node of the sheet.

Testing: Covered by WPT
Fixes: #26739

Signed-off-by: Oriol Brufau <obrufau@igalia.com>
2025-04-10 16:28:01 +00:00
Gae24
d1243a1867
dom: Implement ClipboardItem (#36336)
implement the `ClipboardItem` interface

Testing: covered by existing wpt tests

part of #36084

---------

Signed-off-by: Gae24 <96017547+Gae24@users.noreply.github.com>
2025-04-06 23:47:57 +00:00
Tim van der Lippe
b87bf0b806
Stub out Trusted Types interfaces (#36355)
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>
2025-04-05 13:08:56 +00:00
Sebastian C
d93dad7f49
Implement TestUtils (#36301)
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>
2025-04-04 19:42:28 +00:00
Oriol Brufau
f29c182929
script: Implement deprecated CSSStyleSheet members (#36313)
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>
2025-04-03 15:56:47 +00:00
Oriol Brufau
0cdc1dcf72
Turn CSSStyleRule into a CSSGroupingRule subclass (#36254)
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>
2025-04-01 19:18:07 +00:00
Steven Novaryo
a77592e281
canvas: Implement line dash setters and getters (#36257)
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>
2025-04-01 11:22:00 +00:00
Oriol Brufau
bc6926d1fe
Implement CSSNestedDeclarations (#36248)
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>
2025-04-01 11:20:46 +00:00
Josh Matthews
c30ad5a30e
Miscellaneous script splitting preparation changes (#36216)
* 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>
2025-03-29 08:11:27 +00:00
Simon Wülker
517f99e067
Start implementing the URLPattern API (#36144)
* 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>
2025-03-27 10:39:57 +00:00
Lukas Lihotzki
251eeb2c2d
Add Path2D (#35783)
Signed-off-by: Lukas Lihotzki <lukas@lihotzki.de>
2025-03-26 12:12:44 +00:00
Josh Matthews
f717f6b848
script: Support converting JS values to Rc<Promise> with FromJSValConvertible. (#36097)
Signed-off-by: Josh Matthews <josh@joshmatthews.net>
2025-03-25 14:08:45 +00:00
Simon Wülker
19d5f5f06f
script: Implement Element::GetHTML and ShadowRoot::GetHTML (#36106)
* 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>
2025-03-23 19:04:23 +00:00
Josh Matthews
4814cbdb1f
script: Ensure promises are considered DOM interfaces when generating bindings. (#36107)
Signed-off-by: Josh Matthews <josh@joshmatthews.net>
2025-03-23 17:53:57 +00:00