fune/testing/web-platform/tests/css/css-values/rex-invalidation.html
Daniil Sakhapov 4aec9dda47 Bug 1806916 [wpt PR 37639] - Add invalidation for rex font unit dependent elements., a=testonly
Automatic update from web-platform-tests
Add invalidation for rex font unit dependent elements.

New CSSToLengthConversionData::Flag::kRootFontRelative
to mark root font dependence (rem & rex units).
Old kRem flag is now merged in newly introduced flag.

Now on root font changes full document recalc will be
triggered if there are elements using rem or rex.

Bug: 1381037

Change-Id: Ia65b11d2ea4a7d8abf8dc2a8b281d41643cdeac1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4110951
Commit-Queue: Daniil Sakhapov <sakhapov@google.com>
Reviewed-by: Rune Lillesveen <futhark@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1086343}

--

wpt-commits: 92fb6036841987bc171279b0cf6d69b8e69bd095
wpt-pr: 37639
2023-01-05 09:08:19 +00:00

37 lines
1,003 B
HTML

<!DOCTYPE html>
<title>CSS Values and Units Test: rex invalidation</title>
<link rel="author" title="Daniil Sakhapov" href="sakhapov@google.com">
<link rel="help" href="https://drafts.csswg.org/css-values/#font-relative-lengths">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<meta name="assert" content="test rex invalidation">
<style>
@import url("/fonts/ahem.css");
html {
font-family: 'Ahem';
font-size: 40px;
}
body {
font-family: monospace;
font-size: 20px;
}
div {
height: 10rex;
width: 10rex;
}
</style>
<html>
<body>
<div id="div"></div>
</body>
</html>
<script>
setup({ single_test: true });
let old_width = div.getBoundingClientRect().width;
document.documentElement.style.fontFamily = "sans-serif";
let new_width = div.getBoundingClientRect().width;
assert_not_equals(old_width, new_width, "expect the x-height of Ahem and sans-serif to be different");
done();
</script>