<!DOCTYPE html>
<meta content="width=device-width,initial-scale=1.0,minimum-scale=1.0" name="viewport">
<meta name="assert" content="text-size-adjust should not affect max-width specified in em.">
<link rel="help" href="https://drafts.csswg.org/css-size-adjust/#propdef-text-size-adjust">
<script src='/resources/testharness.js'></script>
<script src='/resources/testharnessreport.js'></script>
<script>
function runTest() {
// This should not be needed but is required to work around a bug in
// Chrome's old autosizer due to computed style being updated during layout.
// TODO(pdr): Remove this when b/340389272 launches.
const forceLayout = document.body.offsetHeight;
test(() => {
// 1em = 16px font-size
assert_equals(getComputedStyle(mw_1_with_lh_16)['max-width'], '16px');
}, 'Resolved 1em max-width with specified 16px line-height and text-size-adjust: 150%');
test(() => {
assert_equals(mw_1_with_lh_16.getBoundingClientRect().width, 16);
}, 'Actual 1em max-width with specified 16px line-height and text-size-adjust: 150%');
test(() => {
// 0.75em = 12px font-size
assert_equals(getComputedStyle(mw_075_with_lh_16)['max-width'], '12px');
}, 'Resolved 0.75em max-width with specified 16px line-height and text-size-adjust: 150%');
test(() => {
assert_equals(mw_075_with_lh_16.getBoundingClientRect().width, 12);
}, 'Actual 0.75em max-width with specified 16px line-height and text-size-adjust: 150%');
test(() => {
// 1em = 16px font-size
assert_equals(getComputedStyle(mw_1_with_fs_16)['max-width'], '16px');
}, 'Resolved 1em max-width with specified 16px font-size and text-size-adjust: 150%');
test(() => {
assert_equals(mw_1_with_fs_16.getBoundingClientRect().width, 16);
}, 'Actual 1em max-width with specified 16px font-size and text-size-adjust: 150%');
test(() => {
// 0.75em = 12px font-size
assert_equals(getComputedStyle(mw_075_with_fs_16)['max-width'], '12px');
}, 'Resolved 0.75em max-width with specified 16px font-size and text-size-adjust: 150%');
test(() => {
assert_equals(mw_075_with_fs_16.getBoundingClientRect().width, 12);
}, 'Actual 0.75em max-width with specified 16px font-size and text-size-adjust: 150%');
}
</script>
<body onload="runTest()">
<div id="mw_1_with_lh_16" style="max-width: 1em; line-height: 16px; text-size-adjust: 150%;">test</div>
<div id="mw_075_with_lh_16" style="max-width: 0.75em; line-height: 16px; text-size-adjust: 150%;">test</div>
<div id="mw_1_with_fs_16" style="max-width: 1em; font-size: 16px; text-size-adjust: 150%;">test</div>
<div id="mw_075_with_fs_16" style="max-width: 0.75em; font-size: 16px; text-size-adjust: 150%;">test</div>
</body>