From 1cd3d6bd4cd0071c8c35d1f891b9f1edaaf20ac7 Mon Sep 17 00:00:00 2001 From: Anthony Ramine Date: Tue, 31 Mar 2020 22:44:47 +0200 Subject: Introduce >::current_request This safe helper contains the only source of unsafety from the actual image layout helpers methods, making them completely safe. --- components/script/dom/node.rs | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) (limited to 'components/script/dom/node.rs') diff --git a/components/script/dom/node.rs b/components/script/dom/node.rs index 7348431d4f3..b7215cfd92b 100644 --- a/components/script/dom/node.rs +++ b/components/script/dom/node.rs @@ -1493,25 +1493,21 @@ impl<'dom> LayoutNodeHelpers<'dom> for LayoutDom<'dom, Node> { #[allow(unsafe_code)] fn image_url(self) -> Option { - unsafe { - self.downcast::() - .expect("not an image!") - .image_url() - } + self.downcast::() + .expect("not an image!") + .image_url() } #[allow(unsafe_code)] fn image_data(self) -> Option<(Option>, Option)> { - unsafe { self.downcast::().map(|e| e.image_data()) } + self.downcast::().map(|e| e.image_data()) } #[allow(unsafe_code)] fn image_density(self) -> Option { - unsafe { - self.downcast::() - .expect("not an image!") - .image_density() - } + self.downcast::() + .expect("not an image!") + .image_density() } fn canvas_data(self) -> Option { -- cgit v1.2.3