mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-28 18:47:15 +02:00
A font-size with rem units need to resolve against the default font metrics for the root element, otherwise every time we compute style, the reference value for rem units grows. This fixes an issue where text on some web pages would grow every time there was a relayout. This was very noticeable on https://proton.me/ Fixes #339
25 lines
567 B
HTML
25 lines
567 B
HTML
<style>
|
|
:root { font-size: 1.1rem; }
|
|
#whf { width: max-content; }
|
|
</style>
|
|
<body><div id="whf">WHF :^)</div></body>
|
|
<script src="../include.js"></script>
|
|
<script>
|
|
function relayout() {
|
|
let e = document.documentElement;
|
|
e.style.display = 'none';
|
|
e.style.display = '';
|
|
e.offsetWidth;
|
|
}
|
|
test(() => {
|
|
let cs = getComputedStyle(whf);
|
|
println(cs.width);
|
|
relayout();
|
|
println(cs.width);
|
|
relayout();
|
|
println(cs.width);
|
|
relayout();
|
|
println(cs.width);
|
|
});
|
|
</script>
|