Commit Graph

1402 Commits

Author SHA1 Message Date
Shubham Gupta
77e4bfbcc4 Pass Request's URL for LargestContentfulPaint Entry (#42901)
Pass Request URL to `LargestContnetfulPaint` Entry

Testing: WPT Expectations Updated.
Fixes: #42902

---------

Signed-off-by: Shubham Gupta <shubham.gupta@chromium.org>
2026-03-02 20:35:37 +00:00
Simon Wülker
dfe7117084 script: Handle async parser being aborted while still running (#42910)
This fixes a crash on the attached testcase when running with the async
html parser enabled. The crash also triggers on wpt. When executing
parse ops received from the async parser, we were not considering the
case where one of these operations causes the parser to abort (in the
case above, said operation is the `<popup-info></popup-info>`).

```html
<body>
<script>
class PopupInfo extends HTMLElement {
  connectedCallback() {
    document.open();
  }
}

customElements.define('popup-info', PopupInfo);
</script>
<popup-info></popup-info>
</body>
```
The bug is very obscure and only triggers if `document.open` is called
while there is no parser-blocking script **and** the document parser is
still active.


Testing: We don't run tests on the async parser yet
Fixes: Part of https://github.com/servo/servo/issues/37418

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
2026-02-27 13:25:06 +00:00
Oriol Brufau
d5c82150e0 layout: Add testing API for counting restyled and rebuilt fragments (#42817)
Now `ServoTestUtils.forceLayout()` will provide the number of fragments
that have been restyled and rebuilt. This will be useful to test that
incremental layout works well.

Testing: Adds a test using this new API

---------

Signed-off-by: Oriol Brufau <obrufau@igalia.com>
Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Co-authored-by: Luke Warlow <lwarlow@igalia.com>
Co-authored-by: Martin Robinson <mrobinson@igalia.com>
2026-02-25 21:25:32 +00:00
Sam
3e2f14c455 script: Pass down &mut JSContext in servoparser and event loop. (#42635)
I only wanted to get `&mut JSContext` in microtask chunk and checkpoint,
but this in turn needed `&mut JSContext` in servoparser, which then
caused need for even more changes in script.

I tried to limit the size by putting some `temp_cx` in:
- drops of `LoadBlocker`, `GenericAutoEntryScript`
- methods of `VirtualMethods`
- methods of `FetchResponseListener`

Testing: Just refactor, but should be covered by WPT tests.
Part of #40600

---------

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
2026-02-25 07:14:23 +00:00
Tim van der Lippe
5853926db0 script: Move contenteditable implementation to dedicated file (#42749)
In preparation of introducing traits for some of these methods,
let's separate them from the basecommand trait. They are not
related to each other and it was making reasoning about where
lives what more difficult.

Part of #25005

Signed-off-by: Tim van der Lippe <tvanderlippe@gmail.com>
2026-02-24 09:00:43 +00:00
Narfinger
c6a5eb584a script: Do not unnecessary clone CSP list in Document::get_csp_list (#42716)
We previously clonsed the CSP list unnecessarily which consisted of
roughly 2.7%. 1.2% spend in Document::get_csp_list.
We can easily avoid it with Ref and cloning it deliberately when needed.

Testing: This is functionally identical to the previous code as it is a
change from clone to a Ref<>.

---------

Signed-off-by: Narfinger <Narfinger@users.noreply.github.com>
2026-02-23 11:49:58 +00:00
Tim van der Lippe
f8552ed214 script: Implement remaining query command methods (#42748)
This implements a baseline for these tests. By implementing these dummy
methods, we avoid a lot of test expectation clutter when debugging these
tests to figure out why they aren't passing yet.

For the delete command, since it doesn't have any state or is
indeterminate, we always return the same.

Part of #25005

Signed-off-by: Tim van der Lippe <tvanderlippe@gmail.com>
2026-02-22 21:35:51 +00:00
Sam
43bdd3818d script: Pass &mut JSContext to more dom methods (#42751)
split from https://github.com/servo/servo/pull/42635, some dom methods
are also called from other function, which require passing down cx from
many more places :(

Testing: Just refactor, but should be covered by WPT.
Part of #42638

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
2026-02-22 13:22:33 +00:00
Tim van der Lippe
c6c29fcd33 script: Implement focus support for contenteditable elements (#42734)
There is no specification for this, but there are relevant
WPT tests in `selection/contenteditable`. This PR implements
the required changes to make sure that when such an element
is focused (programmatically), it selects the correct node.

The implementation is therefore entirely reverse-engineered
based on existing browser behavior and commented to hopefully
make it make sense.

Part of #7492
Part of #12776
Part of #25005

Signed-off-by: Tim van der Lippe <tvanderlippe@gmail.com>
2026-02-22 09:26:15 +00:00
Tim van der Lippe
e505275744 script: Implement queryCommandSupported (#42731)
This method was already present on the document, but
wasn't implemented yet. Note that now more tests are
failing, since before they weren't running. The tests
check if a command is enabled before they started
running.

The selection API doesn't yet take into account
contenteditable containers, which is why these
tests don't consider a command enabled, since the
range of the selection is empty.

Part of #25005

Signed-off-by: Tim van der Lippe <tvanderlippe@gmail.com>
2026-02-21 20:36:26 +00:00
Tim van der Lippe
92e2d00083 script: Implement check for supported and enabled commands (#42634)
The first step of `execCommand` commands is to figure out
if they are supported and enabled. Therefore, implement
these two pieces with only 1 command: delete.

The implementation of `delete` is currently mostly dummy,
to have at least something going. But the main part of
this change is to setup the infrastructure to figure out
when commands are supported and enabled.

For the first part, its simply the list of commands we
currently have implemented, which is only delete.

For the second part, we need to consider the active range
of the current selection and do various checks, as well as
check the presence of `contenteditable`.

Part of #25005

Signed-off-by: Tim van der Lippe <tvanderlippe@gmail.com>
2026-02-17 13:19:41 +00:00
Alice
00e07a6736 Bump rust version to 1.92.0 (#42661)
This is a prerequisite for using the new version of egui introduced in
https://github.com/servo/servo/pull/42402.

Testing: No new behaviour.

Signed-off-by: Alice Boxhall <alice@igalia.com>
2026-02-16 18:58:15 +00:00
Tim van der Lippe
2eeaf05af9 script: Check trusted types for execCommand (#42626)
We should only do this for the `insertHTML` command.
All other commands are unaffected.

Part of #25005

Signed-off-by: Tim van der Lippe <tvanderlippe@gmail.com>
2026-02-15 12:55:05 +00:00
Tim van der Lippe
ae390d8bf8 script: Add baseline for editing/ WPT tests (#42621)
In preparation of the actual implementation.

Also had to update the codegen to be able to handle default values for
DOMString.

Part of #25005

---------

Signed-off-by: Tim van der Lippe <tvanderlippe@gmail.com>
2026-02-14 20:36:49 +00:00
Sam
d5d400c7d6 script: Use CString for Error::Type and Error::Range (#42576)
Continuation of https://github.com/servo/servo/pull/42135, switch
Error::Type and Error::Range to also use CStrings internally, as they
are converted to CString for throwing JS exceptions (other get thrown as
DomException object, which uses rust string internally).

Changes in script crate are mechanical.

Testing: Should be covered by WPT tests.
Part of #42126

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
2026-02-12 15:17:30 +00:00
Onur Şahin
fb9bef66fd script: Implement DocumentOrShadowRoot.FullscreenDocument (#42401)
Implement
[DocumentOrShadowRoot.FullscreenDocument](https://fullscreen.spec.whatwg.org/#dom-document-fullscreenelement).

## Changes
- Update IDL definition by removing `Document.fullscreenElement` and
declaring it in `DocumentOrShadowRoot` mixin as per the
[spec](https://fullscreen.spec.whatwg.org/#api)
- Implement [fullscreenElement
getter](https://fullscreen.spec.whatwg.org/#dom-document-fullscreenelement)
as a method in `DocumentOrShadowroot.get_fullscreen_element` which is
used by `Document` and `ShadowRoot`.
- Changedbubble and composed flags for fullscreen enter and exit events
to true.
- Delete `shadowroot-fullscreen-element.html.ini` since the test now
passes.

## Testing
Enable `shadowroot-fullscreen-element.html` WPT test.

Passing WPT run: https://github.com/onsah/servo/actions/runs/21872882492

## Fixes
https://github.com/servo/servo/issues/42234

Signed-off-by: Onur Sahin <sahinonur2000@hotmail.com>
2026-02-12 09:55:11 +00:00
Josh Matthews
ab85eafc7e Revert "script: Introduce end of loading phases" (#42562)
Reverts servo/servo#42446 . Too many new intermittent timeouts caused by
missing document load events.

Fixes: #42555
Fixes: #42556
Fixes: #42560
Fixes: #42557
Fixes: #42561 
Fixes: #42559 
Fixes: #42554
2026-02-12 04:10:30 +00:00
Tim van der Lippe
94f418c6e6 script: Introduce end of loading phases (#42446)
Since the steps for
https://html.spec.whatwg.org/multipage/parsing.html#the-end are
scattered throughout various pieces, it has been difficult to figure out
when to run what.

To remedy that, introduce the concept of phases. These phases are
checked in every method that needs to
"Spin the event loop" to know whether

1. It is the appropriate time to continue with #the-end
2. It has fully achieved its goal

For example, when processing deferred scripts, we need to do this after
a deferred script has finished loading. But we also need to do it at the
start of parsing, since we might not have any deferred scripts at all.

Therefore, each previous step sets the appropriate phase and calls the
corresponding next step. Each step then verifies its conditions and
continues if required.

Part of #41972

---------

Signed-off-by: Tim van der Lippe <tvanderlippe@gmail.com>
Signed-off-by: Tim van der Lippe <TimvdLippe@users.noreply.github.com>
2026-02-11 21:45:14 +00:00
Shubham Gupta
f1ff08ca0e layout: Get rid of LargestContentfulPaintType struct (#42539)
LargestContentfulPaintType is not useful.

Testing: No behaviour change expected

Signed-off-by: Shubham Gupta <shubham13297@gmail.com>
2026-02-11 13:49:59 +00:00
Sebastian C
cb11e797b5 script: cookiestore: implement steps to 'set a cookie' (#42435)
Implements the `set_a_cookie` behavior from the cookiestore spec.

Testing: cookiestore WPT tests cover this

---------

Signed-off-by: Sebastian C <sebsebmc@gmail.com>
2026-02-09 20:16:46 +00:00
Narfinger
c324141fb4 base: This cleans up some old unneeded ignore annotation for MallocSizeOf and updates some descriptions (#42483)
We implemented many more MallocSizeOf tests (even if some such as
channels are zero).
Meaning we can not ignore more of it making the code cleaner.

Signed-off-by: Narfinger <Narfinger@users.noreply.github.com>

Testing: Compilation is the test.

Signed-off-by: Narfinger <Narfinger@users.noreply.github.com>
2026-02-09 17:34:03 +00:00
Tim van der Lippe
cb37480071 script: Fix last remaining base element test (#42339)
This was the last failure in this directory. To fix it, I had to spelunk
into a couple of places:

1. We shouldn't use the `base_element()` of the document, but select the
first base element, regardless if it has an empty href or not
2. We didn't implement target checking for elements. Only some values
are valid and an empty target (which the test also confusingly uses) is
not valid. Hence, it should fallback to the base element
3. We weren't sanitizing the value in case it contains an ASCII tab or
newline + U+003C. This is true for both the form target as well as for
other link elements.

All in all, added a lot more specification text to figure out what was
going on.

Signed-off-by: Tim van der Lippe <tvanderlippe@gmail.com>
2026-02-07 03:36:34 +00:00
Steven Novaryo
42359b26a2 script: Impl UserActivation interface (#42060)
User activation is a concept used to prevents annoying usage of specific
API (Fullscreen API, Virtual Keyboard) to the user by states that the
API needs to have in order to process. This PR implements the
`UserActivation` interface and keep track of the last user interaction.
Each `Window` will keep track the [last activation time
stamp](https://html.spec.whatwg.org/multipage/interaction.html#last-activation-timestamp),
which will be set if there are a triggering input event firing in the
`Window` and propagating across the browsing contexts ancestors and
descendants. These timestamp could be consumed, and the timestamp will
be set to negative infinite.

It is then used to gate some APIs within browser that is determined as
transient activation consuming-gated APIs, which needs transient
activation to be true and consumes the activation. For the purpose of
testing, this PR would implement this behavior on fullscreen API which
is used to test activation consuming behavior.

Spec:
https://html.spec.whatwg.org/multipage/interaction.html#the-useractivation-interface

Testing: Existing WPT

---------

Signed-off-by: Jo Steven Novaryo <steven.novaryo@gmail.com>
2026-02-03 23:20:54 +00:00
Tim van der Lippe
e5af3ee964 script: Fix timing of frozen base URL (#42255)
Make it runs at the correct time and then also performs checks for its
scheme. The CSP check is left for a follow-up PR.

Signed-off-by: Tim van der Lippe <tvanderlippe@gmail.com>
2026-01-31 05:34:59 +00:00
Tim van der Lippe
c0b55a2c34 script: Add about_base_url (#42104)
We populate the required field for all relevant entrypoints
and set it to `document.base_url` when the url is `about:blank`
or `about:srcdoc`. In all other cases, it uses
`document.about_base_url`.

Testing: WPT
Fixes #41836

---------

Signed-off-by: Tim van der Lippe <tvanderlippe@gmail.com>
2026-01-27 18:09:01 +00:00
Steven Novaryo
cc56218b0c script: Update documentation and minor conformance improvement for Fullscreen API (#42068)
Improve the `requestFullscreen` and `exitFullscreen` spec conformance
and notes the todos with comments with issues.

Testing: Existing WPTs

---------

Signed-off-by: Jo Steven Novaryo <steven.novaryo@gmail.com>
2026-01-26 10:01:11 +00:00
Oliver Medhurst
168cd3efde script: Fix unneeded .to_owned() (#42057)
`.to_owned()` is unneeded with `.to_string()`, tiny cleanup
(plus ~meaningless perf/mem win).

Testing: `./mach build --use-crown`

Signed-off-by: Oliver Medhurst <honk@goose.icu>
2026-01-22 05:52:25 +00:00
Tim van der Lippe
62d57d9833 script: Implement navigate to fragment algorithm (#41834)
Part of the navigate algorithm, it now performs the
fragment navigation after the history_behavior is
determined. It also updates the scrolling algorithm
to reflect what the specification expects.

With these changes, the test from the issue now
correctly scrolls to `Target`, but it doesn't update
the `scrollY` value for `window` and hence still
fails the test.

Part of #41807

Signed-off-by: Tim van der Lippe <tvanderlippe@gmail.com>
2026-01-16 07:15:35 +00:00
Tim van der Lippe
9d2715fb3d script: Implement "Location-navigate a location" (#41805)
The existing implementation in `Location::navigate` differs
a lot from the existing spec. Therefore, let's incrementally
make it closer match the spec by implementing the first
step for `SetHref`.

Testing: WPT
Part of #41807

---------

Signed-off-by: Tim van der Lippe <tvanderlippe@gmail.com>
2026-01-13 08:15:21 +00:00
WaterWhisperer
2a759ed6de Replace allow(crown::unrooted_must_root) with expect(crown::unrooted_must_root) (#41815)
Testing: `./mach build -d --use-crown` with no warnings
Fixes: #41761

Signed-off-by: WaterWhisperer <waterwhisperer24@qq.com>
2026-01-10 08:05:49 +00:00
Tim van der Lippe
020f339a3c script: Fix same origin restriction for document.domain (#41780)
Fixes a small WPT test and adds spec comments.

Testing: This change causes
`/html/browsers/origin/relaxing-the-same-origin-restriction/document_domain.html`
to start passing.

Signed-off-by: Tim van der Lippe <tvanderlippe@gmail.com>
2026-01-08 21:03:12 +00:00
Sam
89067e5450 script: Pass &mut JSContext to tasks (#41756)
This change is reviewable per commits:
In first commit we added `&mut JSContext` to `run_box` (it is very hard
to bring `&mut JSContext` to `remove_script_and_layout_blocker`).
In second commit we pass `&mut JSContext` to `run_once`.
In third commit we added support for accepting `&mut JSContext` in
closures of `task!` macro and lastly we demo new macro invocations (to
ensure they actually compile)

Testing: Just refactor, but should be covered by WPT
Part of #40600

---------

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
2026-01-08 07:49:27 +00:00
Tim van der Lippe
e2d62531f5 script: Consolidate global initialization for fetch requests (#41663)
Rather than having each callside specifying the relevant
information from the GlobalScope, do this via a trait instead.
This would have saved us quite a bit of test debugging
since we would often forget to set relevant information
from the global context for a request.

Now, in the future when we need additional information from
the globalscope for a request, we only need to update this
method to make that happen.

Previously it would also sometimes use `document`, but
calling the relevant information on either `document` or
`globalscope` doesn't matter, since the `globalscope`
defers to the value from the `document` anyways.

Signed-off-by: Tim van der Lippe <tvanderlippe@gmail.com>
2026-01-07 13:22:03 +00:00
Narfinger
384db99444 Base: Implement GenericReceiverSet (#41071)
This implements GenericReceiverSet similar to IpcReceiverSet. This
allows us to wait on a group of channels.

IpcReceiverSet was allowed to use IpcReceivers of different type, i.e.,
`IpcReceiver<Foo>` and `IpcReceiver<Bar>` in the same select query. This
changes with GenericReceiverSet to only allow one type, i.e.,
`GenericReceiver<Foo>`. As this functionality was only used in the
CoreResourceThread, we changed the setup slightly for the memory
reporter.

With this we also change the implementation of CoreResourceThread to now
use the GenericReceiverSet.

Signed-off-by: Narfinger <Narfinger@users.noreply.github.com>

Testing: New testcases were added to GenericReceiverSet and browsing
works normally.

---------

Signed-off-by: Narfinger <Narfinger@users.noreply.github.com>
Signed-off-by: Josh Matthews <josh@joshmatthews.net>
Co-authored-by: Josh Matthews <josh@joshmatthews.net>
2026-01-07 01:27:42 +00:00
Tim van der Lippe
2480eaac83 script: Fix fetch-later length and quota computation (#41665)
The specification isn't complete here and thus we
were missing WPT coverage. Spec will be updated.

Also, we are correctly throwing the QuotaExceededError with relevant
information, while Chrome sets both
fields to `null`. Therefore, the test now allows for both (since
providing relevant information is good for the developer and recommended
in the spec [1]).

[1]: https://webidl.spec.whatwg.org/#ref-for-quotaexceedederror%E2%91%A2

Signed-off-by: Tim van der Lippe <tvanderlippe@gmail.com>
2026-01-05 19:00:32 +00:00
Tim van der Lippe
de27dc69e5 Implement pending preload responses with futures (#40059)
This implements waiting for pending preloads, where the preload request
is still fetching the result when the second "real" request is started.
It is
implemented by storing responses in the `SharedPreloadedResources`
which is communicated via `PreloadId` send to the `CoreResourceManager`.

Part of #35035

---------

Signed-off-by: Tim van der Lippe <tvanderlippe@gmail.com>
Signed-off-by: Josh Matthews <josh@joshmatthews.net>
Co-authored-by: Josh Matthews <josh@joshmatthews.net>
2026-01-04 12:22:54 +00:00
Tim van der Lippe
551684f3af script: Introduce concept of a fetch group (#41423)
We now keep track of deferred fetches in globalscope
rather than in document loader. This matches what
the spec expects with its concept of a fetchgroup.

Cancellations are still present in a document loader
and don't match yet all places where we perform fetches.
Therefore, these will leave in document loader for now
until we rearranged the fetch record tracking in the
fetch group (which is a separate field from deferred
fetches).

Fixes #41286

Signed-off-by: Tim van der Lippe <tvanderlippe@gmail.com>
2025-12-29 12:50:30 +00:00
WaterWhisperer
6623cc1dbb feat: gamepad feature flag (#41451)
Put the Gamepad API and its supporting infrastructure behind a `gamepad`
feature flag. This allows embedders to opt-out of gamepad support at
compile time to save on binary size and reduce dependencies.

Testing:
1. `./mach build -d` (Gamepad enabled by default)
2. `cargo build -p servoshell --no-default-features --features
"libservo/clipboard,js_jit,max_log_level,webgpu"` (Gamepad Disabled)
3. `cargo build -p servoshell --features "gamepad,webxr,..."` (Gamepad &
WebXR Enabled)

Fixes: #40897

Signed-off-by: WaterWhisperer <waterwhisperer24@qq.com>
2025-12-21 13:18:06 +00:00
Simon Wülker
b0734b7f2d script: Make same-origin iframes inherit encoding from their container document (#41450)
Testing: new tests start to pass
Part of https://github.com/servo/servo/issues/6414

---------

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
2025-12-21 11:03:30 +00:00
Tim van der Lippe
fbbfea43d6 script: Implement destroying of top-level navigable (#41355)
Another step towards being spec-compatible. Right now
we can't destroy an unsalvagable document during unloading,
as that breaks all kinds of tests. Before that, we need
to update various machinery to handle destroying correctly.

The first one is a top-level navigable, which explicitly
destroys a document after it is unloaded.

Part of #31973

Signed-off-by: Tim van der Lippe <tvanderlippe@gmail.com>
2025-12-19 16:30:49 +00:00
Tim van der Lippe
b8ea560b47 script: Implement quota computation for deferred fetches (#41408)
For all upcoming and already-processed deferred fetches, we now
implement a quota. We don't support policy headers yet to configure the
quota, hence we use the default quota. That's why we have some tests
failing again.

It involves computing which document to compute the quota for, as well
as computing total length of requests. Additionally, the DevTools
computation for headers now uses the same logic for headers as deferred
fetches.

Signed-off-by: Tim van der Lippe <tvanderlippe@gmail.com>
2025-12-19 16:24:18 +00:00
Simon Wülker
8c344f5641 script: Prescan byte stream to determine encoding before parsing document (#41376)
Servo currently completely ignores `<meta charset>` tags. When we find
one with an encoding that is incompatible to the current one, then we
should reload the page and start over with the new encoding. A common
optimization that has even made its way into the specification is to
wait for a few bytes to arrive and inspect them for `meta` tags, so the
browser is able to use the correct encoding from the very beginng.

In practice, I've run into problems with our WPT harness when reloading
the page after `meta` tags. Therefore, this change implement the
optimization first, so we never have to reload when running WPT. I've
implemented prescanning in a way where we wait for 1024 bytes to arrive
or for one second to pass, whichever one happens first.

This causes a large number of web platform tests to flip around. I've
looked at most of the new failures and I believe they're reasonable.

Testing: New tests start to pass.
Part of https://github.com/servo/servo/issues/6414

---------

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
2025-12-19 09:54:19 +00:00
Tim van der Lippe
5b6509f279 script: Implement customElementRegistry support for document.importNode (#41385)
This method now allows you to pass in a custom registry. The registry
isn't used yet for callers, since we don't support scoped registries.
However, as we now pass in the registry to `Node::clone`, we set the
registry when creating elements and cloning them.

As such, various tests start passing where we set the registry. Some
tests started failing, but they rely on scoped registries which we don't
support yet. These tests thus flipped: those that were erroneously
failing are now passing and vice versa.

Part of #34319

Signed-off-by: Tim van der Lippe <tvanderlippe@gmail.com>
2025-12-19 09:01:08 +00:00
Tim van der Lippe
e35a4c81d7 script: Implement destroying of documents (#41346)
The specification has a dedicated method for destroying
documents. Parts of that method were scattered around
various parts of Servo machinery.

This patch consolidates these steps and follow the spec.
Additionally, it now correctly unloads iframes when
they are removed from a parent document.

As a result, the fetch-later WPT test now passes, as
it relies on the correct ordering of iframe unloading
to verify the fetch-later requests are sent.

Part of #31973

Signed-off-by: Tim van der Lippe <tvanderlippe@gmail.com>
2025-12-19 07:12:46 +00:00
Tim van der Lippe
3199477f01 script: Implement storing deferred fetches (#41232)
This is the first part of preparation for implementing the keepalive
flag for requests. It requires implementation of the concept of a task
group, which we already sort of have with `DocumentLoader`. Therefore,
we currently already cancel any loads, which should be updated to
ignored kept-alive requests.

However, termination also requires storing of deferred fetches, which
are also kept-alive. Therefore, to distinguish the two, we need to store
them separately as stated with the TODO.

In a follow-up, we can then skip canceling keep-alive requests for both
`navigator.sendBeacon` (which aren't deferred) and `fetchLater` (which
are deferred).

Part of #41230

Signed-off-by: Tim van der Lippe <tvanderlippe@gmail.com>
2025-12-16 19:32:52 +00:00
Martin Robinson
824f551f03 Rename IOCompositor to Paint (#41176)
For a long time, the "Compositor" hasn't done any compositing. This is
handled by WebRender. In addition the "Compositor" does many other
tasks. This change renames `IOCompositor` to `Paint`.

`Paint` is Servo's paint subsystem and contains multiple `Painter`s.
This change does not rename the crate; that will be done in a
followup change.

Testing: This just renames types and updates comments, so no new tests
are necessary.

---------

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
2025-12-10 15:09:49 +00:00
Anonmiraj
b207be05d9 change some allows to expects (#41040)
Changed some allow to expects and removed the unfulfilled expectations.

Testing: Refactor
Part of: #40383

Signed-off-by: anonmiraj <nabilmalek48@gmail.com>
2025-12-05 07:23:32 +00:00
Steven Novaryo
e05e9730e7 dom: Focus scroll to the element only if it is not visible (#40447)
Currently when we call a `Focus` we always scroll a focusable element to
the center of the container. However, this would causes a different
behavior where UAs wouldn't scroll when a focus is called to a visible
element. This PR add implementations following the behavior of Firefox
[nsFocusManager::ScrollIntoView](e613f4df35/dom/base/nsFocusManager.cpp (L3121)),
where we are scrolling to the element if it is not visible.

This would enhance the user experience of focusing an input element,
where we should avoid moving the element if it is visible.

Incidentally fix a calculation bug for the calculation of
`ScrollIntoView` with `nearest` block or inline option.

Testing: Private WPT for the implementation defined behavior and public
WPT for the bug.

---------

Signed-off-by: Jo Steven Novaryo <steven.novaryo@gmail.com>
2025-11-28 01:52:21 +00:00
Oriol Brufau
c6c0f75452 script: Stop assuming that previous dirty root is still connected (#40922)
We were trying to update the dirty root to be the common ancestor of the
old dirty root and the element noted with dirty descendants. But that
would panic if when the old dirty root had been disconnected.

In that case, just set the dirty root to be the element, as if the old
dirty root was None.

Testing: Adding a crashtest, and one existing test now fails instead of
crashing
Fixes: #40920

Signed-off-by: Oriol Brufau <obrufau@igalia.com>
2025-11-27 14:40:12 +00:00
Josh Matthews
bbbfe6d299 fonts: Add WebFontDocumentContext for CSS Fonts 4 font fetching (#40301)
Rebase of #37021 with review comments applied. These changes bundle up
the required information from the relevant global when a stylesheet is
added so that any requests for web fonts match the specification.

Testing: Newly passing tests.
Fixes: #36590

---------

Signed-off-by: Uthman Yahaya Baba <uthmanyahayababa@gmail.com>
Signed-off-by: Josh Matthews <josh@joshmatthews.net>
Co-authored-by: Uthman Yahaya Baba <uthmanyahayababa@gmail.com>
2025-11-23 07:45:24 +00:00