Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Charts on sixcolors.com flicker when zooming in
https://bugs.webkit.org/show_bug.cgi?id=256620 rdar://108930635 Reviewed by Simon Fraser. If 1. An image is in the current viewport, 2. It has the attribute decoding="async", 3. The layer has already painted at least once, 4. And the image frame is being re-decoded Then the decoding="async" attribute should be ignored to avoid flickering. RenderBoxModelObject::decodingModeForImageDraw() is re-factored such that caces which return DecodingMode::Synchronous are checked first. Then flickering case is checked. Then cases which return DecodingMode::Asynchronous are checked last. Two layout tests are changed to ensure the image is displayed on a fresh layer when the image has the decoding="async". * LayoutTests/fast/images/decode-decoding-change-image-src-expected.html: Added. * LayoutTests/fast/images/decode-decoding-change-image-src.html: Added. * Source/WebCore/rendering/RenderBoxModelObject.cpp: (WebCore::RenderBoxModelObject::decodingModeForImageDraw const): Canonical link: https://commits.webkit.org/264433@main
- Loading branch information
Showing
5 changed files
with
65 additions
and
14 deletions.
There are no files selected for viewing
4 changes: 4 additions & 0 deletions
4
LayoutTests/fast/images/decode-decoding-change-image-src-expected.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<body> | ||
<p>This test ensures if an image with decoding="async" is decoded after the first paint, it will not flicker.</p> | ||
<img src="resources/green-400x400.png"> | ||
</body> |
22 changes: 22 additions & 0 deletions
22
LayoutTests/fast/images/decode-decoding-change-image-src.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<body> | ||
<p>This test ensures if an image with decoding="async" is decoded after the first paint, it will not flicker.</p> | ||
<img id="image" decoding="async" src=""> | ||
<script> | ||
if (window.internals && window.testRunner) { | ||
internals.clearMemoryCache(); | ||
testRunner.waitUntilDone(); | ||
} | ||
|
||
function setImageSrc() { | ||
var image = document.getElementById("image"); | ||
image.onload = (() => { | ||
// Force layout and display so the image frame starts decoding. | ||
document.body.offsetHeight; | ||
if (window.testRunner) | ||
testRunner.notifyDone(); | ||
}); | ||
image.src = "resources/green-400x400.png"; | ||
} | ||
requestAnimationFrame(setImageSrc); | ||
</script> | ||
</body> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters