Index: third_party/WebKit/LayoutTests/fast/dom/viewport/read-viewport-size-causes-layout.html |
diff --git a/third_party/WebKit/LayoutTests/fast/dom/viewport/read-viewport-size-causes-layout.html b/third_party/WebKit/LayoutTests/fast/dom/viewport/read-viewport-size-causes-layout.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..3311aa97267511197fe91b56d3b65ee49c8e1b87 |
--- /dev/null |
+++ b/third_party/WebKit/LayoutTests/fast/dom/viewport/read-viewport-size-causes-layout.html |
@@ -0,0 +1,34 @@ |
+<!DOCTYPE html> |
+<script src="../../../resources/testharness.js"></script> |
+<script src="../../../resources/testharnessreport.js"></script> |
+ |
+<style> |
+ html { |
+ height: 100%; |
+ } |
+</style> |
+ |
+<h4>This test checks that requesting the viewport size causes any pending layout to occur.</h4> |
+<script> |
+ async_test(function(t) { |
+ window.onload = t.step_func(function() { |
+ assert_equals(visualViewport.clientWidth, document.documentElement.clientWidth, |
+ "window.visualViewport.width should match the window width."); |
+ assert_equals(visualViewport.clientHeight, document.documentElement.clientHeight, |
+ "window.visualViewport.height should match the window height."); |
+ |
+ // Add overflow so scrollbars appear. |
+ document.body.style.width = "2000px"; |
+ document.body.style.height = "2000px"; |
+ |
+ var viewportWidth = window.visualViewport.clientWidth; |
+ var viewportHeight = window.visualViewport.clientHeight; |
+ |
+ assert_equals(viewportWidth, document.documentElement.clientWidth, |
+ "Reading viewport width should cause a layout and exclude the new scrollbar."); |
+ assert_equals(viewportHeight, document.documentElement.clientHeight, |
+ "Reading viewport height should cause a layout and exclude the new scrollbar."); |
+ t.done(); |
+ }); |
+ }); |
+</script> |