Change canvas/context/snapshot size from u64 -> u32 (#36827)

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>
This commit is contained in:
Sam K 2025-06-07 14:37:21 +00:00 committed by GitHub
parent 87de9fdf8c
commit a625420b23
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
14 changed files with 69 additions and 69 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(),
}