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

Unified Diff: LayoutTests/fast/css/zoom-media-queries.html

Issue 15841015: Fix a zooming bug with EM MQs (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: LayoutTests/fast/css/zoom-media-queries.html
diff --git a/LayoutTests/fast/css/zoom-media-queries.html b/LayoutTests/fast/css/zoom-media-queries.html
new file mode 100644
index 0000000000000000000000000000000000000000..23af8b100f7bab75570e74dd1613f9de1f9f6f42
--- /dev/null
+++ b/LayoutTests/fast/css/zoom-media-queries.html
@@ -0,0 +1,71 @@
+<html>
+ <head>
+ <style>
+ #px_based{line-height:16px}
+ #em_based{line-height:16px}
+ @media screen and (max-width:300px){
+ #px_based{background-color: red; line-height:64px}
+ }
+ @media screen and (max-width:18.75em){
+ #em_based{background-color: red; line-height:64px}
+ }
+ </style>
+ </head>
+ <body>
+ <div id="px_based">This is affected by px</div>
+ <div id="em_based">This is affected by em</div>
+ some text
+ <script>
+ var globals = { zoomedIn: [false,false],
kenneth.r.christiansen 2013/05/31 08:21:21 I prefer that you make methods and use onload. Thi
+ zoomedOut: [false,false],
+ counter: 0},
+ interval;
+ var checkZoom = function(elem, name, pos, counter){
+ console.log(name + ":" + getComputedStyle(elem).lineHeight);
abarth-chromium 2013/05/31 08:11:21 Can we use js-test-pre and js-test-post so we can
+ if(getComputedStyle(elem).lineHeight>"63"){
abarth-chromium 2013/05/31 08:11:21 Why is the 63 in quotes? Also your test is pretty
+ console.log(name + " style changed " + counter);
+ globals.zoomedIn[pos] = true;
+ }
+ else if(globals.zoomedIn[pos] && !globals.zoomedOut[pos]){
+ console.log(name + " style changed back " + counter);
+ globals.zoomedOut[pos] = true;
+ }
+ else{
+ console.log(name + " style not changed " + counter);
+ }
+ };
+ if (window.testRunner){
+ testRunner.waitUntilDone();
+ }
+ interval = setInterval(function(){
+ if(globals.counter > 20){
+ clearInterval(interval);
+ if (window.testRunner)
+ testRunner.notifyDone();
+ return;
+ }
+
+ if(eventSender){
+ if(!globals.zoomedIn[0] && !globals.zoomedIn[1]){
kenneth.r.christiansen 2013/05/31 08:21:21 spaces after if please
+ eventSender.zoomPageIn();
+ globals.counter++;
+ }
+ else{
+ globals.counter--;
+ eventSender.zoomPageOut();
+ if(globals.counter == 0){
+ clearInterval(interval);
+ if (window.testRunner)
+ testRunner.notifyDone();
+ return;
+ }
+ }
+ }
+
+ checkZoom(document.getElementById("px_based"), "px", 0, globals.counter);
+ checkZoom(document.getElementById("em_based"), "em", 1, globals.counter);
+ }, 100);
+
+ </script>
+ </body>
+</html>

Powered by Google App Engine
This is Rietveld 408576698