Commit graph

52186 commits

Author SHA1 Message Date
Delan Azabani
aad368fabd Create source actors from Debugger API notifications
Co-authored-by: atbrakhi <atbrakhi@igalia.com>
Signed-off-by: Delan Azabani <dazabani@igalia.com>
2025-07-29 20:16:29 +08:00
Delan Azabani
bae25bb596 Add new Window globals as debuggees
Signed-off-by: Delan Azabani <dazabani@igalia.com>
Co-authored-by: atbrakhi <atbrakhi@igalia.com>
2025-07-29 20:09:00 +08:00
Delan Azabani
4d7a514923 script: Create a debugger script for the SpiderMonkey Debugger API
Co-authored-by: atbrakhi <atbrakhi@igalia.com>
Signed-off-by: Delan Azabani <dazabani@igalia.com>
2025-07-29 19:47:23 +08:00
Delan Azabani
e8c50390f6 Fix expected values in test_source_breakable_lines_and_positions()
Co-authored-by: atbrakhi <atbrakhi@igalia.com>
Signed-off-by: Delan Azabani <dazabani@igalia.com>
2025-07-29 19:47:23 +08:00
Delan Azabani
5cc5511a10 Add new test test_source_breakable_lines_and_positions()
Co-authored-by: atbrakhi <atbrakhi@igalia.com>
Signed-off-by: Delan Azabani <dazabani@igalia.com>
2025-07-29 19:46:46 +08:00
Delan Azabani
6189040a19 Add comment to setBreakpoint handler in breakpoint list actor
Co-authored-by: atbrakhi <atbrakhi@igalia.com>
Signed-off-by: Delan Azabani <dazabani@igalia.com>
2025-07-29 19:46:46 +08:00
Delan Azabani
4564a4a18a Fix column numbering in getBreakpointPositionsCompressed handler
Co-authored-by: atbrakhi <atbrakhi@igalia.com>
Signed-off-by: Delan Azabani <dazabani@igalia.com>
2025-07-29 19:46:46 +08:00
Delan Azabani
8381b5a6d6 Dummy handler for getAvailableEventBreakpoints in thread actor
Co-authored-by: atbrakhi <atbrakhi@igalia.com>
Signed-off-by: Delan Azabani <dazabani@igalia.com>
2025-07-29 19:46:45 +08:00
Delan Azabani
eadce2ebe0 Handle getBreakpointPositionsCompressed in source actor
Co-authored-by: atbrakhi <atbrakhi@igalia.com>
Signed-off-by: Delan Azabani <dazabani@igalia.com>
2025-07-29 19:46:45 +08:00
Delan Azabani
a7b9f8b2b1 Handle getBreakableLines in source actor
Co-authored-by: atbrakhi <atbrakhi@igalia.com>
Signed-off-by: Delan Azabani <dazabani@igalia.com>
2025-07-29 19:46:45 +08:00
Delan Azabani
e140ca9630 Location type
Co-authored-by: atbrakhi <atbrakhi@igalia.com>
Signed-off-by: Delan Azabani <dazabani@igalia.com>
2025-07-29 19:46:45 +08:00
Delan Azabani
b1503fe832 Make contentType optional in source actor source responses
This is allowed by the protocol docs, and eliminates an unwrap().

Co-authored-by: atbrakhi <atbrakhi@igalia.com>
Signed-off-by: Delan Azabani <dazabani@igalia.com>
2025-07-29 19:46:45 +08:00
Delan Azabani
cc5a4d9436 script: Implement jsglue trap for runJobs()
Co-authored-by: atbrakhi <atbrakhi@igalia.com>
Signed-off-by: Delan Azabani <dazabani@igalia.com>
2025-07-29 19:46:45 +08:00
minghuaw
554b2da1ad
Script: Implement TextDecoderStream (#38112)
This PR implements the `TextDecoderStream`. Other than introducing the
necessary mod and webidl files corresponding to `TextDecoderStream`,
this PR also involves some changes in `TextDecoder` and
`TrasnformStream`:

- The common part that can be shared between `TextDecoder` and
`TextDecoderStream` are extracted into a separate type
`script::dom::textdecodercommon::TextDecoderCommon`. This type could
probably use a different name because there is an interface called
`TextDecoderCommon` in the spec
(https://encoding.spec.whatwg.org/#textdecodercommon) which just gets
included in `TextDecoder` and `TextDecoderStream`.
- The three algorithms in `TransformStream` (`cancel`, `flush`, and
`transform`) all have become `enum` that has a `Js` variant for a JS
function object and a `Native` variant for a rust trait object. Whether
the cancel algorithm needs this enum type is debatable as I did not find
any interface in the spec that explicitly sets the cancel algorithm.

Testing: Existing WPT tests `tests/wpt/tests/encoding/stream` should be
sufficient
Fixes: #37723

---------

Signed-off-by: minghuaw <michael.wu1107@gmail.com>
Signed-off-by: minghuaw <wuminghua7@huawei.com>
Signed-off-by: Minghua Wu <michael.wu1107@gmail.com>
2025-07-29 04:18:15 +00:00
Usman Yahaya Baba
25822920cf
Make request parameter immutable in send_response_to_devtools and send_early_httprequest_to_devtools (#38319)
- Changes request parameters to immutable borrow
Testing: 
Fixes: https://github.com/servo/servo/issues/38300

Signed-off-by: uthmaniv <uthmanyahayababa@gmail.com>
2025-07-29 00:42:20 +00:00
sagudev
d410236c87
canvas: Send CanvasClose to canvas thread from canvas state (#38315)
Currently we only closed `CanvasRenderingContext2D` (and
`OffscreenCanvasRenderingContext2D` because it wraps
`CanvasRenderingContext2D`), but we didn't close last consumer of
`CanvasState` which is `PaintRenderingContext`. To prevent any future
leaks, let's just send `CanvasClose` in `CanvasState` drop.

Testing: Existing WPT tests

---------

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
2025-07-28 20:09:47 +00:00
Euclid Ye
213b532712
cargo: Remove last traces of webdriver from libservo (#38314)
The feature which enables optional dependency & function is never used
and can be safely removed.

Testing: It can still builds.

Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com>
2025-07-28 14:47:56 +00:00
Josh Matthews
02297791c8
chore: Add test for synthesized image documents with CSP headers. (#38191)
Adds a regression test for https://github.com/servo/servo/pull/38186,
verifying that the CSP header on the image is ignored when it's loaded
as a document.

---------

Signed-off-by: Josh Matthews <josh@joshmatthews.net>
2025-07-28 13:45:54 +00:00
sagudev
a67998b520
canvas: Gate raqote backend behind feature (enabled for now) (#38312)
We want to eventually remove raqote backend, but for now we can gate it
behind a feature (still enabled by default in servoshell) like the rest
of backends. `dom_canvas_backend=auto` will select first available
backend. Builds on top of https://github.com/servo/servo/pull/38310 to
support cases where no backend is available.

Testing: It compiles with or without feature

---------

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
2025-07-28 11:54:40 +00:00
shuppy
9da4c74a60
script: Implement jsglue traps for saveJobQueue() (#38232)
in the [SpiderMonkey Debugger
API](https://firefox-source-docs.mozilla.org/js/Debugger/), hooks like
[onNewGlobalObject()](https://firefox-source-docs.mozilla.org/js/Debugger/Debugger.html#onnewglobalobject-global)
use an AutoDebuggerJobQueueInterruption to [switch to a new microtask
queue](b14aebff23/mozjs-sys/mozjs/js/src/debugger/Debugger.cpp (L2834-L2841))
and avoid clobbering the debuggee’s microtask queue. this in turn relies
on JobQueue::saveJobQueue(), which is [not yet implemented in
RustJobQueue](b14aebff23/mozjs-sys/src/jsglue.cpp (L83-L86)).

this patch bumps mozjs to servo/mozjs#595, which implements
[saveJobQueue() and
SavedJobQueue](b14aebff23/mozjs-sys/mozjs/js/public/Promise.h (L92-L114))
for RustJobQueue by calling into Servo via two new JobQueueTraps that
create and destroy extra “interrupt” queues for use by the debugger.

SpiderMonkey [does not own external job
queues](b14aebff23/mozjs-sys/mozjs/js/public/Promise.h (L117-L123)),
so the lifetime of these queues is managed in Servo, where they are
stored in a Vec-based stack. stack-like behaviour is adequate for
SpiderMonkey’s save and restore patterns, as far as we can tell, but
we’ve added an assertion just in case.

Testing: manually tested working in devtools debugger patch (#37667),
where it will undergo automated tests
Fixes: #38311

---------

Signed-off-by: Delan Azabani <dazabani@igalia.com>
Co-authored-by: atbrakhi <atbrakhi@igalia.com>
2025-07-28 11:39:35 +00:00
batu_hoang
f5ee72f89a
Rework webdriver session (#38225)
Reimplement webdriver session for better match to spec:

- Add `create_session`:
[spec](https://www.w3.org/TR/webdriver2/#dfn-create-a-session)
- Refactor `handle_new_session`
- Replace `PageLoadStrategy` string by enum

---------

Signed-off-by: batu_hoang <hoang.binh.trong@huawei.com>
2025-07-28 10:14:14 +00:00
sagudev
ae69646371
canvas: Make 2D context state creation failable and use dom_canvas_backend pref for backend selection (#38310)
Before script just crashed in those cases because IPCSender was dropped,
now we send `None` to tell script about the failure and fail getContext
or registerPainter accordingly.
This PR also unifies `dom_canvas_{backends}_enabled` prefs into
`dom_canvas_backend` which is more flexible in multi-backends scenarios.

Reviewable per commit.

Testing: Added servo specific WPT test.

---------

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
2025-07-28 09:13:07 +00:00
Jerens Lensun
93d234d270
mach: Add type check on python/servo directory (#38085)
Introduce `python/servo` folder in pyrefly type checker

Testing: Manual testing via `./mach test-tidy` command

---------

Signed-off-by: Jerens Lensun <jerensslensun@gmail.com>
2025-07-28 04:16:08 +00:00
sagudev
056b1538c0
canvas: Add vello_cpu backend (#38282)
vello_cpu does not have any tests timeouts, because we do not need
download stuff from GPU as all work happens on CPU. So performance wise
it's better then classic vello at least for our usecase. There are some
vello bugs, but I think we will be able to sort them out within
upstream, eventually. Interestingly enough there are no new PASS like
they were with classic vello.

Difference with raqote can be observed here:
https://github.com/sagudev/servo/actions/runs/16549241085/attempts/1#summary-46802486798

## Known vello problems:

- https://github.com/linebender/vello/issues/1119
- https://github.com/linebender/vello/issues/1056
-
`/html/canvas/element/fill-and-stroke-styles/2d.gradient.interpolate.coloralpha.html`
- `kurbo::Cap::Butt` is defect (only visible with big lineWidth)
https://github.com/linebender/vello/issues/1063
  - `/html/canvas/element/line-styles/2d.line.cross.html`
  - `/html/canvas/element/line-styles/2d.line.miter.acute.html`
- other lack of strong correct problems
(https://github.com/linebender/vello/issues/1063#issuecomment-2998084736):
  - `/html/canvas/element/path-objects/2d.path.rect.selfintersect.html`
- `putImageData(getImageData(...), ...)` is lossy (precision problems,
might be due to ImageData being unmultiplied)
-
`/html/canvas/element/pixel-manipulation/2d.imageData.put.unchanged.html`

Testing: Tested using vello_cpu_canvas subsuite

---------

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
2025-07-27 19:56:38 +00:00
Nico Burns
15be75f955
Disable serde feature of taffy dependency (#38303)
Disables the serde of taffy. This feature doesn't seem to be actually
being used.

Testing: This would cause build errors if it was required. So if it
builds it should be fine.

Signed-off-by: Nico Burns <nico@nicoburns.com>
2025-07-27 14:54:27 +00:00
Kingsley Yung
ab6e151c89
script_binding: wrapper of JSAutoStructuredCloneBuffer (#38284)
Instead of using raw pointer of JSAutoStructuredCloneBuffer, use its
wrapper JSAutoStructuredCloneBufferWrapper, which implements the Drop
trait that can prevent leakage when structured cloning fails.

Testing: Refactoring. Existing tests should be enough.
Fixes: #37966

---------

Signed-off-by: Kingsley Yung <kingsley@kkoyung.dev>
2025-07-27 12:41:02 +00:00
Servo WPT Sync
633d746e2f
Sync WPT with upstream (27-07-2025) (#38296)
Automated downstream sync of changes from upstream as of 27-07-2025
[no-wpt-sync]

Signed-off-by: WPT Sync Bot <ghbot+wpt-sync@servo.org>
2025-07-27 01:45:05 +00:00
Oriol Brufau
9614fb997a
layout: Inline {default,natural}_{inline,block}_size methods (#38276)
They only had one caller.

Testing: Unnecessary (no behavior change)

Signed-off-by: Oriol Brufau <obrufau@igalia.com>
2025-07-26 17:40:01 +00:00
sagudev
bc71fb8c0d
canvas: Respect FillRule (#38294)
We just need to pass user provided FillRule via IPC to canvas paint
thread, then pass it all down to backend, which will handle it.

Testing: Added WPT tests.

---------

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
2025-07-26 17:20:04 +00:00
Ashwin Naren
4188852963
script: Don't panic on IndexedDB put operation structured clone (#38280)
Fixes panic by rethrowing exceptions.

Testing: Covered by WPT
Fixes: #38075

---------

Signed-off-by: Ashwin Naren <arihant2math@gmail.com>
2025-07-26 16:35:10 +00:00
Ashwin Naren
e1bda86861
script: Implement converting values to indexeddb key ranges (#38278)
Implements
https://www.w3.org/TR/IndexedDB-2/#convert-a-value-to-a-key-range. Part
of #38187.

Testing: Currently unused, doesn't change anything
Fixes: None

Signed-off-by: Ashwin Naren <arihant2math@gmail.com>
2025-07-26 13:20:52 +00:00
sagudev
f8d6c5646c
canvas: Use bytemuck to remove unsafe from raqote backend (#38283)
This PR changes surface type from `Vec<u8>` to `Vec<u32>` as this is
native type of raqote's backend. We used unsafe for `Vec<u8>` <->
`Vec<u32>` casting that is replaced with bytemuck. Bytemuck is already
in cargo lock.

Testing: Existing WPT tests.

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
2025-07-26 13:16:16 +00:00
sagudev
daebb5a033
canvas: Move peniko/kurbo conversions in separate file (#38279)
This will allow reusing those conversions in vello_cpu backend.

Testing: Just refactor

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
2025-07-26 13:14:25 +00:00
Kingsley Yung
4d899ecba5
webdriver: configure Expires and SameSite in handle_add_cookie (#38285)
Handler::handle_add_cookie did not configure the attributes "Expires"
and "SameSite". This patch adds them.

Testing: Passing WPT tests that were expected to fail.
Fixes: https://github.com/servo/servo/pull/37715#issuecomment-3069734014

Signed-off-by: Kingsley Yung <kingsley@kkoyung.dev>
2025-07-26 12:23:24 +00:00
Euclid Ye
a3de3ffa75
webdriver: Implement maximize window for both headless&headed window (#38271)
- Implement [Maximize
Window](https://w3c.github.io/webdriver/#maximize-window)
- Previously, headless window screen size is same as inner size if not
specified in preference. We make it double as required by the test to
not have max window initially.
- Some other random cleanup.

Testing: webdriver Stress test for maximize window (headed + headless).

---------

Signed-off-by: Euclid Ye <euclid.ye@huawei.com>
2025-07-26 12:21:17 +00:00
JoeDow
9ef4d0c9d7
layout: Correctly marking box damage when text-related style changed (#38059)
This change aims to supplement the missing incremental box tree
construction when text-related styles change. Since certain text style
adjustments can alter visible text content and typography. Therefore,
the parent nodes of such text are marked as needing to re-collect their
box tree children to ensure the correct display of text.

Signed-off-by: sharpshooter_pt <ibluegalaxy_taoj@163.com>
2025-07-26 11:50:13 +00:00
sagudev
d678901122
canvas: Add vello backend (#36821)
Add vello backend by implementing Backend traits in canvas crate (so
this lives in canvas_paint_thread - embedded process). Current
implementation uses normal wgpu, so we block on GPU work. Vello backend
is gated behind `vello` feature and `dom_canvas_vello_enabled` pref.

Feature-wise this backend is on on par with raqote (sometimes better
sometimes worse), but performance wise it's worse.

## Known vello problems:

- image roundtrip does not work (fixed in
https://github.com/linebender/vello/pull/974)
- https://github.com/linebender/vello/issues/1066 (fixed)
- clip layers are not working properly:
https://github.com/linebender/vello/issues/1061
  - `/html/canvas/element/pixel-manipulation/2d.imageData.put.*`
  - `/html/canvas/element/path-objects/2d.path.clip.intersect.html`
- https://github.com/linebender/vello/issues/1056
-
`/html/canvas/element/fill-and-stroke-styles/2d.gradient.interpolate.coloralpha.html`
- `kurbo::Cap::Butt` is defect (only visible with big lineWidth)
https://github.com/linebender/vello/issues/1063
  - `/html/canvas/element/line-styles/2d.line.cross.html`
  - `/html/canvas/element/line-styles/2d.line.miter.acute.html`
- other lack of strong correct problems
(https://github.com/linebender/vello/issues/1063#issuecomment-2998084736):
  - `/html/canvas/element/path-objects/2d.path.rect.selfintersect.html`
- There is currently no way to do put image properly in vello as we
would need to ignore all clips and other stuff (we try to work around
this on best effort basis)
https://github.com/linebender/vello/issues/1088
  - `/html/canvas/element/pixel-manipulation/2d.imageData.put.*`
- precision problems
  - `/html/canvas/element/path-objects/2d.path.stroke.scale2.html`
  - `/html/canvas/element/path-objects/2d.path.arc.scale.1.html`

## Known servo problems

- bad performance due to blocking on GPU work
  - some get/put intensive tests `TIMEOUT`
- proper shadow support (non-blocker as we already are living without it
now)
- support for rect shadow is there but unimplemented currently as that's
the state in raqote

Testing: `mach try vello` will run normal WPT (with raqote) +
vello_canvas subsuite that runs only on `/html/canvas/element`. All
subsuite expectations are stored separately.
Fixes: #36823
Fixes: #35230

---------

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
2025-07-26 04:53:10 +00:00
Ashwin Naren
c2ed599eb1
script: implement IDBKeyRange (#38268)
#37684 provided the backend for this change. The key range interface
just wraps a `IndexedDBKeyRange` and exposes the methods from it as per
the spec.

Spec: https://www.w3.org/TR/IndexedDB-2/#keyrange
Testing: WPT tests (some regressions have been exposed, but that's fine)

---------

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-07-26 02:59:15 +00:00
sagudev
8b2a5fca54
canvas: Make GetImageData simple and only IPC message to obtain pixels (#38274)
Currently we had `GetImageData` and `SendPixels` to obtain pixels from
script thread. This PR unifies those into single `GetImageData` that
does not need canvas size and has optional rect (for obtaining sub
image).

Testing: Existing WPT tests

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
2025-07-26 02:28:52 +00:00
dependabot[bot]
77f85f390e
build(deps): bump litrs from 0.4.1 to 0.4.2 (#38275)
Bumps [litrs](https://github.com/LukasKalbertodt/litrs) from 0.4.1 to
0.4.2.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/LukasKalbertodt/litrs/releases">litrs's
releases</a>.</em></p>
<blockquote>
<h2>v0.4.2</h2>
<ul>
<li>Fix incorrect byte string value with non-ASCII <code>\xHH</code>
byte string escapes
<ul>

<li><code>ByteStringLit::parse(r#&quot;b&quot;\xff&quot;&quot;#).unwrap().value()</code>
would return <code>[0xc3, 0xbf]</code> instead of
<code>[0xff]</code>.</li>
</ul>
</li>
<li>Remove CR LF normalization to align with spec
<ul>
<li>This is technically a breaking change, but released with a minor
version bump as it just aligns with the specification. It is extremely
unlikely to affect any real world use case.</li>
</ul>
</li>
<li>Fix incorrect error span for out-of-range Unicode escapes</li>
</ul>
</blockquote>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/LukasKalbertodt/litrs/blob/main/CHANGELOG.md">litrs's
changelog</a>.</em></p>
<blockquote>
<h2>[0.4.2] - 2025-07-25</h2>
<ul>
<li>Fix incorrect byte string value with non-ASCII <code>\xHH</code>
byte string escapes
<ul>

<li><code>ByteStringLit::parse(r#&quot;b&quot;\xff&quot;&quot;#).unwrap().value()</code>
would return <code>[0xc3, 0xbf]</code> instead of
<code>[0xff]</code>.</li>
</ul>
</li>
<li>Remove CR LF normalization to align with spec
<ul>
<li>This is technically a breaking change, but released with a minor
version bump as it just aligns with the specification. It is extremely
unlikely to affect any real world use case.</li>
</ul>
</li>
<li>Fix incorrect error span for out-of-range Unicode escapes</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="1dc8a3e95c"><code>1dc8a3e</code></a>
Bump version to 0.4.2</li>
<li><a
href="8c55d089c6"><code>8c55d08</code></a>
Fix incorrect error span for out-of-range Unicode escapes</li>
<li><a
href="8fe855226f"><code>8fe8552</code></a>
Fix bug with non-ASCII \xHH byte string escapes</li>
<li><a
href="ed84018240"><code>ed84018</code></a>
Refactor escape code to make it more flexible for upcoming
c-strings</li>
<li><a
href="15edbcd138"><code>15edbcd</code></a>
Remove CR LF normalization to align with spec</li>
<li><a
href="d3cf292593"><code>d3cf292</code></a>
Update CI workflow</li>
<li>See full diff in <a
href="https://github.com/LukasKalbertodt/litrs/compare/v0.4.1...v0.4.2">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=litrs&package-manager=cargo&previous-version=0.4.1&new-version=0.4.2)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-07-25 17:38:17 +00:00
sagudev
fc0038743d
canvas: Make pixel obtaining methods take &mut GenericDrawTarget (#38264)
This will be needed for vello_cpu. While we could wrap it in RefCell for
inner mut, but that would be less ergonomic and performant.

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

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
2025-07-25 13:22:41 +00:00
JoeDow
9d29017c0d
layout: optimize the propagation and cleanup of RestyleDamage (#38199)
This change optimizes `RestyleDamage` propagation and cleanup to reduce
unnecessary box reconstruction and relayouts, while preventing damage
from the current reflow affecting subsequent ones. Improvements include:
- For box damage caused by `NodeDamage`, `RestyleDamage::RELAYOUT` is no
longer marked immediately—avoiding erroneous propagation of
`LayoutDamage::RECOLLECT_BOX_TREE_CHILDREN` to descendants during
`RestyleDamage` propagation.
- Clearing damage for nodes whose boxes will be preserved, preventing it
from carrying over to the next reflow and increasing its workload.

Testing: This should not change observable behavior and is thus covered
by existing WPT tests. Although Servo lacks performance test cases,
manual testing shows that this modification reduces reflow time by
nearly 250ms, representing a decrease of approximately 25%.

Signed-off-by: sharpshooter_pt <ibluegalaxy_taoj@163.com>
2025-07-25 12:10:16 +00:00
Leo Ring
87bbe0b374
servoshell: Properly set RenderingContext size after resizing (#38257)
The tab bar would disappear on resizes, this just reverts the change
which introduced the bug.

Testing: servoshell doesn't currently have tests, so this change does
not come with a test.
Fixes: https://github.com/servo/servo/issues/38255

Signed-off-by: Leo Ring <leoring03@gmail.com>
2025-07-25 12:05:50 +00:00
sagudev
420a5a64a7
canvas: Remove Backend trait (#38262)
After #38214 `Backend` trait is only used as DrawTarget builder and as
type holder. By moving types and DrawTarget creation into
`GenericDrawTarget` trait, we can completely remove `Backend` trait.

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

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
2025-07-25 12:05:03 +00:00
JoeDow
5cd57f9dba
layout: Add incremental box tree construction for inline boxes (#38084)
This changes extend the incremental box tree construction for inline
boxes. Since an `InlineItem` can be split into multiple `InlineItem`s by
a block element, the reason such an inline item is marked as damaged may
simply be the removal of the block element or the need to reconstruct
its box tree. Therefore, under the current LayoutDamage design,
theoretically, even damaged inline items might still have some of their
splits reusable. However, based on the principle of simplicity and
effectiveness, this PR only considers reusing undamaged inline boxes.

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

Signed-off-by: sharpshooter_pt <ibluegalaxy_taoj@163.com>
2025-07-25 11:49:46 +00:00
Ashwin Naren
3f1e170410
script: Update indexeddb serialization (#38269)
- Dates are now serialized as f64s (like how firefox does it)
- Array buffers are serialized with structured cloning (this is not the
most correct/efficent way to serialize them, however it is currently
better than not supporting array buffers at all)
- Array types are still unimplemented.

Testing: WPT
Fixes: Some panicking

---------

Signed-off-by: Ashwin Naren <arihant2math@gmail.com>
2025-07-25 11:11:22 +00:00
Kenzie Raditya Tirtarahardja
165ede59cd
script(webdriver): Send keys set caret at the end of content of text input (#38250)
Remote end step of [element send
keys](https://w3c.github.io/webdriver/#element-send-keys)

> Step 8.2. Set the text insertion caret using [set selection
range](https://w3c.github.io/webdriver/#dfn-set-selection-range) using
current text length for both the start and end parameters.

Also check if the element is already an active element before focusing
(Step 7.7).

Testing:
`./tests/wpt/tests/webdriver/tests/classic/element_send_keys/form_controls.py`

---------

Signed-off-by: PotatoCP <Kenzie.Raditya.Tirtarahardja@huawei.com>
Signed-off-by: Kenzie Raditya Tirtarahardja <kenzieradityatirtarahardja18@gmail.com>
Co-authored-by: Euclid Ye <yezhizhenjiakang@gmail.com>
2025-07-25 07:24:48 +00:00
Ashwin Naren
ab78a76da6
script: Implement IDBFactory.cmp (#38260)
Implements `IDBFactory.cmp`, most of the work was done by #38123.

Testing: Covered by WPT (lots of flaky results: the appropriate tests
are in tests/wpt/meta/IndexedDB/idlharness.any.js.ini)
Fixes: None

---------

Signed-off-by: Ashwin Naren <arihant2math@gmail.com>
2025-07-25 05:29:10 +00:00
Jo Steven Novaryo
6cd8578f8b
dom: Textual Input UA Shadow Dom (#37527)
Depend on: 
- https://github.com/servo/servo/pull/37427
- https://github.com/servo/servo/pull/37483

Utilize input `type=text` for the display of all textual input. In
which, consist of
https://html.spec.whatwg.org/#the-input-element-as-a-text-entry-widget
and
https://html.spec.whatwg.org/#the-input-element-as-domain-specific-widgets
inputs.

For `password`, `url`, `tel`, and, `email` input, the appearance of
input container is exactly the same as the `text` input. Other types of
textual input simply extends `text` input by adding extra components
inside the container.

Testing: Servo textual input appearance WPT.

---------

Signed-off-by: stevennovaryo <steven.novaryo@gmail.com>
Signed-off-by: Jo Steven Novaryo <jo.steven.novaryo@huawei.com>
2025-07-25 04:38:14 +00:00
Jo Steven Novaryo
1d896699a4
script: Implement CSSStyleSheet.replace (#38244)
Implement `CSSStyleSheet.replace`
[#dom-cssstylesheet-replace](https://drafts.csswg.org/cssom/#dom-cssstylesheet-replace)
with disallow modification flag
[#concept-css-style-sheet-disallow-modification-flag](https://drafts.csswg.org/cssom/#concept-css-style-sheet-disallow-modification-flag).

Basically it would behave like `replaceSync`, but we are running it
asynchronously.

Testing: Existing WPT coverage.
Part of: https://github.com/servo/servo/issues/36162

---------

Signed-off-by: Jo Steven Novaryo <jo.steven.novaryo@huawei.com>
2025-07-25 03:05:22 +00:00