-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Canonical link: https://commits.webkit.org/272448.859@safari-7618-branch
- Loading branch information
Dan Robson
committed
Apr 3, 2024
1 parent
ce10225
commit e5f73b8
Showing
10 changed files
with
155 additions
and
2 deletions.
There are no files selected for viewing
11 changes: 11 additions & 0 deletions
11
LayoutTests/fast/images/async-image-intersect-different-size-for-drawing-expected.txt
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,11 @@ | ||
Ensures a renderer will decode its image synchronously if it intersects with another renderer with a different sizeForDrawing. | ||
|
||
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". | ||
|
||
|
||
PASS decodingOptions is "{ decodingMode : Asynchronous, sizeForDrawing : { 500, 500 } }" | ||
PASS decodingOptions is "{ decodingMode : Synchronous, sizeForDrawing : { 1000, 1000 } }" | ||
PASS successfullyParsed is true | ||
|
||
TEST COMPLETE | ||
|
105 changes: 105 additions & 0 deletions
105
LayoutTests/fast/images/async-image-intersect-different-size-for-drawing.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,105 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<script src="../../resources/js-test.js"></script> | ||
<style> | ||
.container { | ||
width: 500px; | ||
height: 500px; | ||
border: 1px solid black; | ||
overflow: hidden; | ||
position: relative; | ||
} | ||
.intial-box { | ||
width: 100%; | ||
height: 100%; | ||
top: 0; | ||
left: 0; | ||
position: absolute; | ||
will-change: transform; | ||
display: none; | ||
} | ||
.final-box { | ||
left: -50%; | ||
top: -50%; | ||
width: 200%; | ||
height: 200%; | ||
position: absolute; | ||
transform: scale(0.5); | ||
will-change: transform; | ||
display: none; | ||
background-color: red; | ||
} | ||
img { | ||
width: 100%; | ||
height: 100%; | ||
display: block; | ||
} | ||
</style> | ||
<body> | ||
<div class="container"> | ||
<div class="intial-box"></div> | ||
<div class="final-box"></div> | ||
</div> | ||
<script> | ||
description("Ensures a renderer will decode its image synchronously if it intersects with another renderer with a different sizeForDrawing."); | ||
window.jsTestIsAsync = true; | ||
|
||
function loadImageAndDraw(box, image, src) { | ||
return new Promise((resolve) => { | ||
image.onload = (() => { | ||
if (!window.internals) { | ||
box.style.display = "block"; | ||
resolve(); | ||
return; | ||
} | ||
|
||
box.style.display = "block"; | ||
|
||
// Force layout and display so the image gets drawn. | ||
document.body.offsetHeight; | ||
testRunner.display(); | ||
|
||
image.addEventListener("webkitImageFrameReady", function() { | ||
resolve(); | ||
}, false); | ||
}); | ||
|
||
image.src = src; | ||
}); | ||
} | ||
|
||
if (window.internals && window.testRunner) { | ||
internals.clearMemoryCache(); | ||
internals.settings.setWebkitImageReadyEventEnabled(true); | ||
internals.settings.setLargeImageAsyncDecodingEnabled(true); | ||
} | ||
|
||
let intialBox = document.querySelector(".intial-box"); | ||
let finalBox = document.querySelector(".final-box"); | ||
|
||
let image1 = new Image; | ||
intialBox.appendChild(image1); | ||
|
||
loadImageAndDraw(intialBox, image1, "resources/green-400x400.png").then(() => { | ||
requestAnimationFrame(() => { | ||
decodingOptions = internals.imageLastDecodingOptions(image1); | ||
shouldBeEqualToString("decodingOptions", "{ decodingMode : Asynchronous, sizeForDrawing : { 500, 500 } }"); | ||
|
||
finalBox.appendChild(image1.cloneNode(true)); | ||
finalBox.style.display = "block"; | ||
|
||
// Force layout and display so the image gets drawn. | ||
document.body.offsetHeight; | ||
if (window.testRunner) | ||
testRunner.display(); | ||
|
||
requestAnimationFrame(() => { | ||
decodingOptions = internals.imageLastDecodingOptions(image1); | ||
shouldBeEqualToString("decodingOptions", "{ decodingMode : Synchronous, sizeForDrawing : { 1000, 1000 } }"); | ||
finishJSTest(); | ||
}); | ||
}); | ||
}); | ||
</script> | ||
</body> | ||
</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
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
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
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