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

Unified Diff: LayoutTests/css3/device-adapt/viewport-delete-rule.html

Issue 23185008: Reset viewport to implicit when @viewport is removed. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years, 4 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/css3/device-adapt/viewport-delete-rule.html
diff --git a/LayoutTests/css3/device-adapt/viewport-delete-rule.html b/LayoutTests/css3/device-adapt/viewport-delete-rule.html
new file mode 100644
index 0000000000000000000000000000000000000000..0013233fcb568c626a4858beba503f809515123f
--- /dev/null
+++ b/LayoutTests/css3/device-adapt/viewport-delete-rule.html
@@ -0,0 +1,45 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <title>Insert and delete @viewport rule</title>
+ <script src="../../resources/testharness.js"></script>
+ <script src="../../resources/testharnessreport.js"></script>
+ <style>
+ html { width: 100%; height: 100%; }
+ </style>
+ <script>
+ if (window.testRunner) {
+ testRunner.enableFixedLayoutMode(true);
+ internals.settings.setViewportEnabled(true);
+ }
+
+ var t1 = async_test("Check that added @viewport rule is applied.");
+ var t2 = async_test("Check that @viewport rule is not applied after removal.");
kenneth.r.christiansen 2013/08/21 08:28:35 Great to have this tested
+
+ onload = function(){
+
+ var origWidth = document.documentElement.offsetWidth;
+ var origHeight = document.documentElement.offsetHeight;
+
+ document.styleSheets[0].insertRule("@viewport { width: 400px; height: 400px; }", 0);
+
+ t1.step(function(){
+ assert_equals(document.documentElement.offsetWidth, 400, "Width is 400px.");
+ assert_equals(document.documentElement.offsetHeight, 400, "Height is 400px.");
+ });
+ t1.done();
+
+ document.styleSheets[0].deleteRule(0);
+
+ t2.step(function(){
+ assert_equals(document.documentElement.offsetWidth, origWidth, "Width is default width.");
+ assert_equals(document.documentElement.offsetHeight, origHeight, "Height is default height.");
+ });
+ t2.done();
+ };
+ </script>
+</head>
+<body>
+ <div id="log"></div>
+</body>
+</html>

Powered by Google App Engine
This is Rietveld 408576698