blob: 0e6e9054de1ec06f7c0571790c29f667d40bcde9 [file] [log] [blame] [edit]
<!doctype html>
<meta charset="utf-8">
<title>Viewport units rounding and calc()</title>
<link rel="help" href="https://drafts.csswg.org/css-values-4/#viewport-relative-lengths">
<link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1764768">
<link rel="author" href="mailto:emilio@crisal.io" title="Emilio Cobos Álvarez">
<link rel="author" href="https://mozilla.org" title="Mozilla">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<style>
iframe {
width: 150px;
height: 100px;
}
</style>
<iframe scrolling="no" srcdoc="<div id=target></div>"></iframe>
<script>
onload = function() {
let win = document.querySelector("iframe").contentWindow;
let target = win.document.getElementById("target");
test(function() {
target.style.width = 'calc(100vw / 192)';
let viewport = win.getComputedStyle(target).width;
target.style.width = 'calc(150px / 192)';
let nonViewport = win.getComputedStyle(target).width;
assert_equals(viewport, nonViewport, "Rounding for viewport units should be consistent with pixels");
});
};
</script>