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

Side by Side Diff: third_party/WebKit/LayoutTests/fast/media/mq-width-on-zoom.html

Issue 1496683002: Avoid rounding down viewport dimensions in Media Queries (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Moved to double Created 5 years 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 | third_party/WebKit/LayoutTests/fast/media/mq-width-on-zoom-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
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <html> 2 <html>
3 <head> 3 <head>
4 <script src="../../resources/js-test.js"></script> 4 <script src="../../resources/js-test.js"></script>
5 </head> 5 </head>
6 <body> 6 <body>
7 <p> 7 <p>
8 Tests that width MQ feature is correct on zoom. 8 Tests that width MQ feature is correct on zoom.
9 </p> 9 </p>
10 <script> 10 <script>
11 // eventSender.zoomPageOut/In zooms with a fixed factor of 1.2 inste ad 11 // eventSender.zoomPageOut/In zooms with a fixed factor of 1.2 inste ad
12 // of the zoom levels of the actual browser. 12 // of the zoom levels of the actual browser.
13 13
14 function printMatch(match) {
15 return (match > 0) ? "matches " + match + "px." : "doesn't match tested values.";
16 }
17
18 function test() { 14 function test() {
19 shouldBeTrue("window.matchMedia('(width: " + window.innerWidth + "px)').matches"); 15 var minWidth = window.innerWidth - 1;
20 if (window.matchMedia("(width: " + window.innerWidth + "px)").ma tches) 16 var maxWidth = window.innerWidth + 1;
21 return; 17 shouldBeTrue("window.matchMedia('(min-width: " + minWidth + "px) ').matches");
22 18 shouldBeTrue("window.matchMedia('(max-width: " + maxWidth + "px) ').matches");
23 var matches = 0
24 for (var j = 0; j < window.innerWidth + 100; j++) {
25 if (window.matchMedia("(width: " + j + "px)").matches) {
26 matches = j;
27 break;
28 }
29 }
30
31 debug("window.innerWidth is " + window.innerWidth + "px, but wid th MQ feature " + printMatch(j));
32 } 19 }
33 20
34 if (window.eventSender) { 21 if (window.eventSender) {
35 for (var i = 0; i < 5; i++) { 22 for (var i = 0; i < 5; i++) {
36 eventSender.zoomPageOut(); 23 eventSender.zoomPageOut();
37 test(); 24 test();
38 } 25 }
39 26
40 for (var i = 0; i < 10; i++) { 27 for (var i = 0; i < 10; i++) {
41 eventSender.zoomPageIn(); 28 eventSender.zoomPageIn();
42 test(); 29 test();
43 } 30 }
44 } 31 }
45 </script> 32 </script>
46 </body> 33 </body>
47 </html> 34 </html>
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/fast/media/mq-width-on-zoom-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698