summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/css/css-values/vh_not_refreshing_on_chrome.html
blob: e5606a0cb751554602c2d108840300973e92c734 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<!-- Submitted from TestTWF Paris -->
<!DOCTYPE html>
<html class="reftest-wait">
<head>
	<title>CSS Values and Units Test: vh-based dimension doesn't change when the element's other dimension doesn't change.</title>
	<meta name="timeout" content="long">
	<link rel="author" title="Marc Bourlon" href="mailto:marc@bourlon.com">
	<link rel="help" href="http://www.w3.org/TR/css3-values/#viewport-relative-lengths">
	<link rel="match" href="reference/vh_not_refreshing_on_chrome-ref.html">
	<meta charset="UTF-8">
	<meta name="assert" content="vh-based dimension doesn't change when the element's other dimension doesn't change.">
	<!-- This test exhibits a bug for Chrome 19.0.1084.56 / Mac OS X 10.6.8 -->
	<script src="/common/reftest-wait.js"></script>

	<style type="text/css">

		* { margin: 0; padding: 0; font-family: Arial, Helvetica, sans-serif; font-size: 13px; }

		#frameTest { width: 600px; height: 200px; border: 1px solid #000; }

	</style>

	<script type="text/javascript">
		'use strict';

		// We must not capture the screen until the frameTest, referenceBoxGrownHorizontallyByJS
		// and testBoxWithTransition elements have finished changing height.
		var elementsPending = 3;
		function receiveMessage() {
			if (--elementsPending === 0) {
				takeScreenshot();
			}
		}

		window.addEventListener('message', receiveMessage, false);

		var height = 200;

		function resizeReference() {

			var frameTest = document.getElementById('frameTest');

			// let's resize the iframe vertically only, showing that the vh sizes is not updated.
			if (height < 300) {

				//frameTest.style.width = height++ + "px";
				frameTest.style.height = ++height + "px";

				setTimeout(resizeReference, 10);

			} else {

				// uncomment the next line to see how a width resize triggers a layout recalculation
				//frameTest.style.width = (parseInt(window.getComputedStyle(document.getElementById('frameTest'))['width'], 10) + 1) + "px";

				window.postMessage('frameTest', '*');
			}

		}

		setTimeout(resizeReference, 10);
	</script>

</head>
<body>

<iframe id="frameTest" src="support/vh_not_refreshing_on_chrome_iframe.html" frameborder="0"></iframe>

</body>
</html>