mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Make layout use available image data before querying the image cache.
This commit is contained in:
parent
5f463d3c97
commit
49d2ea4f74
8 changed files with 102 additions and 5 deletions
|
@ -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;
|
||||
}
|
||||
|
@ -1351,6 +1354,14 @@ impl LayoutHTMLImageElementHelpers for LayoutDom<HTMLImageElement> {
|
|||
.clone()
|
||||
}
|
||||
|
||||
#[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())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue