OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <script src="../../resources/js-test.js"></script> | 2 <title>This test ensures that when an image changes, but doesn't change size (li
ke in an Animated GIF), we don't force a Layout.</title> |
| 3 <script src="../../resources/testharness.js"></script> |
| 4 <script src="../../resources/testharnessreport.js"></script> |
| 5 <div style="float: left;"> |
| 6 <img style="max-width: 100%" src="../replaced/resources/1x1-blue.png"> |
| 7 </div> |
3 <script> | 8 <script> |
4 description("This test ensures that when an image changes, but doesn't change si
ze (like in an Animated GIF), we don't force a Layout.") | 9 //TODO(siva.gunturi): Use async_test and use asserts on image.onload and window.
onload. |
5 | 10 test(function() { |
6 if (window.testRunner) | |
7 testRunner.waitUntilDone(); | |
8 | |
9 function runTest() { | |
10 document.documentElement.offsetTop; | 11 document.documentElement.offsetTop; |
11 var imageElement = document.getElementById("image"); | 12 var img = document.querySelector("img"); |
12 imageElement.src = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCA
MAAAAoyzS7AAAABGdBTUEAAK/INwWK6QAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZT
wAAAAGUExURf8AAAAAAEGjEgMAAAAMSURBVHjaYmAACDAAAAIAAU9tWeEAAAAASUVORK5CYII=" | 13 img.src = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAMAAAAoyzS
7AAAABGdBTUEAAK/INwWK6QAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAAGUEx
URf8AAAAAAEGjEgMAAAAMSURBVHjaYmAACDAAAAIAAU9tWeEAAAAASUVORK5CYII="; |
13 if (window.internals) | 14 assert_equals(internals.needsLayoutCount(), 0); |
14 shouldBe("window.internals.needsLayoutCount()", "0"); | 15 }); |
15 if (window.testRunner) | |
16 testRunner.notifyDone(); | |
17 }; | |
18 </script> | 16 </script> |
19 <body onload="runTest();"> | |
20 <div style="float: left;"> | |
21 <img id="image" style="max-width: 100%" src="../replaced/resources/1x1-blue.
png"> | |
22 </div> | |
OLD | NEW |