Commit graph

10264 commits

Author SHA1 Message Date
Simon Wülker
3d320fa96a
Update rustfmt to the 2024 style edition (#35764)
* Use 2024 style edition

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>

* Reformat all code

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>

---------

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
2025-03-03 11:26:53 +00:00
Sean Burke
649291bf69
script: Avoid double borrow crash on iframe focus (#35742)
Signed-off-by: Seán de Búrca <leftmostcat@gmail.com>
2025-03-03 10:10:16 +00:00
Euclid Ye
28cea920ec
layout: Merge BoxFragment::used_overflow into ComputedValuesExt::effective_overflow (#35670) (#35670)
* Update wpt-test



* Merge used_overflow to effective_overflow; remove duplicate call



* Remove more duplicate calls; update effective_overflow logic



* Update reference link&style



* Apply final review suggestions

Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com>
2025-03-02 21:44:59 +00:00
Servo WPT Sync
5ba9cfe809
Update web-platform-tests to revision b'fc557e215e11221c91de4f283539725ef2f35928' (#35741)
Signed-off-by: WPT Sync Bot <ghbot+wpt-sync@servo.org>
2025-03-02 12:18:38 +00:00
Xiaocheng Hu
aa26aa1963
script: Implement preparation-time document (#35718)
* Use preparation-time document for scripts

Signed-off-by: Xiaocheng Hu <xiaochengh.work@gmail.com>

* Rebaseline test

Signed-off-by: Xiaocheng Hu <xiaochengh.work@gmail.com>

* Fix step numbers and spec quotes

Signed-off-by: Xiaocheng Hu <xiaochengh.work@gmail.com>

---------

Signed-off-by: Xiaocheng Hu <xiaochengh.work@gmail.com>
2025-03-02 10:25:00 +00:00
Simon Wülker
25cc675101
Don't recurse in Node::GetRootNode (#35725)
* Don't recurse in Node::GetRootNode

This causes servo to crash when computing
the root of deeply nested shadow roots.

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>

* Add test case

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>

---------

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
2025-03-01 17:19:27 +00:00
Martin Robinson
f949d2adc8
fonts: Remove the per-FontGroup cached fallback font (#35705)
Instead of keeping a per-FontGroup cache of the previously used fallback
font, cache this value in the caller of `FontGroup::find_by_codepoint`.
The problem with caching this value in the `FontGroup` is that it can
make one layout different from the next.

Still, it is important to cache the value somewhere so that, for
instance, Chinese character don't have to continuously walk through the
entire fallback list when laying out. The heuristic here is to try to
last used font first if the `Script`s match. At the very least this
should make one layout consistent with the next.

Fixes #35704.
Fixes #35697.
Fixes #35689.
Fixes #35679.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
2025-02-28 14:33:21 +00:00
Gae24
900655fbc7
script: Avoid double borrow crash in DataTransferItem (#35699)
* avoid double borrow inside GetAsString

Signed-off-by: Gae24 <96017547+Gae24@users.noreply.github.com>

* added crashtest

Signed-off-by: Gae24 <96017547+Gae24@users.noreply.github.com>

---------

Signed-off-by: Gae24 <96017547+Gae24@users.noreply.github.com>
2025-02-27 19:28:35 +00:00
Kousuke Takaki
8a3f62933b
script: Implement Blob::bytes() (#35151)
* script: Implement Blob.bytes()

Signed-off-by: yoseio <98276492+yoseio@users.noreply.github.com>

* improve read_all_bytes

Signed-off-by: yoseio <98276492+yoseio@users.noreply.github.com>

* fix read_all_bytes

Signed-off-by: yoseio <98276492+yoseio@users.noreply.github.com>

* fix bug

Signed-off-by: yoseio <98276492+yoseio@users.noreply.github.com>

* something went wrong

Signed-off-by: Kousuke Takaki <98276492+yoseio@users.noreply.github.com>

* fix read loop

Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com>

* add use of can_gc to promise code following rebase

Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com>

* fix rooting of fulfillment handler

Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com>

* Update test expectations

Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com>

* use dom for reader in read loop fulfillment handler

Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com>

* use the global of the reader in read loop fulfillment handler

Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com>

* remove FAIl expectations for blob methods in detached iframe

Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com>

---------

Signed-off-by: yoseio <98276492+yoseio@users.noreply.github.com>
Signed-off-by: Kousuke Takaki <98276492+yoseio@users.noreply.github.com>
Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com>
Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com>
Co-authored-by: gterzian <2792687+gterzian@users.noreply.github.com>
Co-authored-by: Taym Haddadi <haddadi.taym@gmail.com>
2025-02-27 19:25:27 +00:00
Xiaocheng Hu
11f54b9f23
layout: Implement a non-recursive version of CSS quotes (#34770)
* Squash and don't explicitly use noto-cjk in tests

Signed-off-by: Xiaocheng Hu <xiaochengh.work@gmail.com>

* Mark quotes-034.html.ini failure

Signed-off-by: Xiaocheng Hu <xiaochengh.work@gmail.com>

* Address review comments

Signed-off-by: Xiaocheng Hu <xiaochengh.work@gmail.com>

---------

Signed-off-by: Xiaocheng Hu <xiaochengh.work@gmail.com>
2025-02-27 16:00:21 +00:00
Oriol Brufau
1966ab182f
layout: Use definite cross size to compute flex base size (#35688)
An intrinsic flex base size depends on the contents, which may depend on
the cross size through an aspect ratio. We were only taking this into
account if the preferred cross size was numeric, but `auto` or `stretch`
can also be definite.

Signed-off-by: Oriol Brufau <obrufau@igalia.com>
2025-02-27 13:54:44 +00:00
Mukilan Thiyagarajan
3cf4ef61ef
bindings: Fix support for interface members in setlike/maplike. (#35651)
#30151 added support for setlike and maplike declarations in WebIDL, but
the tests only validated if generator code worked with 'DOMString' as
the key type. The support for interface type as members was broken as
`DomRoot<T>` didn't satify the bounds `Eq` and `Hash` needed by the
`Key` and `Value` types in `Setlike` and `Maplike` traits respectively.
In addition, the splitting of bindings into a separate 'script_bindings'
crate had also broken support for this in CodegenRust.py, as the types
used within the definition of `DomTraits` were not referenced using
`Self::`.

This patch fixes the WebIDL code generator by doing a simple string
replacement on the return value of `getRetvalDeclarationForType` so that
the proper `Self::` is used. I'm not not sure if there is a better
approach to this as it seems most logic in CodegenRust.py uses the `D::`
prefix that is expected to be available only when compiling `script`
crate and not `script_bindings`.

This patch also adds the missing trait implementations for `DomRoot` and
ensures that the generated code works for both members of primitive and
interface types by splitting the existing `TestBinding{Map,Set}Like`
interfaces into `TestBinding{Map,Set}LikeWith{Primitive,Interface}`
tests.

Fixes #35542.

Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>
2025-02-27 07:04:11 +00:00
Delan Azabani
276f6a3ba7
libservo: Clean up interfaces for alert()/confirm()/prompt() (#35579)
Signed-off-by: Delan Azabani <dazabani@igalia.com>
2025-02-27 02:49:08 +00:00
Oriol Brufau
03e953e22c
layout: Support stretch cross size for flex base size (#35663)
The computation of the flex base size may involve transferring a
definite cross size into the main axis through the aspect ratio.
We were only considering numeric sizes as definite, but `stretch` can
also be definite.

Signed-off-by: Oriol Brufau <obrufau@igalia.com>
2025-02-26 18:03:38 +00:00
Oriol Brufau
6aae4df909
layout: Support stretch cross size for automatic min size in flexbox (#35652)
The computation of the automatic minimum size may involve transferring
a definite cross size into the main axis through the aspect ratio.
We were only considering numeric sizes as definite, but `stretch` can
also be definite.

Signed-off-by: Oriol Brufau <obrufau@igalia.com>
2025-02-26 16:30:36 +00:00
Simon Wülker
754b117011
Allow the <details> element to be opened and closed (#35261)
* Implement the <summary> element

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>

* Implement UA shadow root for <details>

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>

* Invalidate style when display is opened or closed

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>

* Fix /_mozilla/mozilla/duplicated_scroll_ids.html

This test previously assumed that <details> elements would
not be rendered.

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>

* Implement implicit summary elements

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>

* Update WPT expectations

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>

* Remove test for duplicated scroll IDs

See https://github.com/servo/servo/pull/35261#discussion_r1969328725 for
reasoning.

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>

* Use Iterator::find to find implicit summary element

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>

---------

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
2025-02-25 11:56:36 +00:00
Martin Robinson
c844ed232a
servoshell: Fall back to PNG format when outputting an image (#35648)
A recent change, #35538 added the ability to dump different output image
formats. Unfortunately, this necessitated adding a file extension to the
output image for WPT tests. This had two problems:

1. The original change never landed properly in WPT for unknown reasons.
2. It interfered with the way that temporary files were cleaned up
   during WPT runs.

This change modifies the image dumping code to fall back to PNG format
when there is no valid file extension on the output image and reverts
the change made to the WPT runner.

Fixes #35635.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
2025-02-25 08:38:28 +00:00
Samson
3c3b6cfdc4
chore: Update wgpu (#35639)
* Update wgpu

2f255edc60
Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>

* Update expectations

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>

---------

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
2025-02-24 20:27:36 +00:00
Simon Wülker
cdc33b398c
Don't tell stylo about stylesheets that are not in a browsing context (#35606)
* Don't register stylesheets outside of a browsing context with stylo

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>

* Update WPT expectations

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>

---------

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
2025-02-24 20:04:18 +00:00
Kingsley Yung
fc14b10099
Support for the isolation CSS property (#35552)
* Support for the isolation CSS property

Signed-off-by: Kingsley Yung <kingsley@kkoyung.dev>

* Temporarily bump stylo to refs/pull/125/head for testing

Signed-off-by: Kingsley Yung <kingsley@kkoyung.dev>

* Remove FAIL expectation of CSS isolation tests

Signed-off-by: Kingsley Yung <kingsley@kkoyung.dev>

* Add behavior test

Signed-off-by: Oriol Brufau <obrufau@igalia.com>

* Revert temporary changes in Cargo.toml

Signed-off-by: Kingsley Yung <kingsley@kkoyung.dev>

---------

Signed-off-by: Kingsley Yung <kingsley@kkoyung.dev>
Signed-off-by: Oriol Brufau <obrufau@igalia.com>
Co-authored-by: Oriol Brufau <obrufau@igalia.com>
2025-02-24 16:25:34 +00:00
Oriol Brufau
41c2422a66
layout: Ignore indefinite stretch on min and max sizing properties (#35630)
We were always treating an indefinite `stretch` as the automatic size.
This instead treats it as `0px` on min sizing properties, and as `none`
on max sizing properties, aligning with Blink and this recent CSSWG
resolution: https://github.com/w3c/csswg-drafts/issues/11006

Signed-off-by: Oriol Brufau <obrufau@igalia.com>
2025-02-24 13:51:08 +00:00
webbeef
f7c1cd4635
dom: Move child_list to rare data (#35592)
This is only created when calling the ChildNodes method. Gecko also stores it in their similar
data structure at https://searchfox.org/mozilla-central/rev/155d514d72473453492a822e97dc1c68cf49d110/dom/base/nsINode.h#1464

Signed-off-by: webbeef <me@webbeef.org>
2025-02-22 01:32:37 +00:00
webbeef
e883eaa322
dom: move node ranges to raredata (#35554)
Signed-off-by: webbeef <me@webbeef.org>
2025-02-21 18:41:25 +00:00
Xiaocheng Hu
2b0d2ecc73
Rebase and squash (#35567)
Signed-off-by: Xiaocheng Hu <xiaochengh.work@gmail.com>
2025-02-21 11:54:25 +00:00
Martin Robinson
54b5c7b632
compositing: Move image output and shutdown management out of the compositor (#35538)
This is a step toward the renderer-per-WebView goal. It moves various
details out of `IOCompositor`.

- Image output: This is moved to servoshell as now applications can
  access the image contents of a `WebView` via
  `RenderingContext::read_to_image`. Most options for this are moved to
  `ServoShellPreferences` apart from `wait_for_stable_image` as this
  requires a specific kind of coordination in the `ScriptThread` that is
  also very expensive. Instead, paint is now simply delayed until a
  stable image is reached and `WebView::paint()` returns a boolean.
  Maybe this can be revisited in the future.
- Shutdown: Shutdown is now managed by libservo itself. Shutdown state
  is shared between the compositor and `Servo` instance. In the future,
  this sharing might be unecessary.
- `CompositeTarget` has been removed entirely. This no longer needs to
   be passed when creating a Servo instance.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Co-authored-by: Ngo Iok Ui (Wu Yu Wei) <yuweiwu@pm.me>
2025-02-20 18:27:49 +00:00
Gregory Terzian
df6d636168
dom: Implement WritableStream (#34844)
* add basic interface for writable stream

Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com>

* add stubs for pipeTo and pipeThrough methods

Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com>

* add stubs for writable stream defautl writer

Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com>

* add stubs for writable stream controller

Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com>

* add underlying source dict

Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com>

* add underlying source dict

Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com>

* implement constructor

Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com>

* implement init writable stream

Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com>

* impl setup default controller

Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com>

* implement controller setup

Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com>

* implement controller advance queue if neededd

Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com>

* implement stream finish erroring

Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com>

* implement stream reject close and closed promise if needed

Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com>

* finish implementation of stream finish erroring

Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com>

* call into controller setup from stream constructor

Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com>

* implement stream mark first write request in flight

Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com>

* implement controller process write

Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com>

* call into advance queue if needed at various points

Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com>

* implement stream deal with rejection, use from_safe_context

Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com>

* implement controller clear algorithms

Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com>

* remove unused todo

Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com>

* implement stream start erroring

Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com>

* finish writer ensure ready promise rejected

Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com>

* implement stream finish in flight write request

Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com>

* implement write constructor and setup

Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com>

* implement controller error

Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com>

* remove unnecessary unsafe code

Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com>

* finish implementing process write

Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com>

* implement close sentinel

Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com>

* implement public locked

Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com>

* implement stream abort

Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com>

* implement stream close

Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com>

* implement controller close

Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com>

* fix use of crown

Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com>

* remove unnecessary options around writer promises

Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com>

* implement writer get desired size

Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com>

* implement writer ready

Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com>

* implement writer abort

Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com>

* implement writer close

Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com>

* implement writer release lock

Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com>

* implement writer public write

Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com>

* implement private writer write

Uses ai

Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com>

* implement writer release.

Uses ai

Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com>

* impl controller process close

Uses ai

Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com>

* finish controller process close

Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com>

* root promise handlers

Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com>

* handler errors in stream and writer constructor
finish implementation of stream finish in flight close

Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com>

* fix warnings

Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com>

* implement controller get chunk size

Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com>

* tidy the webidls

Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com>

* implement stream get writer

Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com>

* fix assertion of stream state when advancing queue if needed

Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com>

* add docs for value with size

Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com>

* use reject_error in abort

Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com>

* remove unnecessary allowances of unsafe code

Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com>

* turn writable-streams test suite on

Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com>

* update encodings test expectations

Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com>

* properly check if type is set on sink in stream constructor

Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com>

* fix double borrow in controller advance queue if needed

Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com>

* make the queue aware of the close sentinel when dequeuing a value

Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com>

* fix assertion of no backpressure in update backpressure

Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com>

* also clear strategy size when clearing algorithms

Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com>

* remove this object arg when calling into strategy size

Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com>

* fix has operations marked in flight

Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com>

* fix typo in has in flight write request

Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com>

* turn error into no-op when aborting a stream, if the stream is closed or errored.

Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com>

* fix error handling of calling into abort algorithm

Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com>

* fix error handling of calling into close and write algorithms

Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com>

* fix double borrow on queue
fix logic in update_backpressure
fix logic in get_desired_size
fix logic in writer setup

Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com>

* update test expectations for aborting suite

Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com>

* fix controller get_backpressure

Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com>

* fix clippy

Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com>

* update test expectations to expect errors in tests using unsupported apis

Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com>

* fix error handling of calling into start algo in controller setup

Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com>

* update test expectations for test checking for undefined this in strategy size call

Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com>

* update test expectation to timeout for response-stream-with-broken-then.any.worker

Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com>

* update interfaces

Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com>

* fix use of global() and error to_jsval

Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com>

* fix use of crown for promise handlers

Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com>

* remove fail expectation from worker interface objects test

Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com>

* remove fail expectation for test expecting this to be undefined in callback

Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com>

* fix documentation link for writablestream state

Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com>

* refactor write_requests to use a vec deque

uses ai

Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com>

* remove unnecessary doc

Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com>

* refactor reject_close_and_closed_promise_if_needed to take a safe js context as argument

uses ai

Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com>

* pass globals and contexts by ref where possible

uses ai

Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com>

* fix doc link for controller

Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com>

* remove unnecessary comment

Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com>

* change update_backpressure to be a method of the writablestream

uses ai

Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com>

* rename writer method that resolve closed and ready promise for clarity

uses ai

Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com>

* add comments for steps in peek queue value

Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com>

* fix doc link for the abort algorihtm fulfillment handler

Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com>

* fix step doc and variable name in abort algo rejection handler

Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com>

* Add must_root to pending abort request

Co-authored-by: Josh Matthews <josh@joshmatthews.net>
Signed-off-by: Gregory Terzian <2792687+gterzian@users.noreply.github.com>

* limit visibility to crate for has_operations_marked_inflight

Co-authored-by: Josh Matthews <josh@joshmatthews.net>
Signed-off-by: Gregory Terzian <2792687+gterzian@users.noreply.github.com>

* limit visibility to crate for get_stored_error

Co-authored-by: Josh Matthews <josh@joshmatthews.net>
Signed-off-by: Gregory Terzian <2792687+gterzian@users.noreply.github.com>

* remove potention re-borrow risk in reject loop on write requests in finish_erroring

Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com>

* remove potential re-borrow risk when taking pending abort request in finish_erroring

Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com>

* remove potential re-borrow risk when taking close request in reject_close_and_closed_promise_if_needed

Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com>

* remove re-borrow risks in finish_in_flight_close

Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com>

* remove re-borrow risk on in_flight_close_request in finish_in_flight_close_with_error

Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com>

* remove unnecessary clone of of reason in abort

Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com>

* fix condition on backpressure and a writable state in close

Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com>

* limit visibility to crate for update_backpressure

Co-authored-by: Josh Matthews <josh@joshmatthews.net>
Signed-off-by: Gregory Terzian <2792687+gterzian@users.noreply.github.com>

* remove mutability of reason in abort workflow

Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com>

* remove unnecessary use of ignore_malloc_size_of around Dom in controller

Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com>

* fix ignore malloc size of comment for strategy size

Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com>

* reduce visibility of public methods to crate in controller

Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com>

* remove use of JS_GetPendingException in controller get_chunk_size

Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com>

* return early on error in write

Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com>

* use is_some_and in assertion that stream.witer is writer in release

Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com>

* root pending abort request

uses ai

Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com>

* fix mutable re-borrow risk in writer

Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com>

---------

Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com>
Signed-off-by: Gregory Terzian <2792687+gterzian@users.noreply.github.com>
Co-authored-by: Josh Matthews <josh@joshmatthews.net>
2025-02-19 13:02:14 +00:00
Mukilan Thiyagarajan
56840e0a35
script: add skeleton implementation of FontFace API (#35262)
This patch implements the `FontFace` interface, but with some caveats

1. The interface is only exposed on `Window`. Support for Workers will
   be handled in the future.
2. The concept of `css-connected` `FontFace` is not implemented, so
   `@font-face` rules in stylesheets will not be represented in the DOM.
3. The constructor only supports using `url()` strings as source
   and `ArrayBuffer` and `ArrayBufferView` are not supported yet.

A skeleton implementation of the `load` method of `FontFaceSet` is also
implemented in this patch. The intention is to support some web pages
that don't load without this method.

Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>
2025-02-19 05:50:01 +00:00
Simon Wülker
29e0fad21e
Ensure that qualified-name segments start with a valid start character (#35530)
* Add spec comments to various methods

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>

* Ensure that qualified-name segments start with a valid start character

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>

* Update WPT expectations

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>

---------

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
2025-02-19 04:34:42 +00:00
Jason Tsai
22c3a63737
feat: add Notification Web API binding (#34842)
* feat: add Notification Web API binding

Signed-off-by: Jason Tsai <git@pews.dev>

* chore: update spec link

Signed-off-by: Jason Tsai <git@pews.dev>

* chore: fix clippy

Signed-off-by: Jason Tsai <git@pews.dev>

* fix: index overflow

Signed-off-by: Jason Tsai <git@pews.dev>

* test(tidy): add notification WebIDL standard URL

Signed-off-by: Jason Tsai <git@pews.dev>

* fix: allow crown::unrooted_must_root

Signed-off-by: Jason Tsai <git@pews.dev>

* implement GetPermission

Signed-off-by: Jason Tsai <git@pews.dev>

* fix silent type

Signed-off-by: Jason Tsai <git@pews.dev>

* add all properties

Signed-off-by: Jason Tsai <git@pews.dev>

* test: add Notification to global

Signed-off-by: Jason Tsai <git@pews.dev>

* chore: update wpt manifest and fix clippy

Signed-off-by: Jason Tsai <git@pews.dev>

* test: temp skip notifications

Signed-off-by: Jason Tsai <git@pews.dev>

* add vibration and apply suggestions

Signed-off-by: Jason Tsai <git@pews.dev>

* partially implement RequestPermission

Signed-off-by: Jason Tsai <git@pews.dev>

* call Permission request permission algorithm

Signed-off-by: Jason Tsai <git@pews.dev>

* chore: pub crate Notification

Signed-off-by: Jason Tsai <git@pews.dev>

* chore: fix clippy

Signed-off-by: Jason Tsai <git@pews.dev>

* chore: crown attribute

Signed-off-by: Jason Tsai <git@pews.dev>

* fix part of suggestions

Signed-off-by: Jason Tsai <git@pews.dev>

* fix: store private `Action` structure

Signed-off-by: Jason Tsai <git@pews.dev>

* chore: fix typo

Signed-off-by: Jason Tsai <git@pews.dev>

* fix: serialize images URL

Signed-off-by: Jason Tsai <git@pews.dev>

* fix: use globalscope as environment settings object

Signed-off-by: Jason Tsai <git@pews.dev>

* chore: add pref `dom_notification_enabled` and default to disabled

Signed-off-by: Jason Tsai <git@pews.dev>

* fix: use `descriptor_permission_state`

Signed-off-by: Jason Tsai <git@pews.dev>

* apply suggestions

Signed-off-by: Jason Tsai <git@pews.dev>
Co-authored-by: Josh Matthews <josh@joshmatthews.net>

* test: remove passed meta

Signed-off-by: Jason Tsai <git@pews.dev>

* test: enable notification prefs in mozilla tests

Signed-off-by: Jason Tsai <git@pews.dev>

---------

Signed-off-by: Jason Tsai <git@pews.dev>
Co-authored-by: Josh Matthews <josh@joshmatthews.net>
2025-02-18 16:56:57 +00:00
Oriol Brufau
f01d525852
layout: Fully support sizing keywords on main size property of flex item (#35471)
Still lacking support on min and max main size properties, and on the
various cross size properties.

Signed-off-by: Oriol Brufau <obrufau@igalia.com>
2025-02-17 21:19:50 +00:00
Oriol Brufau
c2224d5afc
layout: Partial support for sizing keywords on flex items (#35469)
* Add tests for sizing keywords on flex items

Signed-off-by: Oriol Brufau <obrufau@igalia.com>

* layout: Partial support for sizing keywords on flex items

When a flex item has `flex-basis: auto`, the used `flex-basis` is the
value of the main size property. In that case, if the main size property
was set to keyword, we were always assuming it was `auto`. Now we handle
non-`auto` keywords correctly.

Signed-off-by: Oriol Brufau <obrufau@igalia.com>

---------

Signed-off-by: Oriol Brufau <obrufau@igalia.com>
2025-02-17 17:51:10 +00:00
Euclid Ye
d466688526
dom: expose obsolete scheme attribute for meta tag (#35505)
* dom: expose obsolete `scheme` attribute for meta tag

Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com>

* update tests

Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com>

---------

Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com>
2025-02-17 07:07:24 +00:00
Gae24
966888615f
DataTransferItem: improve spec compliance (#35418)
* DataTransfer: remove PlainString and Binary structs

Signed-off-by: Gae24 <96017547+Gae24@users.noreply.github.com>

* add DataTransferItemList remove() test case

Signed-off-by: Gae24 <96017547+Gae24@users.noreply.github.com>

* bring datatransferitem closer to the spec

Signed-off-by: Gae24 <96017547+Gae24@users.noreply.github.com>

* queue a task to invoke the callback

Signed-off-by: Gae24 <96017547+Gae24@users.noreply.github.com>

---------

Signed-off-by: Gae24 <96017547+Gae24@users.noreply.github.com>
2025-02-16 18:53:35 +00:00
Samson
0e9bebce0f
chore: Update wgpu (#35503)
* Update wgpu

d8833d0798
Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>

* Update expectations

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>

* fix tidy

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>

---------

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
2025-02-16 18:24:13 +00:00
Josh Matthews
34c73fb452
net: Use the unfiltered response status when comparing against cached resources. (#35483)
Signed-off-by: Josh Matthews <josh@joshmatthews.net>
2025-02-16 13:19:51 +00:00
shanehandley
5ab3641a8e
script: implement HTMLHyperlinkElementUtils for HTMLAreaElement (#35482)
This makes some common functionality in HTMLAreaElement and
HTMLAnchorElement shared code.

Signed-off-by: Shane Handley <shanehandley@fastmail.com>
2025-02-16 09:54:31 +00:00
Servo WPT Sync
6d6070242b
Update web-platform-tests to revision b'de61904887c13679551c32e5e3e70b4dc870c98a' (#35480)
Signed-off-by: WPT Sync Bot <ghbot+wpt-sync@servo.org>
2025-02-16 01:35:48 +00:00
Martin Robinson
ebd471bb55
deps: Remove some unused Cargo.toml (#35466)
These were discovered with cargo-machete.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
2025-02-14 15:33:14 +00:00
Oriol Brufau
2b930814d7
layout: Basic implementation of size keywords on flex-basis (#35413)
layout: Basic implementation of size keywords on `flex-basis`

This splits the logic to resolve the used value of `flex-basis` into its
own method, which preserves size keywords.

And then it changes `flex_base_size()` to resolve the provided keywords
properly. However, it doesn't handle size keywords in the cross axis.

Signed-off-by: Oriol Brufau <obrufau@igalia.com>
2025-02-13 15:24:06 +00:00
Steven Novaryo
becd097585
dom: IntersectionObserver initialization (#35314)
* Add internal slot definition

Signed-off-by: stevennovaryo <steven.novaryo@gmail.com>

* Add initialization for new IntersectionObserver

Signed-off-by: stevennovaryo <steven.novaryo@gmail.com>

* Move observer initialization

Signed-off-by: stevennovaryo <steven.novaryo@gmail.com>

* Update WPT tests

Signed-off-by: stevennovaryo <steven.novaryo@gmail.com>

* Make a copy of style IntersectionObserverRootMargin

Signed-off-by: stevennovaryo <steven.novaryo@gmail.com>

* Move initialization to account for rooted expression

Signed-off-by: stevennovaryo <steven.novaryo@gmail.com>

* Fix some fields typing

Signed-off-by: stevennovaryo <steven.novaryo@gmail.com>

* Impl rest of IntersectionObserver interface

Signed-off-by: stevennovaryo <steven.novaryo@gmail.com>

* Fix tidy issue

Signed-off-by: stevennovaryo <steven.novaryo@gmail.com>

* Apply types logic and tidy fix from suggestions

Signed-off-by: stevennovaryo <steven.novaryo@gmail.com>

* Add allow unrooted for add registration to element

Signed-off-by: stevennovaryo <steven.novaryo@gmail.com>

---------

Signed-off-by: stevennovaryo <steven.novaryo@gmail.com>
2025-02-13 07:47:29 +00:00
Josh Matthews
abede5b4b2
Run WPT notifications tests. (#35442)
Signed-off-by: Josh Matthews <josh@joshmatthews.net>
2025-02-12 19:04:09 +00:00
Mukilan Thiyagarajan
b7b8619e87
script: reset spurious frame counter *only* when reflow is triggered (#35435)
I had applied a review suggestion in the previous PR to combine the
nested conditions, but this is wrong as this meant the spurious frame
callback was getting reset not just when the reflow was triggered by the
callback, but also each time the counter reached the threshold.

The test added in the previous PR also had issues with the upstream WPT
repo's lint checks - `test.step_timeout` should be used instead of the
`setTimeout` function.

This patch fixes the counter update logic and also addresses the linting
issue caught by upstream's linter.

Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>
2025-02-12 14:23:55 +00:00
Taym Haddadi
695e5fe5f1
Add Precustomized state to CustomElementState (#35392)
* add Precustomized state to CustomElementState

Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com>

* Update test expectation

Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com>

---------

Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com>
2025-02-12 12:57:52 +00:00
Oriol Brufau
87069e9f47
Test overflow-clip-margin with border-radius (#35433)
Assert that the resulting shape is the same as a spreading `box-shadow`.
Firefox fails this test.

Signed-off-by: Oriol Brufau <obrufau@igalia.com>
2025-02-12 11:02:57 +00:00
Mukilan Thiyagarajan
bcbb1d67d5
script: fix spurious animation checks to correctly invoke rAF callbacks (#35387)
After running an `rAF` callback, if no new callbacks were registered, we
send a `NoAnimationFramesCallback` to the compositor to stop ticking
animations using video refresh callbacks. This interacts badly with the
mechanism to track spurious animations frames i.e. rAF callbacks that
don't mutate the DOM. Such 'faked' rAF callbacks are triggered by
registering a oneshot timer instead of the compositor callback.

The compositor's refresh callback is never enabled back again once a
non-spurious rAF callback runs and registers a new rAF callback. If the
former callback resets the `spurious_animations_frames` counter, then when
the latter rAF callback runs, it will not schedule a OneShotTimer timer
for any rAF callback that itself registers, since the counter was reset
previously. Hence that third rAF callback that never runs as it relies
on the compsitor's refresh callback, which was disabled previously.

The current logic also doesn't actually recognize spurious animation
frames because the `spurious_animations_frames` counter is updated at
the end of the `run_the_animation_frame_callbacks`, effectively meaning
`was_faking_animation_frames` and `self.is_faking_animation_frames` will
always be the same value but the logic effectively only runs when
`(!was_faking && is_faking)` is true.

This patch fixes the logic to detect spurious animations frames by
moving logic to update the counter to be before the check for spurious
frames. It also ensures that the compositor's refesh callbacks is
re-enabled once we see a non-spurious callback.


Fixes #35386

Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>
2025-02-12 09:11:19 +00:00
batu_hoang
8c46749740
Implement overflow:clip (#35103)
* Implement overflow clip

Signed-off-by: longvatrong111 <longvatrong111@gmail.com>

* Modify test ini for overflow clip

Signed-off-by: longvatrong111 <longvatrong111@gmail.com>

* Update overflow_clip_rect calculation

Signed-off-by: batu_hoang <longvatrong111@gmail.com>

* Update overflow-clip-margin border-radius according to shadow box

Signed-off-by: longvatrong111 <longvatrong111@gmail.com>

---------

Signed-off-by: longvatrong111 <longvatrong111@gmail.com>
Signed-off-by: batu_hoang <longvatrong111@gmail.com>
Signed-off-by: batu_hoang <55729155+longvatrong111@users.noreply.github.com>
2025-02-12 07:02:06 +00:00
Oriol Brufau
a1315833b6
Enable the quotes CSS property (#35420)
Bumps Stylo to https://github.com/servo/stylo/pull/110

The actual implementation will happen in #34770

Signed-off-by: Oriol Brufau <obrufau@igalia.com>
2025-02-11 14:02:38 +00:00
Domenico Rizzo
bea7a969f4
implemented feture and tests (#35309)
Signed-off-by: Domenico Rizzo <domenico.rizzo@gmail.com>
2025-02-10 20:29:05 +00:00
Max T.
044f77d728
script: Add shadow dom check to custom element constructor (#35382)
* script: Add shadow dom check to custom element constructor

Signed-off-by: maxtidev <max@maxti.dev>

* Update components/script/dom/customelementregistry.rs

Co-authored-by: Josh Matthews <josh@joshmatthews.net>
Signed-off-by: Max T. <163015439+maxtidev@users.noreply.github.com>

* Update components/script/dom/customelementregistry.rs

Co-authored-by: Josh Matthews <josh@joshmatthews.net>
Signed-off-by: Max T. <163015439+maxtidev@users.noreply.github.com>

* Update components/script/dom/customelementregistry.rs

Co-authored-by: Josh Matthews <josh@joshmatthews.net>
Signed-off-by: Max T. <163015439+maxtidev@users.noreply.github.com>

* Update components/script/dom/customelementregistry.rs

Co-authored-by: Josh Matthews <josh@joshmatthews.net>
Signed-off-by: Max T. <163015439+maxtidev@users.noreply.github.com>

* Remove unnecessary custom-elements upgrading test .ini

Signed-off-by: maxtidev <max@maxti.dev>

* script: tidy comments in run_upgrade_constructor

Signed-off-by: maxtidev <max@maxti.dev>

---------

Signed-off-by: maxtidev <max@maxti.dev>
Signed-off-by: Max T. <163015439+maxtidev@users.noreply.github.com>
Co-authored-by: maxtidev <max@maxti.dev>
Co-authored-by: Josh Matthews <josh@joshmatthews.net>
2025-02-09 13:10:50 +00:00
Martin Robinson
75cf3d7265
dom: Always replace unpaired surrogates when handling page text (#35381)
Background:

> JavaScript strings are potentially ill-formed UTF-16 (arbitrary
> Vec<u16>) and can contain unpaired surrogates. Rust’s String type is
> well-formed UTF-8 and can not contain any surrogate. Surrogates are
> never emitted when decoding bytes from the network, but they can sneak
> in through document.write, the Element.innerHtml setter, or other DOM
> APIs.

In 2015, Servo launched an experiment to see if unpaired surrogates
cropped up in page content. That experiment caused Servo to panic if
unpaired surrogates were encountered with a request to report the page
to bug #6564. During that time several pages were reported with unpaired
surrogates, causing Servo to panic. In addition, when running the WPT
tests Servo will never panic due to the `-Z replace-surrogates` option
being passed by the test driver.

Motivation:

After this 10 year experiment, it's clear that unpaired surrogates are a
real concern in page content. Several reports were filed of Servo
panicking after encountering them in real world pages. A complete fix for
this issue would be to somehow maintain unpaired surrogates in the DOM,
but that is a much larger task than simply emitting U+FFD instead of an
unpaired surrogate.

Since it is clear that this kind of content exists, it is better for
Servo to try its best to handle the content rather than crash as
production browsers should not crash due to user content when possible.
In this change, I modify Servo to always replace unpaired surrogates.

It would have been ideal to only crash when debug assertions are
enabled, but debug assertions are enabled by default in release mode --
so this wouldn't be effective for WPT tests.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
2025-02-09 08:56:05 +00:00