Commit graph

10524 commits

Author SHA1 Message Date
Simon Wülker
8f1c23692e
Create a parser for URLPatterns (#36382)
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>
2025-04-07 18:08:22 +00:00
Martin Robinson
2b63e60e8f
layout: Add initial support for the ::marker pseudo-element (#36317)
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>
2025-04-07 17:49:05 +00:00
Manuel Rego
777b74252a
wpt: Unskip acid folder as most tests are passing (#36340)
Signed-off-by: Manuel Rego Casasnovas <rego@igalia.com>
2025-04-07 15:46:41 +00:00
Euclid Ye
3242592f34
Fix transition toggle & cancellation & delay (#35978)
More details in Stylo PR: https://github.com/servo/stylo/pull/145

---
<!-- 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 
- fixes https://github.com/servo/servo/issues/35833
- fixes https://github.com/servo/servo/issues/35982

<!-- Either: -->
- [x] There are new passing test: `css/css-logical/animation-004.html:
Transitions from physical to logical update when the direction is
changed`

Created new test files as well: 

1. `css-transitions/transition-remove-and-change-immediate.html`
2.  `css-transitions/transition-zero-duration-with-delay.html`
3. `css-transitions/transitioncancel-003.html`

<!-- 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. -->

cc @Asun0204  @xiaochengh @stevennovaryo

Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com>
2025-04-07 14:51:32 +00:00
ToBinio
4f41354349
layout: Scale images in image_set by their specified resolution (#36374)
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>
2025-04-07 13:54:29 +00:00
Oriol Brufau
3e249c9bc4
Enable layout_container_queries_enabled on all WPT tests (#36348)
This feature is part of --enable-experimental-web-platform-features, so
it should be enabled on all tests.

It's not really implemented beyond parsing, but it should be safe to
enable. It mostly changes test results from ERROR to FAIL.

This is part of #36315

Signed-off-by: Oriol Brufau <obrufau@igalia.com>
2025-04-07 11:43:11 +00:00
Simon Wülker
0a4174ad0e
Add a tokenizer for URLPatterns (#36362)
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>
2025-04-07 06:25:32 +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
elomscansio
1f558a0d49
Fix radio group validity update when removing or selecting an input (#36252)
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>
2025-04-06 23:26:15 +00:00
Servo WPT Sync
bd43b78735
Sync WPT with upstream (06-04-2025) (#36369)
Automated downstream sync of changes from upstream as of 06-04-2025
[no-wpt-sync]

Signed-off-by: WPT Sync Bot <ghbot+wpt-sync@servo.org>
2025-04-06 04:11:16 +00:00
saku
b4fd9ebb0e
Fix: Add support for stylesheet MIME type quirk in quirks mode (#36338)
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>
2025-04-06 00:28:35 +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
76edcff202
Check all ancestor navigable trustworthiness for mixed content (#36157)
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>
2025-04-05 05:38:24 +00:00
Josh Matthews
944e795606
constellation: Only return focused browsing contexts that exist. (#36330)
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>
2025-04-04 21:41:14 +00:00
Tim van der Lippe
ad95a602f8
Run Trusted Types tests (#36354)
To set a baseline of test expectations prior to implementation.

Part of #36258

Signed-off-by: Tim van der Lippe <tvanderlippe@gmail.com>
2025-04-04 21:02:16 +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
Manuel Rego
b4c1cdd3e7
wpt: Unskip webaudio tests as most are passing (#36334)
Signed-off-by: Manuel Rego Casasnovas <rego@igalia.com>
2025-04-04 14:12:40 +00:00
Manuel Rego
1f928252e3
wpt: Unskip old-tests/ folder as most tests are passing (#36333)
Signed-off-by: Manuel Rego Casasnovas <rego@igalia.com>
2025-04-04 11:05:24 +00:00
Oriol Brufau
202cac900d
layout: Restrict stretch alignment to flex items with computed auto size (#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>
2025-04-04 10:15:40 +00:00
Manuel Rego
c19c7b2ed8
wpt: Unskip css/css-text/i18n as many tests are passing there (#36314)
This patch unskips `css/css-text/i18n` WPT tests as many tests on that
folder are already passing in Servo.

Signed-off-by: Manuel Rego Casasnovas <rego@igalia.com>
2025-04-04 08:37:46 +00:00
Josh Matthews
277c0b82dd
Ignore cert errors when running wdspec tests. (#36327)
This change makes the wdspec configuration match our other browser
configurations to account for #30080.

Testing: Tested locally, since we don't run webdriver conformance tests
in CI yet. The STR from the issue do not reproduce the same problem any
longer.
Fixes: #36326.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>
2025-04-04 06:24:10 +00:00
Barigbue Nbira
e1de46c691
Fix: display: inline-grid considered an atomic inline (#36298)
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>
2025-04-03 19:48:19 +00:00
Oriol Brufau
e1213f9dbc
Enable layout_grid_enabled pref for all tests (#36316)
This is part of #36315
Testing: This improves several tests that rely on this feature

Signed-off-by: Oriol Brufau <obrufau@igalia.com>
2025-04-03 18:48:05 +00:00
Michael Rees
dfcd9de138
fix: root element not establishing stacking context (#35390) (#36174)
- [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](1409767962)
(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>
2025-04-03 17:30:42 +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
9d6e1f67fb
layout: Improve style conversion for Taffy (#36311)
This imports the following changes from Blitz:
- Map position:sticky to relative rather than absolute position
16a7c16544
- Map left and right alignment from Stylo
c71cc681d8
- Improve mapping of align-items/self
7bf2a25e75

Fixes: #35998

Testing:
-
`/css/css-grid/alignment/grid-align-justify-margin-border-padding.html`
- `/css/css-grid/alignment/grid-align.html`
-
`/css/css-grid/alignment/grid-column-axis-alignment-sticky-positioned-items-001.html`
- `/css/css-grid/alignment/grid-gutters-and-alignment.html`
-
`/css/css-grid/alignment/grid-item-alignment-with-orthogonal-flows.html`
-
`/css/css-grid/alignment/grid-row-axis-alignment-sticky-positioned-items-001.html`
- `/css/css-grid/alignment/grid-self-alignment.html`

Signed-off-by: Oriol Brufau <obrufau@igalia.com>
2025-04-03 15:47:56 +00:00
Simon Wülker
0e99539dab
Support single-value <select> elements (#35684)
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>
2025-04-03 12:11:55 +00:00
Martin Robinson
2ce306f450
script: Create CSSStyleOwner::Null for getComputedStyle (#36272)
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>
2025-04-02 13:54:42 +00:00
Oriol Brufau
1f13e8b596
layout: Allow collapsing bottom margins with any indefinite block size (#36278)
According to CSS2, the bottom margin of a block container can collapse
with the bottom margin of its last in-flow child if `height` computes to
`auto`.

However, according to CSS Sizing, that was "legacy spec prose" and
should be interpreted as "behaves as `auto`".

Therefore, cyclic percentages and intrinsic keywords like `min-content`
shouldn't prevent margin collapse, because they behave as `auto`.

This change aligns Servo with Gecko and Blink, but diverges from WebKit.

https://www.w3.org/TR/CSS22/box.html#collapsing-margins
https://www.w3.org/TR/css-sizing/#behave-auto

Testing:
-
`tests/wpt/tests/css/css-sizing/margin-collapse-with-indefinite-block-size-001.html`
-
`tests/wpt/tests/css/css-sizing/margin-collapse-with-indefinite-block-size-002.html`
-
`tests/wpt/tests/css/css-sizing/margin-collapse-with-indefinite-block-size-003.html`
-
`tests/wpt/tests/css/css-sizing/margin-collapse-with-indefinite-block-size-004.html`
-
`tests/wpt/tests/css/css-sizing/margin-collapse-with-indefinite-block-size-005.html`

Signed-off-by: Oriol Brufau <obrufau@igalia.com>
2025-04-02 12:10:04 +00:00
Andrei Volykhin
3bc0eeab8f
dom: Firing "click" event as synthetic pointer event (#36274)
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>
2025-04-02 11:20:25 +00:00
Tim van der Lippe
0d38d6239a
Remove meta-legacy-layout wpt tests (#36281)
These tests were related to the legacy layout engine which has been
removed.
Therefore, they are considered leftover and can be removed.

Fixes #36277

Signed-off-by: Tim van der Lippe <tvanderlippe@gmail.com>
2025-04-01 19:19:21 +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
Oriol Brufau
e8d5a019a4
Enable CSS parent selector (&) (#36249)
Bumps Stylo to servo/stylo#164
Changelog:
bc4717c784...600b5c4297

Testing: covered by WPT
This is part of https://github.com/servo/servo/issues/36245

Signed-off-by: Oriol Brufau <obrufau@igalia.com>
2025-04-01 09:08:18 +00:00
Josh Matthews
fcef1dff9d
Fix null realm assertion when activating a service worker (#36256)
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>
2025-04-01 08:13:02 +00:00
MDCODE247
be38c5478f
script: Use RegExpFlag_UnicodeSets when validating regular expressions in 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>
2025-04-01 07:29:24 +00:00
Oriol Brufau
77525cef84
Enable css-nesting WPT tests (#36246)
So that we can see the improvement when enabling the feature.

Testing: This PR enables tests
This is part of #36245

Signed-off-by: Oriol Brufau <obrufau@igalia.com>
2025-03-31 19:07:27 +00:00
Andrei Volykhin
f48c3a5e2a
dom: Set "composed" flag on construction for some event types (#36239)
"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>
2025-03-31 17:15:48 +00:00
Josh Matthews
7382efa209
script: Fix resize observer depth calculation for Shadow DOM. (#36230)
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>
2025-03-31 16:01:16 +00:00
Josh Matthews
ee95ef53fb
Enable service worker WPT tests. (#36221)
Signed-off-by: Josh Matthews <josh@joshmatthews.net>
2025-03-31 08:31:24 +00:00
Servo WPT Sync
c593e15fa8
Update web-platform-tests to revision b'efce5c7cd31b0e1add4f41758504c767b56abeed' (#36222)
Signed-off-by: WPT Sync Bot <ghbot+wpt-sync@servo.org>
2025-03-30 01:40:11 +00:00
chocolate-pie
987716ca4b
layout: Implement support for image-set() notation (#36210)
Signed-off-by: Chocolate Pie <106949016+chocolate-pie@users.noreply.github.com>
2025-03-29 13:20:16 +00:00
Martin Robinson
b5c8164e99
layout: Simplify and generalize the usage of pseudo-elements (#36202)
- Remove the last remaining Servo-specific PseudoElement enum from
  layout. This was made to select `::before` and `::after` (both eager
  pseudo-elements), but now `traverse_pseudo_element` is called
  `traverse_eager_pseudo_element` and should work on any eager pseudo
  element.
- Expose a single way of getting psuedo-element variants of
  ThreadSafeLayoutElement in the Layout DOM, which returns `None` when
  the pseudo-element doesn't apply (not defined for eager
  pseudo-elements or when trying to get `<details>` related
  pseudo-elements on elements that they don't apply to).
- Ensure that NodeAndStyleInfo always refers to a node. This is done by
  making sure that anonymous boxes are all associated with their
  originating node.

These changes are prepatory work for implementation of the `::marker`
pseudo-element as well as ensuring that all anonymous boxes can be
cached into the box tree eventually.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
2025-03-29 12:41:04 +00:00
Andrei Volykhin
5f5bf87eee
dom: Track "removed" event listener status (#36163)
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>
2025-03-28 23:34:04 +00:00
Andreu Botella
95c3033456
Consume BOM in the text() method of fetch bodies (#36192)
In the fetch spec, the `text()` method of `Body` (an interface mixin
implemented by both `Request` and `Response`) consumes the body with
the Encoding spec "UTF-8 decode" algorithm, which skips the UTF-8 BOM
if it is present at the beginning of the body. Servo's implementation
does not do that. This patch fixes this.

Signed-off-by: Andreu Botella <abotella@igalia.com>
2025-03-28 19:02:48 +00:00
Andreu Botella
482d28e4ff
Fix content-type when creating a Request with FormData body (#36194)
When you create a `Request` object with a `FormData` body, the spec
says that the `Content-Type` header should start with
`multipart/form-data; boundary=`. However, in Servo's implementation
it started with `multipart/form-data;boundary=`, without the space.

While all reasonable servers should be able to that headers whether
the space is present or not, this brings Servo closer to the spec, and
also makes some WPT tests pass.

Note that submitting a form with `enctype="multipart/form-data"` does
produce a `Content-Type` header with the space (see
`HTMLFormElement::submit_entity_body`).

Signed-off-by: Andreu Botella <abotella@igalia.com>
2025-03-28 13:33:07 +00:00
Barigbue Nbira
5a4e232cb6
fix: prevent missing value error for radio button inputs without a name (#36197)
Signed-off-by: Barigbue <barigbuenbira@gmail.com>
2025-03-28 11:20:59 +00:00
Servo WPT Sync
ecaf2930cc
Update web-platform-tests to revision b'9d20f3ae600d00673a27a69f69e13d4cd8eca443' (#36195)
Signed-off-by: WPT Sync Bot <ghbot+wpt-sync@servo.org>
2025-03-28 06:07:42 +00:00
elomscansio
a8063b8b4b
fix(parser): Set shadow’s available to element internals in 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>
2025-03-27 17:20:42 +00:00