mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-26 17:55:07 +02:00
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.
21 lines
575 B
HTML
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>
|