Currently, our implementation for each line-checking function reads the
file as bytes, so we need to properly decode each line to UTF-8 before
evaluating it. This ensures it is counted as a string and not as bytes
Testing: I tested by changing the comment like the issue above and it
not give an error
Fixes: #38237
Signed-off-by: Jerens Lensun <jerensslensun@gmail.com>
Losslessly optimizes the Android resources. These are the only non-test
PNGs remaining in the project, to my knowledge.
Testing: Unnecessary, since this only optimizes assets.
Signed-off-by: maple! <averyrudelphe@gmail.com>
Request a reflow when doing page zoom and only modify the scaling of the
WebView scene after the first root pipeline display list with the new
zoom is ready. In addition:
- store zoom limits in `Scale` types
- send `ViewportDetails` along with the display list so that we can
detect when the root pipeline scale is ready.
Testing: This is quite hard to test as it requires verification that
contents are zoomed appropriately at the right time.
Fixes: #38091.
Signed-off-by: Martin Robinson <mrobinson@igalia.com>
The logic was wrong, sometimes we weren't setting it to true on flex
containers that needed it, and then as a workaround we were setting it
to to true on flex items that didn't need it.
For example, this testcase had 5 cache misses when stretching the items,
now we will avoid laying them out again:
```html
<div style="display: flex">
<div></div> <div></div> <div></div> <div></div> <div></div>
</div>
```
Also, the workaround wasn't always working, e.g. it failed to stretch
the green element here:
```html
<div style="display: flex; min-height: 200px">
<div>
<div style="display: flex; height: 100%; background-color: red">
<div style="width: 200px; background-color: green;"></div>
</div>
</div>
</div>
```
Testing: Adding new test
Fixes: #38023
Signed-off-by: Oriol Brufau <obrufau@igalia.com>
Use workspace dependency to sync the `winit` version between examples &
libservo.
Upgrade winit to 0.30.12.
Fixes: The hope is lost as it doesn't fix anything..
---------
Signed-off-by: Euclid Ye <euclid.ye@huawei.com>
If a cell would e.g. span 2 columns, each 50px wide, separated by a 10px
gutter, then we used to lay out the contents of the cell with a 100px
wide containing block. Now we will include the size of the gutter.
Testing: Adding new test
Fixes: #38277
Signed-off-by: Oriol Brufau <obrufau@igalia.com>
They are redundant as marked in #38174 as rendering related rect already
updated in `minibrowser::update`. As a result, we are able to remove
`window_rendering_context` and `inner_size` fields from `struct Window`.
Testing: No regression/behaviour change in all tests running with headed
window.
Fixes:
https://github.com/servo/servo/issues/38255#issuecomment-3117642340
Signed-off-by: Euclid Ye <euclid.ye@huawei.com>
This will block the command, print an error message about an invalid
argument being passed to the ./mach try command, and return the exit
code.
Testing: `./mach try test-wpt`
Fixes: #38193
Signed-off-by: Jerens Lensun <jerensslensun@gmail.com>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
This will allow reusing those conversions in vello_cpu backend.
Testing: Just refactor
Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
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>
- 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>
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>
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: #36823Fixes: #35230
---------
Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
#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>
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>
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#"b"\xff""#).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#"b"\xff""#).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 />
[](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>
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>
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>
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>
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>
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>
- 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>
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>
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>
- We no longer pretend that resize is always successful and simplify the
result computation.
- Adjust minimum window size to match other browsers and the test
expectation.
- Restrict some unnecessary access specifier.
Testing: ` ./mach test-wpt -r
"tests\wpt\tests\webdriver\tests\classic\set_window_rect\set.py"
--log-raw "D:\servo test log\set.txt" --product servodriver
{--headless}`
Fixes: #37804 as Task 8 is last task.
---------
Signed-off-by: Euclid Ye <euclid.ye@huawei.com>
I think this simplifies canvas backends greatly. Before there were many
(needless) hoops from abstract to concrete (backend) and back, now we
can do most stuff on abstract types.
Testing: Existing WPT tests
Fixes: #38022
try run: https://github.com/sagudev/servo/actions/runs/16450978211
Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
Bumps [prettyplease](https://github.com/dtolnay/prettyplease) from
0.2.35 to 0.2.36.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/dtolnay/prettyplease/releases">prettyplease's
releases</a>.</em></p>
<blockquote>
<h2>0.2.36</h2>
<ul>
<li>Preserve braces in <code>use path::to::{self};</code> (<a
href="https://redirect.github.com/dtolnay/prettyplease/issues/121">#121</a>,
thanks <a
href="https://github.com/charlyisidore"><code>@charlyisidore</code></a>)</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="9ae9017fbc"><code>9ae9017</code></a>
Release 0.2.36</li>
<li><a
href="6e28f51132"><code>6e28f51</code></a>
Merge pull request <a
href="https://redirect.github.com/dtolnay/prettyplease/issues/121">#121</a>
from charlyisidore/use-self</li>
<li><a
href="27e359b2d3"><code>27e359b</code></a>
Preserve braces in <code>use std::fmt::{self};</code> <a
href="https://redirect.github.com/dtolnay/prettyplease/issues/120">dtolnay/prettyplease#120</a></li>
<li>See full diff in <a
href="https://github.com/dtolnay/prettyplease/compare/0.2.35...0.2.36">compare
view</a></li>
</ul>
</details>
<br />
[](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>