Remove ref_filter_map dependency (#36857)

Instead, use the `filter_map` functions of `std::cell::Ref` and
`accountable_refcell::Ref`, which provide the same functionality as
`ref_filter_map`.

Testing: Refactoring for removing dependency. No extra test is needed.
Fixes: #36851

---------

Signed-off-by: Kingsley Yung <kingsley@kkoyung.dev>
This commit is contained in:
Kingsley Yung 2025-05-18 22:00:58 +08:00 committed by GitHub
parent edea2caec1
commit 1271dbf6ec
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 15 additions and 23 deletions

View file

@ -10,7 +10,7 @@ use js::rust::{HandleObject, HandleValue};
use snapshot::Snapshot;
use crate::canvas_context::{CanvasContext, OffscreenRenderingContext};
use crate::dom::bindings::cell::{DomRefCell, Ref, ref_filter_map};
use crate::dom::bindings::cell::{DomRefCell, Ref};
use crate::dom::bindings::codegen::Bindings::OffscreenCanvasBinding::{
OffscreenCanvasMethods, OffscreenRenderingContext as RootedOffscreenRenderingContext,
};
@ -84,7 +84,7 @@ impl OffscreenCanvas {
}
pub(crate) fn context(&self) -> Option<Ref<OffscreenRenderingContext>> {
ref_filter_map(self.context.borrow(), |ctx| ctx.as_ref())
Ref::filter_map(self.context.borrow(), |ctx| ctx.as_ref()).ok()
}
pub(crate) fn get_image_data(&self) -> Option<Snapshot> {