Commit graph

28643 commits

Author SHA1 Message Date
Andrei Volykhin
06b5422abf
htmlvideoelement: Fix poster frame processing algorithm (#37533)
According to HTML specification the poster attribute determines the
element's poster frame
(regardless of the value of the element's show poster flag).
https://html.spec.whatwg.org/multipage/#poster-frame

So the poster frame and the show poster flag is orthogonal to each
other, the latest one only controls
when browser should display the poster frame and should do not block
accepting video frames
from media pipeline (e.g. on new_preroll callback from video sink).

During layout the video element should select the current frame which
will be presented
based on first matching condition from the list:

https://html.spec.whatwg.org/multipage/#the-video-element:the-video-element-7

Testing: Improvements in the following WPT tests
- html/canvas/element/manual/imagebitmap/createImageBitmap*
- html/semantics/embedded-content/the-canvas-element/*

Fixes: #37165

---------

Signed-off-by: Andrei Volykhin <andrei.volykhin@gmail.com>
Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Co-authored-by: Martin Robinson <mrobinson@igalia.com>
2025-06-19 09:55:10 +00:00
batu_hoang
d0100797e8
[webdriver] Move Webdriver to ServoShell (#36714)
Moving `webdriver` to `servoshell`:

- Let `servoshell` manage lifecycle of `webdriver`
- One by one, move the handling of webdriver commands from
`constellation` to `embedder`

Partially fix: https://github.com/servo/servo/issues/37370
Partially fix webdriver test timeout with `no_top_browsing_context`

cc: @xiaochengh

---------

Signed-off-by: batu_hoang <longvatrong111@gmail.com>
2025-06-19 09:52:01 +00:00
Narfinger
d55e2c4c90
Profile: Resident Segments was not correctly parsing /proc/self/smaps as the regexp did not work anymore. (#37549)
Resident Segments was not being correctly parsed because the regexp
changed.

Testing: I do not think memory reporting has testcases. We keep the old
output intact (i.e., resident) while adding the new output
`resident-according-to-smaps` which was previously evaluated to an empty
vector on linux. Other targets always return the empty vector.

Signed-off-by: Narfinger <Narfinger@users.noreply.github.com>
2025-06-19 09:19:31 +00:00
Kenzie Raditya Tirtarahardja
55730e99df
script: Reverse wheel event delta sign to match specification-defined behavior (#37461)
Fix wheel event, either dispatched from window or webdriver:
- Positive deltaY means scrolling down, negative deltaY means scrolling
up
- Positive deltaX means scrolling right, negative deltaX means scrolling
left

Tests: Many scrolling interaction test will depend on this.

Signed-off-by: PotatoCP <kenzieradityatirtarahardja18@gmail.com>
2025-06-19 07:45:10 +00:00
Jason Tsai
07ecf34e64
feat(script): parse script element importmap type (#37547)
Support parsing script element to `importmap` type

Testing: Pass WPT
Fixes: part of https://github.com/servo/servo/issues/37316

Signed-off-by: Jason Tsai <git@pews.dev>
2025-06-19 07:06:18 +00:00
batu_hoang
49be5ca05a
Implement webdriver release action (#37484)
- Implement webdriver release action.
- Improve `Input Cancel List`.

Testing: `./mach test-wpt -r --product servodriver
./tests/wpt/tests/webdriver/tests/classic/release_actions/sequence.py`

cc: @xiaochengh

---------

Signed-off-by: batu_hoang <longvatrong111@gmail.com>
2025-06-19 07:03:38 +00:00
Euclid Ye
212ce933e5
script::webdriver_handlers: Implement "get a known shadow root" (#37546)
Implement "get a known shadow root" and reduce some duplication
This is still a preparation PR to ["find element(s) from shadow
root"](https://w3c.github.io/webdriver/#find-element-from-shadow-root)

Testing: No Behaviour change.

---------

Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com>
2025-06-19 05:32:17 +00:00
Ashwin Naren
ed9a79f3f4
Initial IndexedDB Support (#33044)
Adds indexeddb support to servo. At the moment heed is being used as the
backend, although this can be swapped out by implementing `KvsEngine`.
This PR adds a thread + a thread pool for Indexeddb related operations.
Also `database_access_task_source` is added for Indexeddb related
operations.

This is a partial rewrite of #25214. (Reopened due to branching issue)

Fixes #6963

---------

Signed-off-by: Ashwin Naren <arihant2math@gmail.com>
Signed-off-by: Josh Matthews <josh@joshmatthews.net>
Co-authored-by: Rasmus Viitanen <rasviitanen@gmail.com>
Co-authored-by: Josh Matthews <josh@joshmatthews.net>
2025-06-19 05:19:07 +00:00
Bhuwan Pandit
04bcafa140
chore: Simplify tracing with servo_tracing macro (#36661) (#37497)
This pull request refactors existing tracing annotations to leverage the
new `servo_tracing::instrument` macro introduced in #36573.

Specifically, the following transformations were applied:
- Removed `#[cfg_attr(feature = "tracing", ...)]` wrappers.
- Replaced `tracing::instrument` with `servo_tracing::instrument`.
- Removed `level = "trace"`
- Removed `fields(servo_profiling = true)` from tracing attributes
however retained others like `name`. `skip type`

Closes: #36661

---------

Signed-off-by: Bhuwan Pandit <bhuwanpandit109@gmail.com>
Signed-off-by: Jonathan Schwender <55576758+jschwe@users.noreply.github.com>
Co-authored-by: Jonathan Schwender <55576758+jschwe@users.noreply.github.com>
2025-06-18 16:18:04 +00:00
Martin Robinson
bdf8c0ebc8
layout: Do not add empty border images to the display list (#37534)
Zero-sized gradient border images cause WebRender to panic, so simply
don't add them to the display list.

Testing: This change adds a WPT crash test.
Fixes: #37432

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
2025-06-18 15:53:29 +00:00
Taym Haddadi
fc2135cc02
implement Writablestreamdefaultcontroller abortcontroller (#37511)
using abort signal and abortcontroller in
Writablestreamdefaultcontroller

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

---------

Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com>
2025-06-18 15:26:05 +00:00
Euclid Ye
3ee339eb6d
script::webdriver_handler: Fully implement get_known_element (#37532)
1. `get_known_element`: Refactor to follow same step of spec (which
reduces unnecessary search) and implement previously missing step 4.2:
If node is stale return error with error code stale element reference.
An element is stale if its node document is not the active document or
if it is not connected.

2. Refactor `find_node_by_unique_id_in_document` to make it not check
error and really return a `Option<DomRoot<Node>>` as the name suggests.
This will greatly reduce duplication when implement [get a known shadow
root](https://w3c.github.io/webdriver/#dfn-get-a-known-shadow-root) soon

Testing: All WebDriver Conformance test after removing two problematic
commits in #37520

Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com>
2025-06-18 14:43:07 +00:00
Domenico Rizzo
b3c66f4ff4
[#26488] Improves WebGLBuffer drop impl (#37512)
Testing: No tests added
Fixes: Partially #26488

---------

Signed-off-by: Domenico Rizzo <domenico.rizzo@gmail.com>
2025-06-18 12:14:16 +00:00
Tony
b9fcc95992
libservo: Allow embedders to signal when the cursor has left the WebView (#37317)
Currently, the hover state will stay when the mouse moves out of the
webview, this PR fixes it

Testing: Hover on the `About` on servo.org, and then move the mouse up
to the browser UI, see the hover state resets

Signed-off-by: Tony <legendmastertony@gmail.com>
2025-06-18 11:59:11 +00:00
shuppy
0896341285
Devtools: refactor source actor state (#37528)
We currently store the source contents in both the SourceActor and the
ThreadActor’s SourceManager, which is redundant. We also currently send
the source contents in thread `sources` responses and watcher
`resources-available-array` messages, but in both cases this is
unnecessary (and ignored by the client).

This patch merges SourceData into SourceActor, making the latter the
single source of truth for source-related state. We also create a
SourceForm type, which represents the subset of source-related state
that gets sent in thread `sources` responses (and for now, watcher
`resources-available-array` messages).

Finally we rename `source_urls` → `source_actor_names` and `new_source`
→ `new_registered` for clarity.

Testing: no changes to client-facing behaviour, and this is covered by
tests

Signed-off-by: Delan Azabani <dazabani@igalia.com>
Co-authored-by: atbrakhi <atbrakhi@igalia.com>
2025-06-18 11:11:46 +00:00
Kenzie Raditya Tirtarahardja
cdc8b45965
[WebDriver] Add synchronization for key action (#37403)
Implement action synchronization for key event. Previously only done for
pointer https://github.com/servo/servo/pull/36932 and wheel
https://github.com/servo/servo/pull/37260.

---------

Signed-off-by: PotatoCP <kenzieradityatirtarahardja18@gmail.com>
2025-06-18 07:26:44 +00:00
Jason Tsai
f97cdb4d12
feat(script): register import map (#37504)
- Register import map when preparing HTML script element
- Added `import_map` to `GlobalScope`

Testing: should pass existing WPT
Fixes: part of https://github.com/servo/servo/issues/37316

---------

Signed-off-by: Jason Tsai <git@pews.dev>
2025-06-18 07:12:57 +00:00
Andrei Volykhin
d8c552f3ab
pixels: Multiply by alpha with less loss of precision (#37503)
Integer color components representation has performance and memory
storage benefits
but suffers from precision loss after multiple consequence alpha
(un)premultiply operations.

Rounding any fractional bits (to the nearest integer) during alpha
multiplication should reduce the loss of precision.
Expensive division will be replaced by multiplication and bits shift.

https://research.swtch.com/divmult

https://docs.google.com/document/d/1tNrMWShq55rfltcZxAx1N-6f82Dt7MWLDHm-5GQVEnE

Other browsers and graphics libraries have the similar approach:

- Chromium (Skia):
https://github.com/google/skia/blob/main/include/private/base/SkMath.h#L73
- Firefox:
https://github.com/mozilla/gecko-dev/blob/master/gfx/2d/Swizzle.cpp#L276
- Servo (Raqote):
https://github.com/jrmuizel/sw-composite/blob/master/src/lib.rs#L878

Testing: Improvements in the following WPT test
-
html/canvas/element/manual/imagebitmap/createImageBitmap-premultiplyAlpha.html

Signed-off-by: Andrei Volykhin <andrei.volykhin@gmail.com>
2025-06-18 06:52:42 +00:00
Euclid Ye
e26532e19b
webdriver_server: Implement find element(s) from element according to spec (#37521)
Report `InvalidArgument` and `NoSuchElement` properly for [Find Element
from
Element](https://w3c.github.io/webdriver/#find-element-from-element) +
[Find Elements from
Element](https://w3c.github.io/webdriver/#find-elements-from-element)

Testing: `./mach test-wpt -r
.\tests\wpt\tests\webdriver\tests\classic\element_click
.\tests\wpt\tests\webdriver\tests\classic\find_* --product servodriver`

---------

Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com>
2025-06-18 06:39:55 +00:00
Kenzie Raditya Tirtarahardja
96ef92b9ac
Implement scroll event (#36687)
Reimplementation of https://github.com/servo/servo/pull/35105.

test: `tests/wpt/tests/pointerevents/{pointerevent_hit_test_scroll,
pointerevent_hit_test_scroll_visible_decendant}.html` (after
https://github.com/servo/servo/pull/37461)

Signed-off-by: PotatoCP <kenzieradityatirtarahardja.18@gmail.com>
Co-authored-by: PotatoCP <kenzieradityatirtarahardja.18@gmail.com>
Co-authored-by: Asun0204 <asun0204@163.com>
2025-06-18 06:05:45 +00:00
batu_hoang
152467bc67
Webdriver get focused webview id only request once (#37506)
The retry in previous implementation doesn't have a good reason, it
seems like webdriver just want to try its luck.
If get focused webview return None, better just return it.
There is a case webdriver still runs when all webview are closed.

cc: @xiaochengh

Signed-off-by: batu_hoang <longvatrong111@gmail.com>
2025-06-18 03:51:08 +00:00
Domenico Rizzo
50531026a8
[#26488] Makes RTCPeerConnection weak referenceable thorugh Binding.conf (#37518)
This PR fixes some mistakes introduced in
https://github.com/servo/servo/pull/37332. Where Binding.conf and
WeakReferenceable trait were used badly

Testing: No test introduces
Fixes: It fixes mistake introduced in the incrementally implementation
of #26488

Signed-off-by: Domenico Rizzo <domenico.rizzo@gmail.com>
2025-06-17 23:42:22 +00:00
Ville Lindholm
07c33a180c
fix(xpath): pass in correct context node for // and / in predicates (#37434)
For example `div[count(//p)]` should count all `<p>` elements in the
document, not just the ones underneath the `<div>`.

Testing: WPT tests cover this, the fix makes two more test pass.

Signed-off-by: Ville Lindholm <ville@lindholm.dev>
2025-06-17 18:45:00 +00:00
Martin Robinson
56e901d0c2
compositor: Always send an animating tick when a pipeline starts animating (#37507)
Instead of taking into account whether the entire WebView starts
animating, always send an animation tick when a pipeline moves from the
"not animating" to "animating" state. It could be that the WebView was
animating, but not painting if the animation was not producing display
lists. In that case, the required tick would never come, because it is
sent after a repaint.

Testing: Added a new WPT test.
Fixes: #37458.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Co-authored-by: Oriol Brufau <obrufau@igalia.com>
2025-06-17 17:47:42 +00:00
Euclid Ye
f22c273ea9
script::webdriver_handlers: Replace find_node_by_unique_id with get_known_element (#37502)
Implement previously missing step 3 of [get a known
element](https://w3c.github.io/webdriver/#dfn-get-a-known-element): "If
node is not null and node does not implement Element, return error with
error code no such element"

Testing: All webdriver conformance test

---------

Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com>
2025-06-17 15:23:59 +00:00
Narfinger
6159a11905
OHOS: Fixed some clippy lints (#37510)
Fixed some clippy lints which were in the OHOS code.

Testing: Normal testcases apply and changes are trivial.

Signed-off-by: Narfinger <Narfinger@users.noreply.github.com>
2025-06-17 14:09:37 +00:00
Simon Wülker
f29eee5356
Make layout build a display list when the highlighted DOM node changed (#37501)
Highlights from the devtools trigger reflows. Previously, incremental
layout would notice that nothing about the box tree changed and skip
generating a new display list. This caused the highlights to never be
painted.

Forcing a new DL in this case makes reflows that happen *while* there is
a highlighted DOM node (which did not change since the last reflow)
slightly less efficient. We could check if the highlighted node changed
and only force a new display list if it did, but I'm not sure if
`OpaqueNode`s can be compared like that. It also seems like a very niche
issue.

Testing: This is hard to test for, so there are no tests.
Fixes https://github.com/servo/servo/issues/37500.

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
2025-06-17 11:14:41 +00:00
Martin Robinson
c0970ea655
compositor: Wait for both Script and the Constellation when shutting down Pipelines (#37505)
Previously, the Constellation would immediately ask the Compositor to
shut down a pipeline, even before the ScriptThread finished shutting it
down. This meant that the Compositor might remove a Pipeline and then
re-add it if the ScriptThread sent a Pipeline-related message (such as a
new display list) in the meantime.

This change makes it so that the Compositor waits for both the
Constellation and the ScriptThread to finish shutting down a Pipeline
before removing its data. In addition, the Constellation no longer
synchronously waits on the Compositor when shutting down Pipelines. This
was important when the Compositor would talk to the ScriptThread
directly, but isn't necessary any longer.

Testing: This is very hard to test, because it depends on the creation
and destruction of many iframes and the particular timing of of all
the messaging between Servo bits. That said, this was tested manually
by observing the completion of Speedometer 2.1.
Fixes: #37458.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Co-authored-by: Oriol Brufau <obrufau@igalia.com>
2025-06-17 09:56:31 +00:00
Andrei Volykhin
1bd8f38810
imagebitmap: Resolve promise with ImageBitmap on bitmap task source (#37488)
Follow the ImageBitmap specification and use the global scope bitmap
task source
to fulfill resolved promise (asynchronously). 
https://html.spec.whatwg.org/multipage/#bitmap-task-source

Any promise rejection must be done synchronously.

Testing: Improvements in the following WPT test
-
html/canvas/element/manual/imagebitmap/createImageBitmap-resolves-in-task.any.js

Fixes (partially): #34112

Signed-off-by: Andrei Volykhin <andrei.volykhin@gmail.com>
2025-06-17 08:19:32 +00:00
Simon Wülker
048de52238
Don't allocate in Dom::trace even when debug assertions are enabled (#37487)
`Dom::trace` currently allocates a new string when debug assertions are
enabled:

0f61361e27/components/script_bindings/root.rs (L232-L241)

This allocation is very heavy in profiles (~14% of runtime). While it
doesn't affect production builds, these few characters are not providing
enough value to justify the cost.

This changes the method to instead only use `std::any::type_name`,
without `format!`. With this change, all the string-format related
methods vanish from the profile.

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
2025-06-16 17:32:33 +00:00
Euclid Ye
f60e9cdff5
layout: capitalize string for TextTransformCase::Capitalize in fn rendered_text_collection_steps (#37486)
Previously, `rendered_text_collection_steps` ignores
`TextTransformCase::Capitalize` due to limitation of iterator. Now we
handle the case outside.

Testing: Added a new test as not covered by existing wpt-test, except
for the indirectly related WebDriver test.
`./mach test-wpt -r
tests\wpt\tests\webdriver\tests\classic\get_element_text\get.py
--product servodriver`

Fixes: #37469

---------

Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com>
2025-06-16 14:12:07 +00:00
webbeef
910cc0b687
Fix panic in formelement.rs (#37459)
Use borrowing directly with iterators instead of holding the borrowed
value for a longer scope.

Testing: Covered by existing tests, and manual testing with the test
case from https://github.com/servo/servo/issues/37430
Fixes: https://github.com/servo/servo/issues/37430

Signed-off-by: webbeef <me@webbeef.org>
2025-06-16 12:41:37 +00:00
Andrei Volykhin
bcade589e7
imagebitmap: Crop bitmap data with formatting (#37397)
Follow the ImageBitmap specification and make cropping of the bitmap
data to the source rectangle with formatting:
https://html.spec.whatwg.org/multipage/#cropped-to-the-source-rectangle-with-formatting

For now the next functionality not implemented:
- image orientation support (such as EXIF metadata)
- color space conversion (image, blob)

The convertion from ResizeQuality to "image" FilterType:
 - pixelated/low/medium/high -> Nearest/Triangle/CatmullRom/Lanczos3

Other browsers use the following sample filtering:
 - chromium (skia): Nearest/Linear/Linear/CatmullRom
 - firefox (skia): Lanczos3

Testing: Improvements in the following WPT tests
 - html/canvas/element/manual/imagebitmap/*

Fixes (partially): #34112

Signed-off-by: Andrei Volykhin <andrei.volykhin@gmail.com>
2025-06-16 12:09:04 +00:00
Martin Robinson
0f61361e27
layout: Unify scrollable overflow calculation and include position: absolute (#37475)
Previously, layout was handling scrollable overflow and srolling area
calculation separately, only excluding the "unreachable scrollable
overflow region" at the last step. In addition, `position: absolute` was
not included in scrollable overflow calculation.

This change combines the two concepts into a single scrollable overflow
calculation and starts taking into account `position: absolute`.
Finally, `BoxFragment::scrollable_overflow_for_parent` is converted to
use early returns which reduces the amount of indentation.

Fixes #35928.
Fixes #37204.
Testing: This causes some WPT test to pass, but also two to start
failing:
- `/css/css-masking/clip-path/clip-path-fixed-scroll.html`: This seems
to fail
because script is scrolling past the boundaries of the document. This is
a
failure that was uncovered by the fixed element now being added to the
   page's scroll area.
- `/css/css-overflow/overflow-outside-padding.html`: One test has
started to fail
here because now the absolutely positioned element is included in the
scroll area,
and I think there is an issue with how we are placing RTL items with
negative margins.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
2025-06-16 11:30:31 +00:00
Martin Robinson
29e618dcf7
fonts: Start using fontations to read font tables (#37287)
Use `read-fonts` to read font tables for FreeType fonts. This is the
first step to using fontations throughout Servo. The main benefit here
is that we no longer need to provide our own table data structures and
we can read tables from these fonts without making copies of the table
contents.

Testing: This should not change observable behavior and is covered by
existing WPT tests. I have run some manual microbenchmarks and have not
noticed any changes in performance that are larger than the general
noise.
This adds a new memory map of the font file for local fonts, but this
should be very cheap as FreeType is already doing this internally and
subsequent maps should just reuuse the existing memory-mapped file.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
2025-06-16 11:29:50 +00:00
batu_hoang
1044f8fbf5
Revert "Remove duplication in dispatch_pending_point_input_events" (#37482)
Revert "Remove duplication in dispatch_pending_point_input_events"
(https://github.com/servo/servo/pull/37426) which causes a serious bug.

Signed-off-by: batu_hoang <longvatrong111@gmail.com>
2025-06-16 08:36:05 +00:00
Narfinger
3b73b83a9f
Allow OHOS servoshell to have a simple multiple tab implementation. (#36891)
Currently we just pause the compositor and replace the window in it
while having separate bookkeeping to remember which window belongs to
which tab.
Currently there are no tests for OHOS, so we cannot test the changes.

---------

Signed-off-by: Narfinger <Narfinger@users.noreply.github.com>
Co-authored-by: Jonathan Schwender <55576758+jschwe@users.noreply.github.com>
2025-06-16 08:17:31 +00:00
Ngo Iok Ui (Wu Yu Wei)
e69962e646
canvas: prevent unwrap on offscreen canvas (#37460)
Remove all unwrap usage on offscreen canvas to prevent panic.

Testing:
`tests/wpt/tests/html/canvas/offscreen/manual/the-offscreen-canvas/offscreencanvas.transfercontrol.to.offscreen-crash.html`
Fixes: #37415

---------

Signed-off-by: Wu Yu Wei <yuweiwu@pm.me>
Signed-off-by: Yu Wei Wu <yuweiwu@YunoMacBook-Air.local>
Co-authored-by: Yu Wei Wu <yuweiwu@YunoMacBook-Air.local>
2025-06-16 05:39:56 +00:00
Euclid Ye
f8f7c6ebd1
[WebDriver] Properly report error for find_element & find_elements; Get correct visible text when matching links (#37452)
1. Properly report new types of errors for `find_element` and
`find_elements`. Previously never reported.
1.1. `InvalidSelector`
1.2. `NoSuchElement`
1.3. `InvalidArgument`

2. Get the visible text for `<a>` correctly in
`script::webdriver_handler` so that matching would work.

Testing: `./mach test-wpt -r --log-raw "D:\servo test log\all.txt"
webdriver/tests/classic/find_element/find.py
webdriver/tests/classic/find_elements/find.py --product servodriver`

---------

Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com>
2025-06-16 05:23:26 +00:00
Simon Wülker
62b078dd62
Remove "isInitial" argument from memberInit (#37477)
This argument is always `True`.

Testing: Correct generation of dictionary binding code should be covered
by wpt

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
2025-06-15 23:19:48 +00:00
Simon Wülker
9d10e41a1a
Don't count <img> elements with both name and id twice in document's named getter (#37455)
A document's named getter collects elements with either matching name or
id's (varies per element type) and returns them .

We implement this the following way:
* Create an iterator with elements whose `name` attribute matches
* Create an iterator with elements whose `id` attribute matches
* Concatenate both

The spec then asks us if there is more than one element in the list,
which we implement by checking whether the iterator returns `None` after
we get the first element. However, the same element can appear in both
iterators if it is a `img` element and both it's name and id attribute
match. Therefore, we need to check if there are more elements *which are
not equal to the first one*.

Testing: New web platform tests pass

---------

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
2025-06-15 18:54:53 +00:00
Oriol Brufau
ae20cdbdc9
layout: Ensure that min/max-content sizes ignore sizing properties (#37464)
This amends #37457 so that the min-content and max-content inline sizes
of a replaced element stop depending on the value of the inline sizing
properties.

In practice I don't think this has any observable effect, but now the
code obeys https://drafts.csswg.org/css-sizing-3/#intrinsic-sizes, and
it's simpler.

Testing: Unneeded

Signed-off-by: Oriol Brufau <obrufau@igalia.com>
2025-06-15 16:11:18 +00:00
Tim van der Lippe
f2d0be1b9a
script: Fix check for document root when targeting CSP events (#37474)
The check was incorrect, where it was never matching and always
discarding the element. Instead, we should check the owner document,
which is the shadow-including root of the node.

Part of #4577

---------

Signed-off-by: Tim van der Lippe <tvanderlippe@gmail.com>
2025-06-15 14:54:41 +00:00
Tim van der Lippe
576c7445b8
Use DOMString for internal data of Trusted Types (#37472)
This avoids various conversions back and forth between DOMString and
String. By using DOMString consistently, we avoid these
double-conversions. The only caveat are the USVString which are
initially passed into
TrustedScriptURL.

Part of #36258

Signed-off-by: Tim van der Lippe <tvanderlippe@gmail.com>
2025-06-15 14:12:33 +00:00
Tim van der Lippe
dfbd5b7d21
Modularize security_manager by moving report logic (#37347)
Move all report structs into the same file, to
keep them consistent and reuse functions such as stripping
of the URL and serialization of disposition. This is part
of modularizing security_manager, which contained various
logic related to CSP.

Part of #4577

Signed-off-by: Tim van der Lippe <tvanderlippe@gmail.com>
2025-06-15 14:10:19 +00:00
Xiaocheng Hu
f09042340c
Stop DedicatedWorker from handling remaining messages after closed (#37471)
Stop DedicatedWorker from handling remaining messages after closed

Testing: WPT workers/WorkerGlobalScope-close.html

Signed-off-by: Xiaocheng Hu <xiaochengh.work@gmail.com>
2025-06-15 08:09:08 +00:00
Euclid Ye
9352a9db7c
script: Support webdriver's Get Element Text operation for non-HTML elements (#37470)
Fix `WebDriverScriptCommand::GetElementText` similar to
https://github.com/servo/servo/pull/37452#discussion_r2146350739, by
correctly retrieving rendered text.

Testing: `./mach test-wpt -r --log-raw "D:\servo test
log\gt_ele_txt.txt" webdriver/tests/classic/get_element_text --product
servodriver`

Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com>
2025-06-15 05:32:29 +00:00
batu_hoang
810c0e6891
Remove duplication in dispatch_pending_point_input_events (#37426)
Follow up to:
https://github.com/servo/servo/pull/37285#pullrequestreview-2916829212,
this PR removes duplicate code.
cc: @xiaochengh

---------

Signed-off-by: batu_hoang <longvatrong111@gmail.com>
2025-06-15 05:32:13 +00:00
Euclid Ye
5d42ab05fb
[WebDriver] Improve get active element (#37425)
Report `NoSuchElement` if the active element is null, according to spec.

Testing: `./mach test-wpt -r --log-raw "D:\servo test log\all.txt"
.\tests\wpt\tests\webdriver\tests\classic\get_active_element --product
servodriver`
Partly fixes: #37420. We can pass `get_active_element` test once #37424
is done.

Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com>
2025-06-15 05:17:59 +00:00
Jay Wang
96adb1e959
improvement: body element check (#37442)
Created a new method `HTMLElement::is_body_element` that replaces
`HTMLBodyElement::is_the_html_body_element`.

Testing: Existing WPT tests should pass.
Fixes: https://github.com/servo/servo/issues/37429

---------

Signed-off-by: iamlockon <xdddxyyyxzzz123@gmail.com>
2025-06-15 04:11:32 +00:00