mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-02 15:46:33 +00:00
LibGfx: Treat PNG files with invalid frame data as transparent
If we have a valid PNG header with geometry info etc, we should still display it as *something*, even if the image data itself is missing or corrupted. This matches the behavior of other browsers, and is something that Cloudflare Turnstile checks for. To achieve this, we split the PNG decoder's initialization into two steps: "everything except reading frame data" and "reading frame data". If the latter step fails, we yield a transparent bitmap with the geometry from the PNG's IHDR chunk.
This commit is contained in:
parent
f44166ebd0
commit
9164c9784d
Notes:
github-actions[bot]
2024-12-19 15:50:30 +00:00
Author: https://github.com/awesomekling
Commit: 9164c9784d
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2961
Reviewed-by: https://github.com/gmta ✅
3 changed files with 73 additions and 29 deletions
|
@ -0,0 +1,16 @@
|
|||
<script src="../include.js"></script>
|
||||
<script>
|
||||
asyncTest(done => {
|
||||
const image = document.createElement("img");
|
||||
image.onload = () => {
|
||||
println(`loaded, width=${image.width}, height=${image.height}`);
|
||||
done();
|
||||
};
|
||||
image.onerror = () => {
|
||||
println("error :^(");
|
||||
done();
|
||||
};
|
||||
|
||||
image.src = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAD4AAABhCAIAAAABe4UxAAAABElEQVQAAAABnSTXkQAAAABJRU5ErkJggg==";
|
||||
});
|
||||
</script>
|
Loading…
Add table
Add a link
Reference in a new issue