Commit graph

28735 commits

Author SHA1 Message Date
Nico Burns
96f599bdf1 Upgrade to icu4x 2.0.0
Signed-off-by: Nico Burns <nico@nicoburns.com>
2025-07-02 03:03:46 +01:00
Oriol Brufau
227aecad51
layout: Only include quirks-mode.css in actual quirks mode (#37814)
This stylesheet was being included both in quirks mode and in limited
quirks mode. It should only be the former.

Testing: adding new test.
Part of #37813

Signed-off-by: Oriol Brufau <obrufau@igalia.com>
2025-07-01 18:48:35 +00:00
Martin Robinson
7375d09887
layout: Remove TryFrom<Contents> for NonReplacedContents (#37815)
This implementation is quite confusing as it makes it harder to tell
that we are just looking for the case that `Contents` contains
`NonReplacedContents`.

Testing: This shouldn't have any functional change, so is covered by
existing tests.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
2025-07-01 18:21:33 +00:00
sagudev
e0af75f265
canvas: Do not draw arc/ellipse with small sweep (#37630)
While raqote does already passes this test, but small line is still
visible and this PR will fix this. Vello will not work correctly without
this.


![slika](https://github.com/user-attachments/assets/195cd2c8-bea4-46d8-bf34-9c2d0b2e996e)


Testing: `/html/canvas/element/path-objects/2d.path.arc.twopie.1.html`

---------

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
2025-07-01 12:01:15 +00:00
Euclid Ye
9543482f51
webdriver: Greatly improve execution speed for all tests using SetWindowSize (#37712)
1. Remove the unnecessary new thread which use GetWindowRect command and
blocks for 500ms. Previously this is necessary because constellation
forward "resize" to embedder, and WebDriver wait for a constant
sufficient time to `GetWindowRect` in the new thread. This caused long
delay because there are many subtests and SetWindowRect is called
between each.
2. Remove `resize_timeout`
3. Return current dimension instead of 0 from embedder when it fails to
resize.
4. Do resizing as long as one of width/height is `Some`, according to
spec.

Testing: All Conformance test with new passing cases.
Fixes: https://github.com/servo/servo/pull/37663#issuecomment-2999120615

---------

Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com>
2025-07-01 06:26:01 +00:00
Euclid Ye
d781d1b1cb
[WebDriver] Implement XPath Locator Strategy (#37783)
1. Implement XPath Locator Strategy
2. Use it for "Find Element(s)", "Find Element(s) from Element", "Find
Element(s) from Shadow Root"

Testing: `tests\wpt\tests\webdriver\tests\classic\find_element*\find.py`

---------

Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com>
2025-06-30 17:20:52 +00:00
CarePackage17
f682f9d6f5
Enable LinuxSampler to be used on Android (#37784)
This enables `background_hang_monitor` to work on Android. Relevant
Zulip thread: [#general > Android stack walking questions @
💬](https://servo.zulipchat.com/#narrow/channel/263398-general/topic/Android.20stack.20walking.20questions/near/526369883)


Testing: Manually tested on a Pixel 6a with Android 16 with following
page:
```html
<!DOCTYPE html>
<html>
    <head>
        <title>Infinite Loop Test</title>
    </head>
    <body>
        Will it print? That is the question.
    </body>
    <script>
        console.log("hello. you're about to loop infinitely.");

        while (true) {
            //do nothing, just block the thread
        }
    </script>
</html>
```
Fixes: #23136

---------

Signed-off-by: CarePackage17 <5157010+CarePackage17@users.noreply.github.com>
2025-06-30 17:17:50 +00:00
Rodion Borovyk
60c10d710d
Set the placeholder canvas element of offscreenCanvas to a weak reference in transferControlToOffscreen() (#37764)
Set the placeholder canvas element of offscreenCanvas to a weak
reference in transferControlToOffscreen()

Testing: I do not understand how to test it, suggestions appreciated 
Fixes: https://github.com/servo/servo/issues/35626

---------

Signed-off-by: Rodion Borovyk <rodion.borovyk@gmail.com>
2025-06-30 13:30:58 +00:00
Oriol Brufau
4cd7c5196b
layout: Fix block SizeConstraint for replaced elements (#37758)
#37433 didn't handle intrinsic contributions. This patch computes the
correct SizeConstraint to be used as the ConstraintSpace's block size
when computing intrinsic inline sizes.

Testing: Adding new test
Fixes: #37478

Signed-off-by: Oriol Brufau <obrufau@igalia.com>
2025-06-30 12:07:37 +00:00
Oriol Brufau
f23e3e25b8
layout: Small refactoring for replaced elements' sizing logic (#37756)
Add methods to retrieve the natural, default and fallback sizes per each
axis (inline or block), rather than computing both simultaneously.
Sometimes we only want one size, and I think it's clearer this way.

Testing: Unnecessary (no behavior change)

Signed-off-by: Oriol Brufau <obrufau@igalia.com>
2025-06-30 07:07:39 +00:00
Oriol Brufau
4fe106cffc
layout: Remove wrong depends_on_block_constraints logic (#37761)
`FlexContainer::layout()` was forcing `depends_on_block_constraints` to
true for `flex-direction: column`. However, it doesn't make sense to do
that only for `column` but not for `column-reverse`. Also no test is
complaining, so I'm just removing that logic.

Testing: no behavior change is intended, so just existing test coverage

Signed-off-by: Oriol Brufau <obrufau@igalia.com>
2025-06-30 07:06:44 +00:00
Euclid Ye
78cd770697
Codegen: Fix typo in doc (#37777)
Fix typo.
Testing: No.

Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com>
2025-06-29 11:13:50 +00:00
Tim van der Lippe
e1c037815c
Fix skipping CSP checks for styles when cloning nodes (#37465)
Cloned nodes were re-parsing already-parsed style attributes. As such,
they were also checking CSP, which shouldn't happen as the original node
already was checked for it.

Testing: The existing WPT test now mostly passes. It had two cases which
were passing in no browsers.
Fixes: Part of #4577

Signed-off-by: Tim van der Lippe <tvanderlippe@gmail.com>
2025-06-28 17:31:03 +00:00
sagudev
5311beb34a
Lazily initialize canvas paint thread in constellation (#37765)
This PR moves canvas paint thread initialization to constellation. This
allows us to lazily initialize it on first create canvas request (like
we do for webgpu). If we didn't started canvas paint thread we also do
not need to wait for it's teardown.

Per https://chromestatus.com/metrics/webfeature/timeline/popularity/201
~30% of websites still use 2d canvas.

Testing: Existing WPT tests

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
2025-06-28 17:29:11 +00:00
Martin Robinson
9232b0f550
layout: Only create a LayoutContext if restyling (#37726)
The creation of `LayoutContext` does more work than necessary if layout
just needs to do something like make a display list and not restyle and
relayout. This change makes it so that these kind of non-restyle layouts
do not need to create a display list. In addition, the creation of
`LayoutContext` is better encapsulate

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

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Co-authored-by: Oriol Brufau <obrufau@igalia.com>
2025-06-27 15:01:30 +00:00
Martin Robinson
5e44582277
script: Clean up Window::force_reflow a little (#37725)
- Move some of the image handling code to a separate function.
 - Move reflow event debugging into layout itself and use the `Debug`
   implementation to print the event.
 - A few other small cleanups

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: Oriol Brufau <obrufau@igalia.com>
2025-06-27 12:27:15 +00:00
CarePackage17
a93d977020
Replace unwind-sys with backtrace crate on Linux (#37728)
This PR removes `unwind-sys` usage from background_hang_monitor on
Linux, replacing it with the [backtrace
crate](https://crates.io/crates/backtrace).

Testing: `hang_monitor-tests.rs` still pass after the change (on Ubuntu
24.04).
Fixes: https://github.com/servo/servo/issues/35063

---------

Signed-off-by: CarePackage17 <5157010+CarePackage17@users.noreply.github.com>
2025-06-27 12:20:10 +00:00
Euclid Ye
0329f33520
[WebDriver] Reuse "Find Elements" handler in "Find element" (#37737)
All "Find Element ..." in
[spec](https://w3c.github.io/webdriver/#find-element-from-element) has
exactly same step has "Find Elements ...", except they extract the first
element if there is any. We now reuse the handler instead of running
numerous repetitive steps, same as what we did for ["Find Element from
Shadow
Root"](https://w3c.github.io/webdriver/#find-element-from-shadow-root)
in #37578.

This reduces binary size by 98KB for Release profile in Windows and
improves maintainability.

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

---------

Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com>
2025-06-27 08:45:58 +00:00
Martin Robinson
8e2ef5c248
layout: Do not require restyle information when not restyling (#37722)
This reduces the amount of work necessary when running layout, by making
restyle information optional in the `ReflowRequest`. When restyling
isn't
necessary, the option is `None`.

Testing: This shouldn't change any observable behavior and thus is
covered
by existing WPT tests.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Co-authored-by: Oriol Brufau <obrufau@igalia.com>
2025-06-27 08:08:29 +00:00
Simon Wülker
cbb0407ae6
Determine the initial state for fragment parsing using the scripting flag of the context element (#37704)
When parsing a html fragment, the initial parser state depends on
whether or not scripting is enabled. So far we've used the scripting
flag of the parser, but that is wrong - the parser's scripting flag is
always false, because the fragment document has no browsing context.
Instead we should use the scripting flag of the context element.

Testing: A new web platform test passes

---------

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
2025-06-26 20:40:13 +00:00
sagudev
4dded465a4
compositor: only UpdateImages that accepts SmallVec and add helpers for single image (#37730)
Before we only offered helper to add single image (no update or delete)
that got special IPC message, now we simplify this by offering all ops
helpers for dealing with single image (that happens most of the time),
that simply uses `update_images` under the hood. We also optimize for
this use case by using `SmallVec<[ImageUpdate; 1]>` to avoid alloc.

Testing: Just refactor, but code is covered by WPT tests

---------

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
2025-06-26 14:57:15 +00:00
Andrei Volykhin
3c16db2642
canvas: Add CanvasPattern 'setTranform(transform)' method (#37731)
Follow the HTML canvas specification and add missing
'setTransform(transform)' method to CanvasPattern interface.
https://html.spec.whatwg.org/multipage/#dom-canvaspattern-settransform

Testing: Improvements in the tests
- html/canvas/element/fill-and-stroke-styles/2d.pattern.transform*
- html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.transform*

Signed-off-by: Andrei Volykhin <andrei.volykhin@gmail.com>
2025-06-26 14:38:30 +00:00
Martin Robinson
5286869b96
layout: Start using the new extensible RestyleDamage type from Stylo (#37592)
This will allow Servo to add custom types of damage in the near future
which correspond to minor phases layout. The damage exposed by Stylo
only corresponds to the major layout phses. In the future, both phases
will likely be managed by Servo itself and implementors will need to
provide their own damage system entirely.

Testing: This shouldn't change behavior and thus is covered by existing
tests.

Stylo PR: https://github.com/servo/stylo/pull/207

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Co-authored-by: Oriol Brufau <obrufau@igalia.com>
2025-06-26 14:10:48 +00:00
Oriol Brufau
a9dc2ac83a
layout: Let align-content: stretch fall back to unsafe flex-start (#37708)
This aligns Servo with other browsers, and adopts this CSSWG resolution:
https://github.com/w3c/csswg-drafts/issues/11641#issuecomment-3005385155

Testing: adding new WPT test, and some expectation changes for existing
tests.

Signed-off-by: Oriol Brufau <obrufau@igalia.com>
2025-06-26 13:53:28 +00:00
Narfinger
4d35b69ffe
Clean up unused dependencies / features and centralize more feature selection into root Cargo.toml (#37720)
- Make feature flag of smallvec global.
- Removed unused dependency of thinvec.
- Removed unused flag of hyper-util.

Reduces the binary size by an astonishing 3.352k.

Testing: Compilation 'tests' this change.

Signed-off-by: Narfinger <Narfinger@users.noreply.github.com>
2025-06-26 11:56:48 +00:00
sagudev
c8132137cd
webgpu: Use compositor_api instead of webrender_api (#37713)
webgpu currently sends updates WebRender directly via WebRender API
(same as webgl that I also plan to reform). 2D canvas uses Compositor
API for that and with this PR so does webgpu. This will be helpful for
#35733, where compositor must know state of image updates.

Testing: WebGPU CTS run:
https://github.com/sagudev/servo/actions/runs/15895299748

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
2025-06-26 10:12:29 +00:00
Euclid Ye
125df89836
Chore: Remove unused GetFocusTopLevelBrowsingContext from EmbedderToConstellationMessage (#37716)
This is a legacy message used only by WebDriver to focus the webview,
when session just created. Right now this is just dead_code which is not
detected by Lint.

Testing: No behaviour change.

Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com>
2025-06-26 09:45:59 +00:00
Martin Robinson
3cda9f2fb2
layout: Add a ReflowPhases bitflags (#37696)
This is used to capture information about what layout phases are
necessary for a given `ReflowGoal`. It's moved closer to where these
decisions are made and it should be easier to understand what the values
mean. They had gotten a bit out of sync with how queries and layout were
implemented.

Testing: This shouldn't change observable behavior and thus should be
covered
by existing WPT tests.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
2025-06-26 09:31:16 +00:00
sagudev
03dbf9b6f7
webgl: Replace webrender API with compositor API for images handling (#37714)
Like in #37713, instead of updating images directly with webrender api
we use the compositor api. We still keep webrender api available in
webgl, because that's where we do shutdown, due to GL.

Testing: Existing WPT tests

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
2025-06-26 09:06:24 +00:00
Martin Robinson
3e1cdacd07
script|layout: Do not force restyle when doing script queries (#37677)
Instead of doing a restyle whenever layout is requested, only do one if
script believes that the `Document` has changed in a way that needs a
restyle. In addition, track the different reasons this might be the
case. This will be used later to provide better debugging output.

In layout, when a restyle isn't requested, provide:
 - an early return if layout is up-to-date enough for the reflow goal.
 - skipping restyle and reflow if it isn't necessary.

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

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Co-authored-by: Oriol Brufau <obrufau@igalia.com>
2025-06-26 08:02:15 +00:00
Euclid Ye
f9880637e9
[WebDriver] Fully implement "switch to (parent) frame" (#37685)
1. Separate the handling of ["switch to parent
frame"](https://w3c.github.io/webdriver/#switch-to-parent-frame) from
the rest as the processing is a bit different
2. Implement "Select frame by 16-bits numbered ID" for ["switch to
frame"](https://w3c.github.io/webdriver/#switch-to-frame)
3. Implement other missing steps

Testing: All WebDriver Conformance test with new passing cases

---------

Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com>
2025-06-26 07:44:16 +00:00
Usman Yahaya Baba
253fb247f5
Add common resourceId to network events (#37707)
- Add a `resource_id` field to `EventActor` and `NetworkEventActor`
- Store a `next_resource_id` field in DevtoolsInstance
- Add `resource_id` parameter to `NetworkEventActor::new`
- Increment `next_resource_id` when
`DevtoolsInstance::find_network_event_actor` is called so each network
event has a unique id

Testing: Ran servo in devtools mode and can see the data showing in
`status`,`type`, `transferred` ,`size` and `timeline` columns of each
request, also logged the devtools instance and can see unique
`resourceId` for each request.
Fixes: https://github.com/servo/servo/issues/37661

Signed-off-by: Uthman Yahaya Baba <uthmanyahayababa@gmail.com>
2025-06-26 07:08:16 +00:00
Martin Robinson
f745bad37d
script: Consolidate step 22 of per-Document rendering update (#37703)
The parts of step 22 were a bit scattered throughout the codebase, so
this
change moves them all to a single method which does three things:

1. Update all animating images
2. Flush all dirty canvases (2D, WebGL, and WebGPU)
3. Calls reflow on the `Document`

Testing: This shouldn't change behavior in any major way so it should
be covered by existing WPT tests.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
2025-06-26 06:11:03 +00:00
Usman Yahaya Baba
152eb63fb3
Remove duplication between request/response properties in NetworkEventActor (#37651)
- Remove request/response fields in `NetworkEventActor` which now stores
minimal request metadata needed : `URL`, `method`, `timestamps`, `raw
headers`, `body`.
- Refactor add_request and add_response: `add_request` takes the
incoming DevtoolsHttpRequest and populates
`request_url`, `request_method`, `request_started`,
`request_time_stamp`, `request_body`, `request_headers_raw`
`request_cookies`, `request_headers`,`total_time` and `event_timing`
(via a new helper that computes Timings)
While `add_response` takes the incoming DevtoolsHttpResponse and
populates `response_headers_raw`, `response_body` ,`response_cookies`,
`response_headers`, `response_start`, `response_content`
- Add a call to `resources_updated` to push initial request info in
`handle_network_event`
Testing: Run and logged servo in devtools mode and now, the request
header info isavailable as soon as the request gets initiated
Fixes: https://github.com/servo/servo/issues/37566

---------

Signed-off-by: Uthman Yahaya Baba <uthmanyahayababa@gmail.com>
2025-06-25 20:18:44 +00:00
sagudev
6f53d422b0
Make ImageData more spec compliant (#37620)
I updated webidl, and all changes that bring, currently we still not
support float16array (there is no support in FF either). Most notable
change is refactored new_*/Constructors methods, that should now handle
HeapBufferSource more properly (with less unsafe).

Testing: Existing WPT tests
try run: https://github.com/sagudev/servo/actions/runs/15806083404
Fixes: #37618 (although not tested)

---------

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
2025-06-25 16:48:58 +00:00
Andrei Volykhin
59b99de90a
canvas: Add CanvasTransform 'setTransform(transform)' method (#37692)
Follow the HTML canvas specification and add missing
'setTransform(transform)' method to CanvasTransform interface.

https://html.spec.whatwg.org/multipage/#dom-context-2d-settransform-matrix

The third-party WebIDL doesn't support different extended attributes
on different overloads of methods, so 'Throws' attribute was added
to another 'setTransform(...)' method.
https://bugzilla.mozilla.org/show_bug.cgi?id=1020975

Testing: Improvements in the tests
- css/geometry/DOMMatrix*
-
html/canvas/element/transformations/2d.transformation.setTransform.multiple.html
-
html/canvas/offscreen/transformations/2d.transformation.setTransform.multiple

New failing tests due to disabled 'paint worklet' feature
- css/css-paint-api/setTransform-00*.https.html

Signed-off-by: Andrei Volykhin <andrei.volykhin@gmail.com>
2025-06-25 16:11:54 +00:00
Narfinger
64259de1f7
script: Do not run garbage collection when shutting down a Pipeline (#37691)
Removes a GC cleanup step on exit pipeline that took half a second at
the end
of the Speedmometer benchmark. As layout and script are now run serially
this
does not seem to be needed anymore. See also the very short discussion
on Zulip:
[#performance > GC in
handle_exit_pipeline](https://servo.zulipchat.com/#narrow/channel/416779-performance/topic/GC.20in.20handle_exit_pipeline/with/525697861).

Testing: Tested with Speedometer and the WPT tests should still work.

Signed-off-by: Narfinger <Narfinger@users.noreply.github.com>
2025-06-25 15:13:54 +00:00
Martin Robinson
a66a257b38
script: Properly root nodes with animating images (#37689)
This change fixes an issue and makes a few more minor improvements to
the `ImageAnimationState`:

1. Image rooting and unrooted now happens in one step from
   `Window::update_animations_post_reflow`.
2. The `node_to_animating_image_map` is now stored as a shared `RwLock`
   so that it doesn't need to be taken and then replaced in the
`ImageAnimationState` during reflow. This should prevent a hypothetical
issue
   where image animations are restarted during empty reflows.
3. General naming and idiomatic Rust usage improvements.

Testing: This doesn't really have any obvious behavioral changes,
because all
reflows currently trigger a restyle. It becomes a serious problem with
#37677
and this change fixes the failing test there.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
2025-06-25 13:52:11 +00:00
batu_hoang
62a009399f
webdriver: Move navigation commands to servoshell (#37665)
- Move webdriver `GetViewportSize`, `LoadURL` and `Refresh` to
servoshell.
- Add `GoBack` and `GoFoward` commands.

Testing: Need to finish moving webdriver to servoshell then evaluate
again
Fixes: https://github.com/servo/servo/issues/37370

Signed-off-by: batu_hoang <longvatrong111@gmail.com>
2025-06-25 12:35:13 +00:00
Martin Robinson
0346a62214
script: Pass more information to the MouseEvent constructor (#37672)
- Instead of eagerly computing `pageX` and `pageY`, collect the offset
  from the content's initial containing block in the compositor and pass
  that information through to `MouseEvent`. This prevents a layout flush
  that was happening when eagerly trying to fetch `Document` scroll
  offsets.
- Pass keyboard modifiers properly to `MouseEvent`.
- Now all this information is stored and passed as `Point2D` (typed) and
  `Modifiers` which greatly reduces the amount of arguments that need to
  be passed around.

Testing: It is difficult to test input events as they require WebDriver
which
isn't completely working yet. I have manually run Speedometer 2.1 and I
have
verified that this fixes the regression from #37601.
Fixes: #37601.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
2025-06-25 12:29:27 +00:00
Jonathan Schwender
50cf01cf3d
script: const initialize LIVE_REFERENCES (#37688)
With Rust 1.85 it is possible to const initialize Hashmaps if the hash
algorithm does not rely on a random seed.

Testing: No functional changes, covered by existing tests

Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>
2025-06-25 11:27:56 +00:00
batu_hoang
d970584332
webdriver: Move NewWebView, FocusWebView, GetWindowSize, and SetWindowSize to servoshell (#37555)
Follow up to: https://github.com/servo/servo/pull/36714
Moving webdriver [context
commands](https://www.w3.org/TR/webdriver2/#contexts) to be handled in
embedder:

- [x] New Window command - `WebdriverCommandMsg::NewWebView`
- [x]  Switch To Window command - `WebdriverCommandMsg::FocusWebView`
- [x] Resizing commands

cc: @xiaochengh

---------

Signed-off-by: batu_hoang <longvatrong111@gmail.com>
2025-06-25 10:29:34 +00:00
Jonathan Schwender
5ea003752a
Fix write_json_to_file perf regressions (#37687)
cd30b78 improved the memory efficiency of write_json_to_file, but this
causes visible (when profiling) perf regression on my mac, which can
easily be fixed by wrapping the file in a `BufWriter`. This still bounds
peak memory usage, but keeps writing efficient.

Testing: Manual profiling with samply.

Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>
2025-06-25 08:45:20 +00:00
Andrei Volykhin
4ee348a202
imagebitmap: Add 'none' image orientation option (#37634)
The 'none' image orientation option was temporarily deprecated (in 2022)
according to HTML specification with the remark about going to be reused
with
a different meaning in future as the same semantics as CSS 'none'
image-orientation.

https://html.spec.whatwg.org/multipage/#dom-imagebitmapoptions-imageorientation-none
https://www.w3.org/TR/css-images-3/#valdef-image-orientation-none

Official MDN documentation added it back with new meaning (in 2024),
but it wasn't added back to HTML specification (still pending).

https://developer.mozilla.org/en-US/docs/Web/API/Window/createImageBitmap#none

At current moment this option is poor supported on all major browsers,
but there are some
existed WPT tests (ImageBitmap/WebGL) which are actively use it in
createImageBitmap() options.

Chromium (supported):
- stable: same as 'from-image' (but with deprecation warning)
- experimental: ignoring any orientation metadata

Firefox (supported as default option):
- stable: ignoring any orientation metadata ('from-image' do the same)

Testing: Improvements and fails (expects 'from-image' behaviour from
'none' option) in the following tests
-
html/canvas/element/manual/imagebitmap/createImageBitmap-exif-orientation_none.html
- webgl/tests/conformance/textures/misc/exif-orientation.html

Fixes (partialy): #34112

Signed-off-by: Andrei Volykhin <andrei.volykhin@gmail.com>
2025-06-25 07:20:12 +00:00
Jonathan Schwender
922d4b83de
Use FnvHashmap for LiveDOMReferences (#37673)
These maps are keyed on pointers, so using FnvHashMap should be faster
and we don't need the collision resistance properties of the default
hasher.

These maps showed up as hot when profiling the testcase from
https://github.com/servo/servo/issues/37223#issuecomment-3000705438.
Switching the hashing algorithm reduces the time spent hashing, but
overall that is still only a fractional part of the testcase.

Testing: Functionality unchanged. Overall the performance change is to
small to show up in any of our automated performance tests. When
comparing the perf profile of the above linked testcase, one should see
a reduction of time spent hashing (inverse call stack)

Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>
2025-06-25 06:47:20 +00:00
Ashwin Naren
d114feb0fa
[IndexedDB] Reduce heed related panics (#37652)
Allows indexeddb backends to return errors on certain operations.
Currently the errors are not demarcated, as the result type is
`Result<(), ()>`. If this is not appropriate then perhaps having a
string error might be better.

Testing: Some tests might perhaps move from PANIC to FAIL
Fixes: Partially fixes a bit of #37647, more work needs to be done
however

---------

Signed-off-by: Ashwin Naren <arihant2math@gmail.com>
Signed-off-by: Josh Matthews <josh@joshmatthews.net>
Co-authored-by: Josh Matthews <josh@joshmatthews.net>
2025-06-25 00:22:19 +00:00
sagudev
4974b4a1f6
canvas: Remove rect -> line handling (#37664)
This causes wrong rendering on vello. Current backends already handle
one dim zero correctly by themself (this was probably needed for azure),
but if we ever needed this, it should be implemented inside faulty
backend.

Testing: Existing WPT tests

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
2025-06-24 14:13:58 +00:00
sagudev
ef7be66c56
canvas: Use strum::{Display, EnumString} for canvas enums (#37670)
This makes it easier to add variants, I also added some spec links and
reordered enum variants to match the spec.

Testing: Just refactor, but the code is covered by WPT tests.

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
2025-06-24 13:03:41 +00:00
Simon Wülker
2dc62c504f
Implement declarative shadow root support for async HTML parser (#37443)
Implements the
[`TreeSink::attach_declarative_shadow`](https://docs.rs/html5ever/latest/html5ever/interface/trait.TreeSink.html#method.attach_declarative_shadow)
method for the async html parser.

Try run with the async html parser:
https://github.com/simonwuelker/servo/actions/runs/15634240606/job/44046871826.
(There are far fewer failures than in the initial try run from
https://github.com/servo/servo/issues/37418)

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

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
2025-06-24 12:45:50 +00:00
Andrei Volykhin
9487f66eaa
webgl: Ignore pixel storage parameters for ImageBitmap source (#37635)
Follow the WebGL specification and ignore the values of UNPACK_FLIP_Y,
UNPACK_PREMULTIPLY_ALPHA, and UNPACK_COLORSPACE_CONVERSION
if the TexImageSource is an ImageBitmap.
https://registry.khronos.org/webgl/specs/latest/1.0/#6.10

Testing: There are no dedicated test results changes without the PR
#37634
which unblocks new testing scenarios with premultiplied ImageBitmap from
Blob/Canvas/Image sources.

Signed-off-by: Andrei Volykhin <andrei.volykhin@gmail.com>
2025-06-24 11:15:50 +00:00