Files
ladybird/Tests/LibWeb/Text/input/css/FontFace-attributes-unaffected-by-disconnection-from-css.html
Callum Law 06313acac0 LibWeb: Store updated attributes directly within FontFace
The spec states that updates to descriptors in a `@font-face` rule
should be reflected in the connected `FontFace`'s attributes.

Previously this was achieved by directly accessing those descriptors
when calling the attribute getters, but this has a couple of issues:
 a) The changes are only reflected if we use the accessors (i.e.
    `FontFace::family()` rather than `FontFace::m_family`) which isn't
     the case everywhere
 b) The changes aren't persisted after the `FontFace` is disconnected
    from it's `CSSFontFaceRule`

To fix these issues we now reparse and store the `FontFace`'s attributes
whenever the `CSSFontFaceRule`'s descriptors change.
2026-01-13 10:40:00 +00:00

21 lines
575 B
HTML

<!DOCTYPE html>
<html>
<style>
@font-face {
font-family: Foo;
src: url("./Foo.woff");
}
</style>
<script src="../include.js"></script>
<script>
promiseTest(async () => {
await document.fonts.ready.then(() => {
const fontFace = Array.from(document.fonts)[0];
document.styleSheets[0].cssRules[0].style.fontFamily = "Bar";
document.styleSheets[0].removeRule(0);
println(fontFace.family);
});
});
</script>
</html>