Commit graph

28593 commits

Author SHA1 Message Date
Tim van der Lippe
c74a422e4c
Implement script prepare text for Trusted Types (#37466)
Recently added WPT tests for this are now mostly passing. The remaining
tests fail on importmap support.

Part of #36258

Signed-off-by: Tim van der Lippe <tvanderlippe@gmail.com>
2025-06-14 22:33:25 +00:00
Oriol Brufau
f963f2731d
layout: Properly handle intrinsic min/max block sizes on replaced element (#37457)
This change aligns Servo with both Blink and WebKit in common cases.

When the `aspect-ratio` property is set to a different value than the
natural ratio, then Blink and WebKit disagree, we match Blink.

Gecko doesn't support intrinsic min/max block sizes at all.

Note this patch doesn't fix the intrinsic contributions, they will need
to be addressed in a follow-up patch.

Testing: Covered by WPT
Fixes: #37433

Signed-off-by: Oriol Brufau <obrufau@igalia.com>
2025-06-14 09:24:10 +00:00
Domenico Rizzo
b8738074d1
[#26488] Refactored RTCDataChannel for safer dropping and added Promise comment (#37332)
Fixes (partially) #26488 and apply the
https://github.com/servo/servo/pull/37324#discussion_r2133989190
comment.

Testing: No tests added
Fixes: Partially #26488

---------

Signed-off-by: Domenico Rizzo <domenico.rizzo@gmail.com>
2025-06-13 12:20:45 +00:00
Martin Robinson
f451dccd0b
layout: Store scroll offsets in the ScrollTree (#37428)
There are currently five places that scroll offsets are stored:

 - DOM: A set of scroll offsets used for script.
 - Layout: An array of scroll offsets that is used for tracking
   layout-side scroll offsets.
 - Layout: The scroll offsets stored in the `ScrollTree`. These are
   currently unset and unused.
 - Compositor: The scroll offsets stored in the `ScrollTree` mirrored
   from layout.
 - WebRender: The scrolled offsets stored in the WebRender spatial tree.

This change is the first step in combining the first three into the
layout `ScrollTree`. It eliminates the extra array of scroll offsets
stored in layout in favor of the storing them in the `ScrollTree`. A
followup change will eliminate the ones stored in the DOM.

- In addition the `ScrollState` data structure is eliminated as these
are
now stored in a `HashMap` everywhere when passing them via IPC.
- The offsests stored in layout can now never scroll past the boundaries
of the scrolled content.

Testing: This should not change behavior and is thus covered by existing
WPT tests.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Co-authored-by: stevennovaryo <steven.novaryo@gmail.com>
2025-06-13 12:01:27 +00:00
Simon Wülker
6cac782fb1
Support exporting shadow parts with the exportparts attribute (#37345)
The attribute is implemented as a new `AttrValue` variant containing the
mappings of exported part names
(https://github.com/servo/stylo/pull/197).

Take a look at the [MDN
page](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Global_attributes/exportparts)
for more information about the attribute.


Testing: Covered by WPT
Fixes: https://github.com/servo/servo/issues/35349

---------

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
2025-06-13 11:32:20 +00:00
Gregory Terzian
730fe35b42
AbortController: integrate with stream piping. (#37244)
Start using abort signal in Use in
https://streams.spec.whatwg.org/#readablestream-pipe-to-signal

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

Will also cover https://github.com/servo/servo/issues/37230 and
https://github.com/servo/servo/issues/37232

---------

Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com>
2025-06-13 09:52:38 +00:00
atbrakhi
7a801f0ef5
DevTools: Implement support for showing source_content in Debugger > Source panel (#36774)
This patch adds support for showing source_content in `Debugger >
Source` panel. This works by handling the clients `source` messages in
the source actor. These source actors are already advertised as resource
via the watcher, populating the source list. We also update the
`sources` handler in thread actor for future work in thread debugging.

Note: while this PR also adds support for showing worker script
source_content, worker has been broken (See
https://github.com/servo/servo/issues/37012). I was able to confirm the
`content_type` and `source_content` for worker script in logs.


![image](https://github.com/user-attachments/assets/bd53ea29-003a-4b5e-a3e8-6e280afa4671)

Fixes: part of https://github.com/servo/servo/issues/36027

---------

Signed-off-by: atbrakhi <atbrakhi@igalia.com>
2025-06-13 09:31:33 +00:00
JoeDow
5159529888
Layout: refactor the box tree update logic for better readability (#37390)
Refactor the box tree update logic to improve readability and facilitate
the addition of incremental update logic in the following PRs.

Testing: No logic changed, just covered by existing WPT tests
Fixes: Nothing to fix

Signed-off-by: sharpshooter_pt <ibluegalaxy_taoj@163.com>
2025-06-13 08:42:59 +00:00
batu_hoang
6818d5c600
Wait enough time for tick duration in webdriver dispatch actions (#37423)
Add step `wait at least tick duration milliseconds have passed`
https://w3c.github.io/webdriver/#dfn-dispatch-actions-inner

Testing: Fix intermittent timeout in:

`/tests/wpt/tests/webdriver/tests/classic/perform_actions/pointer_dblclick.py`

cc: @xiaochengh , @jdm

Signed-off-by: batu_hoang <longvatrong111@gmail.com>
2025-06-13 08:40:23 +00:00
batu_hoang
4c598037a5
Verify webview still open in webdriver switch frame command (#37411)
SwitchToParentFrame webdriver commands do not handle the case where the
current top-level browsing context has been closed.

Tests:

`./tests/wpt/tests/webdriver/tests/classic/switch_to_parent_frame/switch.py`
`./tests/wpt/tests/webdriver/tests/classic/switch_to_frame/switch.py`

Signed-off-by: batu_hoang <longvatrong111@gmail.com>
2025-06-13 08:32:59 +00:00
Oriol Brufau
1bbdcb1911
layout: Avoid useless LazyCell when resolving replaced element's size (#37419)
The callback can be used instead, since `Size::resolve()` already takes
care of creating a `LazyCell`.

Testing: Unnecessary, no behavior change

Signed-off-by: Oriol Brufau <obrufau@igalia.com>
2025-06-13 08:29:37 +00:00
Martin Robinson
23acb623c8
script: Allow reflows that do not produce display lists (#37186)
This change has two parts which depend on each other:

1. An early exit in the layout process, which allows for skipping
   display list construction entirely when nothing would change.
2. A simplification and unification of the way that "fake" animation
   frames are triggered. Now this happens on an entire ScriptThread at
   once and is based on whether or not any Pipeline triggered a display
   list update.

   Animations are never canceled in the compositor when the Pipeline
   isn't updating, instead the fake animation frame is triggered far
   enough in the future that an unexpected compositor tick will cancel
   it. This could happen, for instance, if some other Pipeline in some
   other ScriptThread produced a new display list for a tick. This makes
   everything simpler about these ticks.

The goal is that in a future change the ScriptThread-based animation
ticks will be made more generic so that they can throttle the number of
"update the rendering" calls triggered by script.

This should make Servo do a lot less work when moving the cursor over a
page. Before it would constantly produce new display lists.

Fixes: #17029.
Testing: This should not cause any web observable changes. The fact that
all WPT tests keep passing is the test for this change.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Co-authored-by: Oriol Brufau <obrufau@igalia.com>
2025-06-12 19:25:04 +00:00
Martin Robinson
29fc878e15
compositor: Do not allow script to scroll beyond node boundaries (#37412)
The compositor was accepting scroll offsets from the ScriptThread
without checking their boundaries. In some cases this could cause a
temporary discrepancy with the rendered scroll offset. This change makes
it so that all offset updates for scroll ayers in the compositor do not
scroll past the scroll boundaries of the node.

Testing: Two new tests pass with this change:
 - `/css/css-position/sticky/position-sticky-left-003.html`
 -  `/css/css-position/sticky/position-sticky-top-003.html`

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
2025-06-12 17:32:50 +00:00
Kingsley Yung
b28e796647
Implement MicrotaskRunnable for DefaultTeeReadRequestMicrotask (#37404)
Implement `MicrotaskRunnable` for `DefaultTeeReadRequestMicrotask` to
run the microtask, instead of using its own ad-hoc mechanism via
`DefaultTeeReadRequestMicrotask::microtask_chunk_steps`.

Testing: No need for this refactoring.
Fixes: #37246

---------

Signed-off-by: Kingsley Yung <kingsley@kkoyung.dev>
2025-06-12 10:46:31 +00:00
Jason Tsai
41bed9840a
feat(script): create import map parse result (#37405)
Implement import map parser
Spec:
https://html.spec.whatwg.org/multipage/#create-an-import-map-parse-result

- Create an import map parse result
- Sorting and normalizing a module specifier map
- Sorting and normalizing scopes
- Normalizing a module integrity map

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

---------

Signed-off-by: Jason Tsai <git@pews.dev>
Co-authored-by: Wu Yu Wei <yuweiwu@pm.me>
2025-06-12 09:34:31 +00:00
Euclid Ye
f242c120b6
[WebDriver] Improve some session/window handling (#37406)
Improve some session/window handling according to spec.

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

---------

Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com>
2025-06-12 09:06:51 +00:00
batu_hoang
73c2864233
Handle Touch events in dispatch_pending_point_input_events (#37285)
Add a missing step in hit test retry
[(comment)](https://github.com/servo/servo/pull/37085/files/0d02b61f72c24e575273b6240e04351762ef000a#r2131567216).

cc: @xiaochengh , @kongbai1996

---------

Signed-off-by: batu_hoang <longvatrong111@gmail.com>
2025-06-12 03:13:11 +00:00
Usman Yahaya Baba
8e1cf31db3
Replace NetworkEventUpdateMsg with ResourcesUpdatedArray (#37384)
*Replaces NetworkEventUpdateMsg with ResourcesUpdatedArray in
HttpResponse case of handle_network_event *
- Adds ResourcesUpdatedArray and UpdateEntry structs in
`devtools/network_handler.rs` to hold an array of updates
(requestHeaders, responseCookies). Updates handle_network_event to use
BrowsingContextActor::resource_available for sending
"resources-updated-array").
- Adds browsing_context_actor_name parameter to handle_network_event to
resolve borrow checker issues and enable BrowsingContextActor lookup.
- Ensures borrow safety by scoping mutable actor access.

Testing: *Does not require test*
Fixes: part of https://github.com/servo/servo/issues/33556

---------

Signed-off-by: Uthman Yahaya Baba <uthmanyahayababa@gmail.com>
2025-06-11 22:07:57 +00:00
Nico Burns
7427ea4aed
Move to_bidi_level method from Stylo to Servo (#37343)
This method is only used in Servo and is the only reason that `stylo`
depends on `unicode-bidi`.

Stylo PR: https://github.com/servo/stylo/pull/196
2025-06-11 14:44:13 +00:00
Euclid Ye
c1ee354c38
webdriver: Assume more consistently that the BrowsingContext exists (#37389)
1. Tidy up some WebDriver handling with browsing context
2. Enable more wpt-test which no longer panic

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

---------

Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com>
2025-06-11 14:23:47 +00:00
Martin Robinson
fab958258e
script: Remove unused Window::page_clip_rect (#37394)
This value was used when rendering was not done by WebRender. Nowadays,
we do not need this page clip rect concept and it is completely
unused.

Testing: This just remove dead code, so should be covered by existing
tests.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
2025-06-11 13:08:33 +00:00
Martin Robinson
c36ef34464
layout: Remove two arguments from StackingContextTree::new() (#37396)
This is a minor cleanup that simplifies the construct of
`StackingContextTree`. The two arguments removed are derived from the
`FragmentTree` which is already passed as an argument.

Testing: This should not change behavior and is thus covered by existing
tests.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
2025-06-11 12:42:54 +00:00
JoeDow
bda3e23c74
Fix potential clippy warning for NodeDamage enum variant (#37391)
The default of `enum-variant-name-threshold` is 3, so adding any new
variants will lead to the lint being triggered, reference:

[enum_variant_names](https://rust-lang.github.io/rust-clippy/master/index.html#enum_variant_names).
This PR fix this potential clippy lint warning for facilitate the
addition of new variant in following PR about incremental box tree
update.

Testing: No logic changed, just covered by existing WPT tests
Fixes: None

Signed-off-by: sharpshooter_pt <ibluegalaxy_taoj@163.com>
2025-06-11 09:53:15 +00:00
Euclid Ye
5f1452f9d3
[WebDriver: Dispatch Action] Check if browsing context still open for each tick action (#37393)
As titled. This is what
[spec](https://w3c.github.io/webdriver/#dfn-dispatch-actions-inner)
requires. The motivation is that the previous action might have changed
the browsing context.

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

---------

Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com>
2025-06-11 09:53:06 +00:00
Martin Robinson
048d4a2a5a
libservo: Let libservo manage compositor message reception (#37372)
Instead of receiving message in the compositor during a spin of the
Servo event loop, receive them in libservo and then send them to the
compositor. This is preparation for allowing libservo to wait for
messages without spinning the main application event loop. This is
useful for two situations:

1. Allowing a blocking shutdown mode, which can be used to ensure clean
   shutdown, regardless of how the API is used.
2. Allowing unit tests to wait until message are received instead of
   using a timer like they do now.

Testing: This should not change behavior and is thus covered by existing
tests.
Fixes: This is part of #37371.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
2025-06-11 09:50:20 +00:00
Kenzie Raditya Tirtarahardja
15eadb56a4
[webdriver] Add synchronization for wheel action (#37260)
Implement action synchronization for wheel event. Previously only done
for pointer here https://github.com/servo/servo/pull/36932.

Testing:
`tests/wpt/meta/webdriver/tests/classic/perform_actions/wheel.py`

---------

Signed-off-by: PotatoCP <kenzieradityatirtarahardja18@gmail.com>
2025-06-11 09:03:08 +00:00
Shubham Gupta
f1767e6c1e
Use own ViewportDescription to clamp() initial_scale (#37337)
Use own `ViewportDescription` to `clamp()` initial_scale.

If use `self` it will use current module `ViewportDescription`, which is
old one because new `ViewportDescription` is not set yet.

Testing: Tested Locally
Fixes: #37338

Signed-off-by: Shubham Gupta <shubham13297@gmail.com>
2025-06-11 05:31:05 +00:00
Josh Matthews
73361d0f5f
script: Replace use of UnsafeCell in WeakRangeVec. (#37327)
I can't find any historical motivation for the use of UnsafeCell in the
implementation of WeakRangeVec from #8506. We can replace all the uses
of unsafe in this code by using RefCell, and the resulting code is
easier to understand.

Testing: Existing WPT tests using Ranges show no behaviour changes.
Fixes: #37276

Signed-off-by: Josh Matthews <josh@joshmatthews.net>
2025-06-11 04:01:12 +00:00
Euclid Ye
56bbc49f21
[WebDriver] Properly report error: "No such window" (#37385)
For WebDriver, return "No Such Window" properly according to spec.

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

---------

Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com>
2025-06-10 19:43:03 +00:00
Usman Yahaya Baba
e1ec650cfe
Update handle_network_event to use BrowsingContextActor for HttpRequest (#37263)
- Add browsing_context_actor_name parameter to handle_network_event
- Replace NetworkEventMsg in HttpRequest case with
BrowsingContextActor::resource_available
- Update DevTools caller in lib.rs to pass browsing_context_actor_name

Testing: 
Fixes:
https://github.com/servo/servo/issues/33556#issuecomment-2756544430

---------

Signed-off-by: Uthman Yahaya Baba <uthmanyahayababa@gmail.com>
2025-06-10 14:11:39 +00:00
Oriol Brufau
5c597f98e0
layout: Floor free space by 0 in solve_inline_margins_avoiding_floats() (#37362)
`PlacementAmongFloats` should guarantee that the inline size of the
placement rect is at least as big as the inline size of the box,
resulting in a non-negative free space.

However, that may fail when dealing with huge sizes that need to be
saturated to MAX_AU, so this floors the free space by zero.

Testing: New crashtest
Fixes: #37312

Signed-off-by: Oriol Brufau <obrufau@igalia.com>
2025-06-10 09:05:09 +00:00
Jason Tsai
ed09a0ff52
feat(script): add resolve_url_like_module_specifier to ModuleTree (#37340)
adding `resolve_url_like_module_specifier` method to `ModuleTree`.

Testing: Existing WPT test for script element should pass.
Fixes: https://github.com/servo/servo/issues/37316, resolving a URL-like
module specifier

Signed-off-by: Jason Tsai <git@pews.dev>
2025-06-09 22:30:58 +00:00
Andrei Volykhin
7f536e8092
imagebitmap: Add missing basic functionality (#37025)
Add missing basic functionality for ImageBitmap
https://html.spec.whatwg.org/multipage/#imagebitmap
including new variant of creation bitmap with source rectangle
https://html.spec.whatwg.org/multipage/#dom-createimagebitmap
but without support of cropping bitmap data with formatting.

Add ImageBitmap to CanvasImageSource union type
https://html.spec.whatwg.org/multipage/#canvasimagesource

Add ImageBitmap to TexImageSource for WebGL
https://registry.khronos.org/webgl/specs/latest/1.0/index.html

Testing: Improvements in the following WPT tests
 - html/canvas/element/manual/imagebitmap/*
 - html/canvas/element/manual/wide-gamut-canvas/*
 - html/semantics/embedded-content/the-canvas-element/*
 - webgl/tests/conformance/textures/image_bitmap_from*
 - webmessaging/postMessage_cross_domain_image_transfer_2d.sub.htm

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

Signed-off-by: Andrei Volykhin <andrei.volykhin@gmail.com>
2025-06-09 14:28:30 +00:00
Euclid Ye
a3c792e5aa
servoshell: Do not focus and raise new auxiliary WebDriver-created WebViews (#37284)
For Desktop port of `request_open_auxiliary_webview`, stay on the
original WebView if the request originates WebDriver.

This is to make sure `webdriver_server::handle_new_window` does not
focus the new window, according to spec. See
c7eba2dbba/tests/wpt/tests/webdriver/tests/classic/new_window/new_window.py (L31-L37)

**To clarify**: this won't change the behaviour when user interacts, but
only affects WebDriver [New
Window](https://w3c.github.io/webdriver/#new-window).

Testing: `./mach test-wpt -r --log-raw "D:/servo log/all.txt"
./tests/wpt/tests/webdriver/tests/classic --product servodriver` based
on 96b0973037

---------

Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com>
2025-06-09 11:07:09 +00:00
Simon Wülker
0fa3de3937
Support ::part selector (#37307)
This is pretty much just wiring up the necessary stylo methods. Note
that the `exportparts` attribute is not yet supported, I'll do that in a
followup change

Testing: Covered by existing web platform tests.
This is the first half of https://github.com/servo/servo/issues/35349

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

---------

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
2025-06-09 10:17:28 +00:00
Josh Matthews
27527adf35
tests: Use Ahem font provided by WPT harness. (#37054)
#37021 exposed that our tests are trying to load a local file path for
Ahem.ttf, but this stops working when we implement the specified CORS
protections for our font requests. Luckily, the WPT suite already
provides a same-origin version of the same font, so we can just update
our CSS to use that font face instead.

Testing: Existing WPT coverage.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>
2025-06-09 08:13:05 +00:00
Euclid Ye
4e9993128b
[WebDriver] Unify Cookie related Error types (#37339)
Remove `embedder/webdriver.rs::WebDriverCookieError` and use universal
`ErrorStatus` from webdriver crate. This is needed as we might need to
send back more universal error such as `NoSuchWindow`.

Testing: No behaviour change.

Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com>
2025-06-09 06:23:31 +00:00
Josh Matthews
96b0973037
Upgrade tungstenite, webpki-roots, and hyper-rustls dependencies. (#37333)
This change upgrades some dependencies that required some manual
intervention due to duplicate packages and breaking API changes. These
changes also allow us to upgrade to ipc-channel 0.20
(https://github.com/servo/ipc-channel/pull/390#discussion_r2070677101),
and allow us to upgrade other dependencies that have migrated to rand
0.9 while the ecosystem remains split.

Testing: Existing WPT tests.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>
2025-06-08 22:55:44 +00:00
Tim van der Lippe
63cfeb3a18
Report URI with POST fetch request (#37209)
Part of #4577

Signed-off-by: Tim van der Lippe <tvanderlippe@gmail.com>
2025-06-08 18:44:55 +00:00
Nico Burns
1b5a10a55f
CSS Grid: percentage sizing fixes (#34948)
This applies some fixes for CSS Grid percentage sizing. These fixes are
mostly within Taffy, but there are some changes in Servo to allow it to
communicate whether an item is replaced to Taffy.

It also updates Taffy to v0.8.0. Taffy has switched to a tagged pointer
representation of length/size styles. Much of the diff here is updating
Servo's type conversion code to use the new representation.

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by
`[X]` when the step is complete, and replace `___` with appropriate
data: -->
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] There are tests for these changes OR

---------

Signed-off-by: Nico Burns <nico@nicoburns.com>
2025-06-08 15:17:10 +00:00
batu_hoang
aeca81c091
[webdriver] Implement get shadow root (#37280)
Implement Get Element Shadow Root
https://www.w3.org/TR/webdriver2/#dfn-get-element-shadow-root

cc: @xiaochengh, @yezhizhen, @PotatoCP 

Testing:
`\tests\wpt\tests\webdriver\tests\classic\get_element_shadow_root\get.py`
is blocked by `no_browsing_context` and `closed_window`
pass for other sub-tests.

Signed-off-by: batu_hoang <longvatrong111@gmail.com>
2025-06-07 20:54:36 +00:00
Tim van der Lippe
c808ff7666
Fix Sec-Fetch-Site header (#37277)
While working on #37209 I discovered that the header was computed
incorrectly. After carefully reading the specification, I realized that
the link in the spec was wrong and we were missing the fact that for
host-domains, we should operate on the registrable domain.

Additionally, the same-site call was missing the negation.

Signed-off-by: Tim van der Lippe <tvanderlippe@gmail.com>
2025-06-07 16:57:29 +00:00
Sam K
a625420b23
Change canvas/context/snapshot size from u64 -> u32 (#36827)
Replaces uses of `euclid::default::Size2D<u64>` with
`euclid::default::Size2D<u32>` for the canvas/context/snapshot.

This PR includes changes to the following components:
 - canvas
 - pixels
 - script
 - script_bindings
 - shared/canvas
 - shared/snapshot

Testing: https://github.com/hashcatHitman/servo/actions/runs/15426115391
(as of 892edc0048)

Fixes: #36706

---------

Signed-off-by: hashcatHitman <155700084+hashcatHitman@users.noreply.github.com>
2025-06-07 14:37:21 +00:00
Jason Tsai
47f9fbd8c7
feat(script): add Supports() to htmlscriptelement (#37313)
Add static method `Supports` to `HTMLScriptElement`.

Part of #37262
Testing: relative WPT tests should become `PASS`

Signed-off-by: Jason Tsai <git@pews.dev>
2025-06-07 07:00:02 +00:00
Domenico Rizzo
352e4bfcf1
[#26499] Refactors HTMLMediaElement drop logic (#37310)
Testing: No tests added
Fixes: Partially #26488

Signed-off-by: Domenico Rizzo <domenico.rizzo@gmail.com>
2025-06-07 05:51:59 +00:00
Andrei Volykhin
b81f1b135b
htmlmediaelement: Support seek requests for non seekable fetch context (#37264)
According to specification the data:// URL protocol doesn't support
range request
so be able make any seek request to required content position let's
allow
for non seekable fetch context discard fetched content bytes until seek
offset.
https://fetch.spec.whatwg.org/#scheme-fetch

Some scheme URLs (like data:// URL) doesn't expose "Content-Length"
header in response
so the total expected size of the stream is unknown and it causes some
additional
seek request (SeekData) from the media player. Try to post configure
stream size
after we reached fetch EOS response.

Related source code which breaks WPT tests:

[tests/wpt/tests/html/canvas/element/manual/imagebitmap/common.sub.js#L56-L78](https://github.com/servo/servo/tree/main/tests/wpt/tests/html/canvas/element/manual/imagebitmap/common.sub.js#L56-L78)

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

Fixes: https://github.com/servo/servo/issues/32645
Fixes: https://github.com/servo/servo/issues/32745
Fixes: https://github.com/servo/servo/issues/34119
Fixes: https://github.com/servo/servo/issues/34120
Fixes: https://github.com/servo/servo/issues/34151

Signed-off-by: Andrei Volykhin <andrei.volykhin@gmail.com>
2025-06-06 21:52:24 +00:00
Oriol Brufau
8540b0f6e3
layout: Force outside ::marker to establish a BFC (#37252)
Even though we were continuing the parent BFC, we weren't updating the
SequentialLayoutState to have the correct containing block info. That
caused problem in the presence of floats.

This patch establishes an independent BFC, which avoids the problem.
This seems reasonable since outside markers are out-of-flow-ish, and it
matches Firefox. Blink implements them as inline-blocks, so they should
also establish a BFC.

Testing: Adding new tests. Some still fail because of a different issue.
Also, adding an expectation for several existing tests that were missing
it.
Fixes: #37222

Signed-off-by: Oriol Brufau <obrufau@igalia.com>
2025-06-06 16:01:27 +00:00
webbeef
a1f43ab06d
Revert "Implement Input UA Shadow DOM (#37065)" (#37296)
This reverts commit 5580704438.

Let's re-land that fix when a working solution is found. Keeping that
regression makes it hard to evaluate other potential improvements.

Signed-off-by: webbeef <me@webbeef.org>
2025-06-06 15:23:08 +00:00
Shubham Gupta
aff2a85372
Add support for parsing and applying viewport <meta> (#35901)
This patch comprises following steps:
1. Parses the `viewport` Attribute from `<meta>`.
2. Creates a `ViewportDescription` struct.
3. Populate values into Viewport struct.
4. Pass & Stash Viewport Description to Webview.
5. Process parsed values of `viewport <meta>`

Testing: Tested locally.
Fixes: #36159

---------

Signed-off-by: Shubham Gupta <shubham13297@gmail.com>
Signed-off-by: Xiaocheng Hu <xiaochengh.work@gmail.com>
Co-authored-by: Xiaocheng Hu <xiaochengh.work@gmail.com>
2025-06-06 15:13:51 +00:00
delan azabani
c7a215faba
Fix cargo build -p libservo on macOS 13 by running Python via uv (#37290)
The correct way to run Python when building Servo is `uv run python`,
unless we are running as a descendant of `uv run python`. In that case,
we can use either `uv run python` or `python` (uv does not provide a
`python3` on Windows \*).

\* for the astute reader, yes, this causes problems for mozjs, which
only tries `python3` unless PYTHON3=python :)))

Testing: tested manually on macOS 13 (see below), and will be tested in
CI
Fixes: #37289 


![Screenshot_servo-macos13_2025-06-06_11:35:52](https://github.com/user-attachments/assets/01d4ea38-d405-452f-aeb9-75aada13c907)

Signed-off-by: Delan Azabani <dazabani@igalia.com>
2025-06-06 14:54:00 +00:00