blob: 7fc17106fe7c0a6719d6799a7b863894236dfb84 [file] [log] [blame]
<!DOCTYPE html>
<html>
<meta name="fuzzy" content="maxDifference=0-1;totalPixels=14400-14600" />
<style>
.box {
width: 200px;
height: 50px;
display: inline-block;
zoom: 2;
image-rendering: crisp-edges;
}
.image-background {
background-position: 0px -16500px;
}
</style>
<body>
<div class="box image-background"></div>
<script>
(function() {
if (window.internals && window.testRunner) {
internals.clearMemoryCache();
internals.settings.setWebkitImageReadyEventEnabled(true);
internals.settings.setLargeImageAsyncDecodingEnabled(true);
testRunner.waitUntilDone();
}
var image = new Image();
image.onload = function() {
// Force async image decoding for this image.
if (window.internals)
internals.setLargeImageAsyncDecodingEnabledForTesting(image, true);
// Change the background of the element.
var element = document.getElementsByClassName("image-background")[0];
element.style.backgroundImage = 'url(' + image.src + ')';
if (window.internals && window.testRunner) {
// Force layout and display so the image frame starts decoding.
document.body.offsetHeight;
testRunner.display();
// Wait for the image frame to finish decoding before finishing the test.
element.addEventListener("webkitImageFrameReady", function() {
// Ensure internals.destroyDecodedDataForAllImages() will not destroy
// the image's decoded data because it is inside the viewport.
internals.destroyDecodedDataForAllImages();
testRunner.notifyDone();
}, false);
}
}
image.src = "resources/sprite-sheet-red-green-blue.png";
})();
</script>
</body>
</html>