Initial move of canvas/context/snapshot size from u64 -> u32

Changed the two instances of `euclid::default::Size2D<u64>` in
`servo/components/script/canvas_context.rs` and
`servo/components/shared/snapshot/lib.rs` that were outlined as the bare minimum
in "Make canvas/context/snapshot size be u32 everywhere" to
`euclid::default::Size2D<u32>`. Every other change made in this commit is
either:
 - of similar nature, and is the minimum that would allow compilation
 - resolving lints triggered by the former

More might be needed to complete the issue, but I feel like this is a good
starting point.

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

Signed-off-by: hashcatHitman <155700084+hashcatHitman@users.noreply.github.com>
This commit is contained in:
hashcatHitman 2025-05-03 15:41:45 -04:00
parent c94605b13e
commit 326a2e9ab6
No known key found for this signature in database
14 changed files with 53 additions and 53 deletions

View file

@ -48,7 +48,7 @@ pub(crate) trait CanvasContext {
true
}
fn size(&self) -> Size2D<u64> {
fn size(&self) -> Size2D<u32> {
self.canvas().size()
}
@ -73,12 +73,12 @@ pub(crate) trait CanvasContext {
}
pub(crate) trait CanvasHelpers {
fn size(&self) -> Size2D<u64>;
fn size(&self) -> Size2D<u32>;
fn canvas(&self) -> Option<&HTMLCanvasElement>;
}
impl CanvasHelpers for HTMLCanvasElementOrOffscreenCanvas {
fn size(&self) -> Size2D<u64> {
fn size(&self) -> Size2D<u32> {
match self {
HTMLCanvasElementOrOffscreenCanvas::HTMLCanvasElement(canvas) => {
canvas.get_size().cast()
@ -164,7 +164,7 @@ impl CanvasContext for RenderingContext {
}
}
fn size(&self) -> Size2D<u64> {
fn size(&self) -> Size2D<u32> {
match self {
RenderingContext::Placeholder(context) => (*context.context().unwrap()).size(),
RenderingContext::Context2d(context) => context.size(),
@ -251,7 +251,7 @@ impl CanvasContext for OffscreenRenderingContext {
}
}
fn size(&self) -> Size2D<u64> {
fn size(&self) -> Size2D<u32> {
match self {
OffscreenRenderingContext::Context2d(context) => context.size(),
}