chromium/third_party/blink/web_tests/external/wpt/css/css-values/reference/vh_not_refreshing_on_chrome_iframe-ref.html

<!DOCTYPE html>
<html>
<!-- Submitted from TestTWF Paris -->
<head>

    <title>CSS Reference File</title>
	<link rel="author" title="Marc Bourlon" href="mailto:[email protected]">

	<style type="text/css">

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

		#testBoxWithVhOnly { background: #F00; width: 60px; float: left; }
		#testBoxNotGrownHorizontallyByJS { background: #F0F; height: 60px; float: left; }
		#testBoxWithTransition { background: #FF0; width: 40px; height: 40px; float: left; }
		#referenceBoxGrownHorizontallyByJS { background: #0F0; height: 40px; float: left; }

		p { clear: both; margin: 10px 0; }

	</style>

</head>
<body>

<p>
	All boxes should end up the same size. The green box is the reference one.
</p>

<div id="testBoxWithVhOnly"></div>
<div id="testBoxNotGrownHorizontallyByJS"></div>
<div id="testBoxWithTransition"></div>
<div id="referenceBoxGrownHorizontallyByJS"></div>

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

	// In case this file was opened by mistake, redirects to proper test
	if (window.top.location.href  === document.location.href) {

		window.top.location.href = "vh_not_refreshing_on_chrome-ref.html";

	}

	function setDimension(id, dimension, value) {

		var element = document.getElementById(id);

		element.style[dimension] = value + "px";

	}

	function animate() {

		var viewportHeight = document.documentElement.clientHeight;

		var sizeH = 20;

		var referenceDimension = Math.round(sizeH * viewportHeight / 100);

		setDimension('testBoxWithVhOnly', 'height', referenceDimension);
		setDimension('testBoxNotGrownHorizontallyByJS', 'width', referenceDimension);
		setDimension('testBoxWithTransition', 'width', referenceDimension);
		setDimension('testBoxWithTransition', 'height', referenceDimension);
		setDimension('referenceBoxGrownHorizontallyByJS', 'width', referenceDimension);
		setDimension('referenceBoxGrownHorizontallyByJS', 'height', referenceDimension);

		if (referenceDimension < 60) {
			setTimeout(animate, 20);
		} else {
			parent.postMessage('testBoxWithVhOnly', '*');
		}
	}

	setTimeout(animate, 20);

</script>

</body>
</html>