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

Side by Side Diff: LayoutTests/fast/dom/HTMLImageElement/image-sizes-1x.html

Issue 236713005: Use SizesAttributeParser to get the right srcset resource (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@sizes_parser8
Patch Set: Fixed nits Created 6 years, 8 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
« no previous file with comments | « no previous file | LayoutTests/fast/dom/HTMLImageElement/image-sizes-1x-expected.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 <html>
2 <head>
3 <script src="../../../resources/js-test.js"></script>
4 <script>
5 if (window.testRunner)
6 testRunner.dumpAsText();
7
8 addEventListener("load", function() {
9 shouldBe('document.getElementById("simple").clientWidth', '(window.inner Width)');
10 shouldBe('document.getElementById("simple").currentSrc', '"../../hidpi/r esources/image-set-2x.png"');
11 shouldBe('document.getElementById("small_sizes").clientWidth', '300');
12 shouldBe('document.getElementById("small_sizes").currentSrc', '"../../hi dpi/resources/image-set-1x.png"');
13 shouldBe('document.getElementById("sizes_x_descriptors").clientWidth', ' 400');
14 shouldBe('document.getElementById("sizes_x_descriptors").currentSrc', '" ../../hidpi/resources/image-set-1x.png"');
15 shouldBe('document.getElementById("sizes_src").clientWidth', '400');
16 shouldBe('document.getElementById("sizes_src").currentSrc', '"../../hidp i/resources/image-set-1x.png"');
17 shouldBe('document.getElementById("default_sizes").clientWidth', 'window .innerWidth');
18 shouldBe('document.getElementById("default_sizes").currentSrc', '"../../ hidpi/resources/image-set-2x.png"');
19 shouldBe('document.getElementById("invalid_length").clientWidth', 'windo w.innerWidth');
20 shouldBe('document.getElementById("invalid_length").currentSrc', '"../.. /hidpi/resources/image-set-2x.png"');
21 shouldBe('document.getElementById("src_and_w").clientWidth', '700');
22 shouldBe('document.getElementById("src_and_w").currentSrc', '"resources/ image-set-4x.png"');
23 shouldBe('document.getElementById("x_and_w").clientWidth', '700');
24 shouldBe('document.getElementById("x_and_w").currentSrc', '"resources/im age-set-4x.png"');
25 shouldBe('document.getElementById("x_and_w2").clientWidth', '400');
26 shouldBe('document.getElementById("x_and_w2").currentSrc', '"../../hidpi /resources/image-set-2x.png"');
27 shouldBe('document.getElementById("x_and_w3").clientWidth', '400');
28 shouldBe('document.getElementById("x_and_w3").currentSrc', '"../../hidpi /resources/image-set-2x.png"');
29 shouldBe('document.getElementById("half_size").clientWidth', '(window.in nerWidth/2)');
30 shouldBe('document.getElementById("half_size").currentSrc', '"../../hidp i/resources/image-set-2x.png"');
31 shouldBe('document.getElementById("infitisimal_sizes").clientWidth', '(w indow.innerWidth/100)');
32 shouldBe('document.getElementById("infitisimal_sizes").currentSrc', '".. /../hidpi/resources/image-set-2x.png"');
33 }, false);
34 </script>
35 </head>
36
37 <body id="body">
38 <img id="simple" src="" sizes="(max-width: 300px) 400px, 800px" srcset="../. ./hidpi/resources/image-set-1x.png 400w, ../../hidpi/resources/image-set-2x.png 800w">
39 <img id="small_sizes" src="" sizes="300px" srcset="../../hidpi/resources/ima ge-set-1x.png 400w, ../../hidpi/resources/image-set-2x.png 800w">
40 <!-- 'sizes' has no imapct on 'x' or 'src' resources -->
41 <img id="sizes_x_descriptors" src="" sizes="50vw" srcset="../../hidpi/resour ces/image-set-1x.png 1x, ../../hidpi/resources/image-set-2x.png 2x">
42 <img id="sizes_src" src="../../hidpi/resources/image-set-1x.png" sizes="50vw ">
43 <!-- Missing sizes or an invalid one, give a source size of 100vw -->
44 <img id="default_sizes" src="" srcset="../../hidpi/resources/image-set-1x.pn g 400w, ../../hidpi/resources/image-set-2x.png 800w, resources/image-set-4x.png 1600w">
45 <img id="invalid_length" src="" sizes="(max-width: 300px) 400w, 800w" srcset ="../../hidpi/resources/image-set-1x.png 400w, ../../hidpi/resources/image-set-2 x.png 800w">
46 <img id="src_and_w" src="../../hidpi/resources/image-set-1x.png" sizes="700p x" srcset="resources/image-set-4x.png 1600w">
47 <img id="x_and_w" sizes="700px" srcset="../../hidpi/resources/image-set-1x.p ng 0.5x, resources/image-set-4x.png 1600w">
48 <!-- The 'x' resource should be picked, and 'sizes' have no impact on its in trisic size -->
49 <img id="x_and_w2" sizes="700px" srcset="../../hidpi/resources/image-set-2x. png 2x, resources/image-set-4x.png 16000w">
50 <img id="x_and_w3" sizes="700px" srcset="resources/image-set-4x.png 16000w, ../../hidpi/resources/image-set-2x.png 2x">
51 <!-- The intrinsic size should be identical to the 'sizes' value -->
52 <img id="half_size" sizes="50vw" srcset="../../hidpi/resources/image-set-2x. png 800w, resources/image-set-4x.png 16000w">
53 <img id="infitisimal_sizes" sizes="1vw" srcset="../../hidpi/resources/image- set-2x.png 800w, resources/image-set-4x.png 16000w">
54 </body>
55 </html>
OLDNEW
« no previous file with comments | « no previous file | LayoutTests/fast/dom/HTMLImageElement/image-sizes-1x-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698