<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS Intrinsic Size Test: intrinsic-size with computed values</title>
<link rel="author" title="Vladimir Levin" href="mailto:vmpstr@chromium.org">
<link rel="help" href="https://drafts.csswg.org/css-sizing-4/#intrinsic-size-override">
<meta name="assert" content="contain-intrinsic-size supports the full grammar '[none | <length>]{1,2}'.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/css/support/computed-testcommon.js"></script>
<style>
#scratch { display: none }
</style>
</head>
<body>
<div id=target></div>
<div id=scratch></div>
<script>

function length_ref(length) {
  document.getElementById("scratch").style.width = length;
  return getComputedStyle(document.getElementById("scratch")).getPropertyValue("width");
}

test_computed_value("contain-intrinsic-size", "none");
test_computed_value("contain-intrinsic-size", "1px");
test_computed_value("contain-intrinsic-size", "auto 1px");
test_computed_value("contain-intrinsic-size", "auto 1px auto 1px", "auto 1px");
test_computed_value("contain-intrinsic-size", "1px auto 1px");
test_computed_value("contain-intrinsic-size", "2vw 3px", length_ref("2vw") + " 3px");
test_computed_value("contain-intrinsic-size", "2px 3vh", "2px " + length_ref("3vh"));
test_computed_value("contain-intrinsic-size", "5px 5px", "5px");

test_computed_value("contain-intrinsic-width", "none");
test_computed_value("contain-intrinsic-width", "1px");
test_computed_value("contain-intrinsic-width", "auto 1px");
test_computed_value("contain-intrinsic-width", "2vw", length_ref("2vw"));
test_computed_value("contain-intrinsic-width", "3vh", length_ref("3vh"));

test_computed_value("contain-intrinsic-height", "none");
test_computed_value("contain-intrinsic-height", "1px");
test_computed_value("contain-intrinsic-height", "auto 1px");
test_computed_value("contain-intrinsic-height", "2vw", length_ref("2vw"));
test_computed_value("contain-intrinsic-height", "3vh", length_ref("3vh"));
test_computed_value("contain-intrinsic-height", "auto none");
</script>
</body>
</html>

