LibWeb/CSS: Make font implicitly reset some properties

This is a weird behaviour specific to `font` - it can reset some
properties that it never actually sets. As such, it didn't seem worth
adding this concept to the code generator, but just manually stuffing
the ShorthandStyleValue with them during parsing.
This commit is contained in:
Sam Atkins 2025-02-05 15:48:12 +00:00
commit 531b92d467
Notes: github-actions[bot] 2025-02-12 16:02:36 +00:00
3 changed files with 115 additions and 2 deletions

View file

@ -0,0 +1,49 @@
<!DOCTYPE html>
<style>
#target {
font-feature-settings: "sinf" 1;
font-kerning: none;
font-language-override: "NAH";
font-optical-sizing: none;
font-size-adjust: 42;
font-variant-alternates: historical-forms;
font-variant-caps: small-caps;
font-variant-east-asian: ruby;
font-variant-emoji: unicode;
font-variant-ligatures: contextual;
font-variant-numeric: tabular-nums;
font-variant-position: sub;
font-variation-settings: "wght" 700;
/* This should reset all of these */
font: 20px sans-serif;
}
</style>
<script src="../include.js"></script>
<div id="target"></div>
<script>
test(() => {
let target = document.getElementById("target");
let style = getComputedStyle(target);
let properties = [
"font-feature-settings",
"font-kerning",
"font-language-override",
"font-optical-sizing",
"font-size-adjust",
"font-variant-alternates",
"font-variant-caps",
"font-variant-east-asian",
"font-variant-emoji",
"font-variant-ligatures",
"font-variant-numeric",
"font-variant-position",
"font-variation-settings",
];
for (let property of properties) {
println(`${property}: ${style[property]}`);
}
});
</script>