diff options
author | bors-servo <servo-ops@mozilla.com> | 2020-03-30 10:56:35 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-30 10:56:35 -0400 |
commit | 236762880c48263f8fa2c5a4deb9cf8f7746013c (patch) | |
tree | b651381f3a88b9a46c56018946377bd8b879e737 /components/script/dom/htmlimageelement.rs | |
parent | fd6f9140f79a855b9db5fe4e305f8ca8b6c1a84f (diff) | |
parent | 02fb5a68e6285d86c0a091e4c6ac36a7d436d3f1 (diff) | |
download | servo-236762880c48263f8fa2c5a4deb9cf8f7746013c.tar.gz servo-236762880c48263f8fa2c5a4deb9cf8f7746013c.zip |
Auto merge of #26058 - servo:layout-2020-improvements, r=SimonSapin
Make many improvements to the layout/script comms story
Now `LayoutDom<'dom, T>` is a mere wrapper around a `&'dom T`.
Diffstat (limited to 'components/script/dom/htmlimageelement.rs')
-rw-r--r-- | components/script/dom/htmlimageelement.rs | 28 |
1 files changed, 12 insertions, 16 deletions
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<Arc<Image>>; - + unsafe fn image(self) -> Option<Arc<Image>>; #[allow(unsafe_code)] - unsafe fn image_url(&self) -> Option<ServoUrl>; - + unsafe fn image_url(self) -> Option<ServoUrl>; #[allow(unsafe_code)] - unsafe fn image_density(&self) -> Option<f64>; - + unsafe fn image_density(self) -> Option<f64>; #[allow(unsafe_code)] - unsafe fn image_data(&self) -> (Option<Arc<Image>>, Option<ImageMetadata>); - - fn get_width(&self) -> LengthOrPercentageOrAuto; - fn get_height(&self) -> LengthOrPercentageOrAuto; + unsafe fn image_data(self) -> (Option<Arc<Image>>, Option<ImageMetadata>); + fn get_width(self) -> LengthOrPercentageOrAuto; + fn get_height(self) -> LengthOrPercentageOrAuto; } impl LayoutHTMLImageElementHelpers for LayoutDom<'_, HTMLImageElement> { #[allow(unsafe_code)] - unsafe fn image(&self) -> Option<Arc<Image>> { + unsafe fn image(self) -> Option<Arc<Image>> { (*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<ServoUrl> { + unsafe fn image_url(self) -> Option<ServoUrl> { (*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<Arc<Image>>, Option<ImageMetadata>) { + unsafe fn image_data(self) -> (Option<Arc<Image>>, Option<ImageMetadata>) { 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<f64> { + unsafe fn image_density(self) -> Option<f64> { (*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::<Element>().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::<Element>().unsafe_get()) .get_attr_for_layout(&ns!(), &local_name!("height")) |