diff --git a/components/script/dom/htmlimageelement.rs b/components/script/dom/htmlimageelement.rs index 386a77041ac..5afbb4f0535 100644 --- a/components/script/dom/htmlimageelement.rs +++ b/components/script/dom/htmlimageelement.rs @@ -1367,24 +1367,20 @@ impl MicrotaskRunnable for ImageElementMicrotask { pub trait LayoutHTMLImageElementHelpers { #[allow(unsafe_code)] - unsafe fn image(&self) -> Option>; - + unsafe fn image(self) -> Option>; #[allow(unsafe_code)] - unsafe fn image_url(&self) -> Option; - + unsafe fn image_url(self) -> Option; #[allow(unsafe_code)] - unsafe fn image_density(&self) -> Option; - + unsafe fn image_density(self) -> Option; #[allow(unsafe_code)] - unsafe fn image_data(&self) -> (Option>, Option); - - fn get_width(&self) -> LengthOrPercentageOrAuto; - fn get_height(&self) -> LengthOrPercentageOrAuto; + unsafe fn image_data(self) -> (Option>, Option); + fn get_width(self) -> LengthOrPercentageOrAuto; + fn get_height(self) -> LengthOrPercentageOrAuto; } impl LayoutHTMLImageElementHelpers for LayoutDom<'_, HTMLImageElement> { #[allow(unsafe_code)] - unsafe fn image(&self) -> Option> { + unsafe fn image(self) -> Option> { (*self.unsafe_get()) .current_request .borrow_for_layout() @@ -1393,7 +1389,7 @@ impl LayoutHTMLImageElementHelpers for LayoutDom<'_, HTMLImageElement> { } #[allow(unsafe_code)] - unsafe fn image_url(&self) -> Option { + unsafe fn image_url(self) -> Option { (*self.unsafe_get()) .current_request .borrow_for_layout() @@ -1402,7 +1398,7 @@ impl LayoutHTMLImageElementHelpers for LayoutDom<'_, HTMLImageElement> { } #[allow(unsafe_code)] - unsafe fn image_data(&self) -> (Option>, Option) { + unsafe fn image_data(self) -> (Option>, Option) { let current_request = (*self.unsafe_get()).current_request.borrow_for_layout(); ( current_request.image.clone(), @@ -1411,7 +1407,7 @@ impl LayoutHTMLImageElementHelpers for LayoutDom<'_, HTMLImageElement> { } #[allow(unsafe_code)] - unsafe fn image_density(&self) -> Option { + unsafe fn image_density(self) -> Option { (*self.unsafe_get()) .current_request .borrow_for_layout() @@ -1420,7 +1416,7 @@ impl LayoutHTMLImageElementHelpers for LayoutDom<'_, HTMLImageElement> { } #[allow(unsafe_code)] - fn get_width(&self) -> LengthOrPercentageOrAuto { + fn get_width(self) -> LengthOrPercentageOrAuto { unsafe { (*self.upcast::().unsafe_get()) .get_attr_for_layout(&ns!(), &local_name!("width")) @@ -1431,7 +1427,7 @@ impl LayoutHTMLImageElementHelpers for LayoutDom<'_, HTMLImageElement> { } #[allow(unsafe_code)] - fn get_height(&self) -> LengthOrPercentageOrAuto { + fn get_height(self) -> LengthOrPercentageOrAuto { unsafe { (*self.upcast::().unsafe_get()) .get_attr_for_layout(&ns!(), &local_name!("height"))