mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Propagate image resolution errors in layout context (#36692)
This commit modifies layout context to propagate any issues that occur during image resolution. At the moment, when errors occur during image resolution we propagate None upwards. This hides any potential issues that may be actionable, for example, we may want to avoid trying to load an image that failed to load for whatever reason or has an invalid url. This commit instead propagates these errors upwards to consumers where they may become actionable. This is part of an investigation into #36679. Signed-off-by: Astraea Quinn Skoutelli <astraea.quinn.skoutelli@huawei.com> Signed-off-by: Astraea Quinn Skoutelli <astraea.quinn.skoutelli@huawei.com>
This commit is contained in:
parent
4d975e947b
commit
56882a3d5b
3 changed files with 51 additions and 28 deletions
|
@ -220,13 +220,13 @@ impl ReplacedContents {
|
|||
image_url.clone().into(),
|
||||
UsePlaceholder::No,
|
||||
) {
|
||||
Some(ImageOrMetadataAvailable::ImageAvailable { image, .. }) => {
|
||||
Ok(ImageOrMetadataAvailable::ImageAvailable { image, .. }) => {
|
||||
(Some(image.clone()), image.width as f32, image.height as f32)
|
||||
},
|
||||
Some(ImageOrMetadataAvailable::MetadataAvailable(metadata, _id)) => {
|
||||
Ok(ImageOrMetadataAvailable::MetadataAvailable(metadata, _id)) => {
|
||||
(None, metadata.width as f32, metadata.height as f32)
|
||||
},
|
||||
None => return None,
|
||||
Err(_) => return None,
|
||||
};
|
||||
|
||||
return Some(Self {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue