diff options
author | Josh Matthews <josh@joshmatthews.net> | 2018-10-12 12:35:12 -0400 |
---|---|---|
committer | Josh Matthews <josh@joshmatthews.net> | 2018-10-12 21:55:09 -0400 |
commit | 49d2ea4f74d94cc5c72b5dcc724d9e5ddf6fc4d6 (patch) | |
tree | bebbffd678bf599e249f255af2cbd1acd965b852 /components/script/dom/htmlimageelement.rs | |
parent | 5f463d3c97e1ebb7436b611cd62ff6edcc61daa7 (diff) | |
download | servo-49d2ea4f74d94cc5c72b5dcc724d9e5ddf6fc4d6.tar.gz servo-49d2ea4f74d94cc5c72b5dcc724d9e5ddf6fc4d6.zip |
Make layout use available image data before querying the image cache.
Diffstat (limited to 'components/script/dom/htmlimageelement.rs')
-rw-r--r-- | components/script/dom/htmlimageelement.rs | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/components/script/dom/htmlimageelement.rs b/components/script/dom/htmlimageelement.rs index ca9243beb1b..b31c5e886af 100644 --- a/components/script/dom/htmlimageelement.rs +++ b/components/script/dom/htmlimageelement.rs @@ -1328,6 +1328,9 @@ pub trait LayoutHTMLImageElementHelpers { #[allow(unsafe_code)] 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; } @@ -1352,6 +1355,14 @@ impl LayoutHTMLImageElementHelpers for LayoutDom<HTMLImageElement> { } #[allow(unsafe_code)] + 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(), current_request.metadata.clone()) + } + + #[allow(unsafe_code)] unsafe fn image_density(&self) -> Option<f64> { (*self.unsafe_get()) .current_request |