Source code
Revision control
Copy as Markdown
Other Tools
Test Info:
- This WPT test may be referenced by the following Test IDs:
- /css/css-sizing/contain-intrinsic-size/parsing/contain-intrinsic-size-computed.html - WPT Dashboard Interop Dashboard
<!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">
<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 style="contain-intrinsic-size: 5px 5px">
<div id=target></div>
</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", "2px 3.3vh", "2px " + length_ref("3.3vh"));
test_computed_value("contain-intrinsic-size", "5px 5px", "5px");
test_computed_value("contain-intrinsic-size", "inherit", "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>