mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 03:37:43 +00:00
LibWeb: Use image's intrinsic dimensions when checking their usability
Instead of the rendered dimensions.
This commit is contained in:
parent
d084f8d90a
commit
24cf56896b
1 changed files with 5 additions and 2 deletions
|
@ -604,10 +604,13 @@ DOM::ExceptionOr<CanvasImageSourceUsability> check_usability_of_image(CanvasImag
|
||||||
// HTMLOrSVGImageElement
|
// HTMLOrSVGImageElement
|
||||||
[](HTMLImageElement const& image_element) -> DOM::ExceptionOr<Optional<CanvasImageSourceUsability>> {
|
[](HTMLImageElement const& image_element) -> DOM::ExceptionOr<Optional<CanvasImageSourceUsability>> {
|
||||||
// FIXME: If image's current request's state is broken, then throw an "InvalidStateError" DOMException.
|
// FIXME: If image's current request's state is broken, then throw an "InvalidStateError" DOMException.
|
||||||
// FIXME: If image is not fully decodable, then return bad.
|
|
||||||
|
// If image is not fully decodable, then return bad.
|
||||||
|
if (!image_element.bitmap())
|
||||||
|
return { CanvasImageSourceUsability::Bad };
|
||||||
|
|
||||||
// If image has an intrinsic width or intrinsic height (or both) equal to zero, then return bad.
|
// If image has an intrinsic width or intrinsic height (or both) equal to zero, then return bad.
|
||||||
if (image_element.width() == 0 || image_element.height() == 0)
|
if (image_element.bitmap()->width() == 0 || image_element.bitmap()->height() == 0)
|
||||||
return { CanvasImageSourceUsability::Bad };
|
return { CanvasImageSourceUsability::Bad };
|
||||||
return Optional<CanvasImageSourceUsability> {};
|
return Optional<CanvasImageSourceUsability> {};
|
||||||
},
|
},
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue