Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(140)

Side by Side Diff: LayoutTests/fast/dom/HTMLImageElement/image-srcset-react-to-media-changes-when-image-not-changed.html

Issue 369423002: Have srcset respond to viewport changes (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: review comments Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <script src="../../../resources/js-test.js"></script>
3 <script>
4 var jsTestIsAsync = true;
5 var img;
6
7 onload = function() {
8 var iframe = document.getElementById('frame');
9 var iframeDoc = iframe.contentWindow.document;
10
11 iframeDoc.body.innerHTML = '<img id="srcset" srcset="resources/blue_rect.jpg 75w, resources/image-set-4x.png 120w">';
12
13 img = iframeDoc.getElementById('srcset');
14
15 var first = true;
16 img.onload = function() {
17 if (first) {
18 first = false;
19 shouldNotBe('img.currentSrc.indexOf("blue_rect")', '-1');
20 shouldBe('img.width', '70');
21 iframe.style.width = '75px';
22 // Make sure that once 2 RAFs have passed, the image is set to the r ight dimensions.
23 window.requestAnimationFrame(function() {
24 window.requestAnimationFrame(function() {
25 window.setTimeout(function() {
26 shouldNotBe('img.currentSrc.indexOf("blue_rect")', '-1');
27 shouldBe('img.width', '75');
28 finishJSTest();
29 }, 0);
30 });
31 });
32 }
33 };
34 img.onerror = function() {
35 testFailed('Image should have loaded');
36 };
37 }
38 </script>
39
40 <iframe id="frame" style="width: 70px;"></iframe>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698