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

Unified 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 side-by-side diff with in-line comments
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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/LayoutTests/fast/media/mq-width-on-zoom.html
diff --git a/third_party/WebKit/LayoutTests/fast/media/mq-width-on-zoom.html b/third_party/WebKit/LayoutTests/fast/media/mq-width-on-zoom.html
index 6456ca5a06fafa1c80e9b17f395b165370719064..ad4f5e1d8b3dd70fcedd6e74dd373c5edc06845e 100644
--- a/third_party/WebKit/LayoutTests/fast/media/mq-width-on-zoom.html
+++ b/third_party/WebKit/LayoutTests/fast/media/mq-width-on-zoom.html
@@ -11,24 +11,11 @@
// eventSender.zoomPageOut/In zooms with a fixed factor of 1.2 instead
// of the zoom levels of the actual browser.
- function printMatch(match) {
- return (match > 0) ? "matches " + match + "px." : "doesn't match tested values.";
- }
-
function test() {
- shouldBeTrue("window.matchMedia('(width: " + window.innerWidth + "px)').matches");
- if (window.matchMedia("(width: " + window.innerWidth + "px)").matches)
- return;
-
- var matches = 0
- for (var j = 0; j < window.innerWidth + 100; j++) {
- if (window.matchMedia("(width: " + j + "px)").matches) {
- matches = j;
- break;
- }
- }
-
- debug("window.innerWidth is " + window.innerWidth + "px, but width MQ feature " + printMatch(j));
+ var minWidth = window.innerWidth - 1;
+ var maxWidth = window.innerWidth + 1;
+ shouldBeTrue("window.matchMedia('(min-width: " + minWidth + "px)').matches");
+ shouldBeTrue("window.matchMedia('(max-width: " + maxWidth + "px)').matches");
}
if (window.eventSender) {
« 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