mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
This PR moves the `create_image_bitmap` method from `GlobalScope` to a helper function within the `ImageBitmap` implementation in `imagebitmap.rs`. Moving this method improves code organization and maintainability. Given that `globalscope.rs` is already quite large, relocating `create_image_bitmap` to `imagebitmap.rs` places it closer to the `ImageBitmap` struct it primarily operates on. As mentioned in the issue description (No dedicated tests are required for this change, as long as the project builds), which it does using `./mach build`. Also ran `./mach fmt` and `./mach test-tidy` which both didn't report any issue. Closes #37348 Signed-off-by: Bhuwan Pandit <bhuwanpandit109@gmail.com>
This commit is contained in:
parent
0832ec5d96
commit
d7269c0f3b
4 changed files with 409 additions and 390 deletions
|
@ -58,6 +58,7 @@ use crate::dom::performance::Performance;
|
|||
use crate::dom::promise::Promise;
|
||||
use crate::dom::trustedscripturl::TrustedScriptURL;
|
||||
use crate::dom::trustedtypepolicyfactory::TrustedTypePolicyFactory;
|
||||
use crate::dom::types::ImageBitmap;
|
||||
#[cfg(feature = "webgpu")]
|
||||
use crate::dom::webgpu::identityhub::IdentityHub;
|
||||
use crate::dom::window::{base64_atob, base64_btoa};
|
||||
|
@ -465,9 +466,16 @@ impl WorkerGlobalScopeMethods<crate::DomTypeHolder> for WorkerGlobalScope {
|
|||
options: &ImageBitmapOptions,
|
||||
can_gc: CanGc,
|
||||
) -> Rc<Promise> {
|
||||
let p = self
|
||||
.upcast::<GlobalScope>()
|
||||
.create_image_bitmap(image, 0, 0, None, None, options, can_gc);
|
||||
let p = ImageBitmap::create_image_bitmap(
|
||||
self.upcast(),
|
||||
image,
|
||||
0,
|
||||
0,
|
||||
None,
|
||||
None,
|
||||
options,
|
||||
can_gc,
|
||||
);
|
||||
p
|
||||
}
|
||||
|
||||
|
@ -482,7 +490,8 @@ impl WorkerGlobalScopeMethods<crate::DomTypeHolder> for WorkerGlobalScope {
|
|||
options: &ImageBitmapOptions,
|
||||
can_gc: CanGc,
|
||||
) -> Rc<Promise> {
|
||||
let p = self.upcast::<GlobalScope>().create_image_bitmap(
|
||||
let p = ImageBitmap::create_image_bitmap(
|
||||
self.upcast(),
|
||||
image,
|
||||
sx,
|
||||
sy,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue