aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/htmlimageelement.rs
diff options
context:
space:
mode:
authorJosh Matthews <josh@joshmatthews.net>2018-10-12 12:35:12 -0400
committerJosh Matthews <josh@joshmatthews.net>2018-10-12 21:55:09 -0400
commit49d2ea4f74d94cc5c72b5dcc724d9e5ddf6fc4d6 (patch)
treebebbffd678bf599e249f255af2cbd1acd965b852 /components/script/dom/htmlimageelement.rs
parent5f463d3c97e1ebb7436b611cd62ff6edcc61daa7 (diff)
downloadservo-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.rs11
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