Now that we are standardizing on the `_traits` crates becoming `_api`
and exposing the API of the crate that they get their name from [^1],
`script_layout_interface` becomes `layout_api` as it exposes the API for
`layout` that is used by `script` This brings the crate in line with the
naming of the other ones in `shared`.
[^1]:
https://servo.zulipchat.com/#narrow/channel/263398-general/topic/Organizing.20*_traits.20crates/with/396893711
Testing: This should not change any behavior and thus is covered by
existing tests.
Signed-off-by: Martin Robinson <mrobinson@igalia.com>
1. The `shared` directory is for the "_traits" crates, which will likely
be moved out of this directly at some point and renamed "_api". These
crates expose the API of crates to avoid circular dependencies.
`Snapshot` isn't really this.
2. `Snapshot` is essentially a specialied kind of `Image` so it makes
sense that it is grouped with other image-related things in `pixels`.
Testing: This should not change any behavior so is covered by existing
tests.
Signed-off-by: Martin Robinson <mrobinson@igalia.com>
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>
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>
When the canvas context mode is a placeholder then we shouldn't resize
the context.
Testing: Includes a new test
Fixes: https://github.com/servo/servo/issues/36846
---------
Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
All canvases return `Option<ImageKey>`.
Testing: Just refactor without behavior changes
Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
this allows us to simplify canvas element/offscreen impl to only call
CanvasContext implementations (no more match statements).
This will help with impl more offscreen canvas contextl.
Testing: WPT and rustc
Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
Each canvas context returns snapshot instead of just raw bytes. This
allows as to hold off conversions (BGRA <-> RGBA, (un)premultiply) to
when/if they are actually needed. For example when loading snapshot into
webgl we can load both RGBA and BGRA so no conversion is really needed.
Currently whole thing is designed to be able to be extend on
https://github.com/servo/ipc-channel/pull/356, to make less copies.
Hence some commented out code.
Fixes#35759
There are tests for these changes in WPT
---------
Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>