fonts: Store web fonts in the per-Layout FontContext (#32303)

This moves mangement of web fonts to the per-Layout `FontContext`,
preventing web fonts from being available in different Documents.

Fixes #12920.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Co-authored-by: Mukilan Thiyagarajan <mukilan@igalia.com>
This commit is contained in:
Martin Robinson 2024-05-20 16:13:03 +02:00 committed by GitHub
parent 8d2d955bbb
commit be5b527ea3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
30 changed files with 1010 additions and 558 deletions

View file

@ -174727,6 +174727,19 @@
{}
]
],
"downloadable-font-scoped-to-document.html": [
"2dbc350069cd9c61925967655f83217b800fc9eb",
[
null,
[
[
"/css/css-fonts/downloadable-font-scoped-to-document-ref.html",
"=="
]
],
{}
]
],
"first-available-font-001.html": [
"5eb88f7bf6713b80e0adb4728681e62c3f2dc2bc",
[
@ -396276,6 +396289,10 @@
"28a92a86dcaf6bc9c45bb75fce4869bc0ae21c37",
[]
],
"downloadable-font-scoped-to-document-ref.html": [
"4d7da060cbf1a161aa1366f0bcb00b94e09502ad",
[]
],
"first-available-font-001-ref.html": [
"0acbd338e0ce9f558d2eaa2e48ad4be0524fb0ae",
[]
@ -403399,6 +403416,18 @@
"6ed4aa506e95a35a065318f597547653bda52eb5",
[]
],
"iframe-missing-font-face-rule.html": [
"da97b781e8072923138e0160320e76d3013c3e53",
[]
],
"iframe-using-ahem-as-web-font.html": [
"b21066df8f57a8b11432a1168a62e7a4fbbe07b1",
[]
],
"iframe-without-web-font.html": [
"85e7fef282889894016088e082b623b92a436784",
[]
],
"js": {
"font-variant-features.js": [
"4b56fee193956710b847ba79c5f9c3a5a7d15a33",

View file

@ -0,0 +1,17 @@
<!DOCTYPE html>
<html>
<head>
<title>CSS fonts: Web fonts loaded in a document are not available in other documents</title>
<link rel="author" title="Martin Robinson" href="mrobinson@igalia.com">
<link rel="author" title="Mukilan Thiyagarajan" href="mukilan@igalia.com">
</head>
<body>
<p>Test passes if Ahem is only used in the first iframe.</p>
<iframe src="support/iframe-using-ahem-as-web-font.html"></iframe>
<iframe src="support/iframe-without-web-font.html"></iframe>
</body>
</html>

View file

@ -0,0 +1,28 @@
<!DOCTYPE html>
<html class="reftest-wait">
<head>
<title>CSS fonts: Web fonts loaded in a document are not available in other documents</title>
<link rel="author" title="Martin Robinson" href="mrobinson@igalia.com">
<link rel="author" title="Mukilan Thiyagarajan" href="mukilan@igalia.com">
<link rel="match" href="downloadable-font-scoped-to-document-ref.html">
<link rel="help" href="https://drafts.csswg.org/css-fonts/#font-face-rule">
</head>
<body>
<p>Test passes if Ahem is only used in the first iframe.</p>
<iframe id="iframe1" src="support/iframe-using-ahem-as-web-font.html"></iframe>
<iframe id="iframe2" src=""></iframe>
<script>
// Delay the loading of the second iframe to make it more likely that the font
// has loaded properly into the first iframe.
iframe1.onload = () => {
iframe2.src ="support/iframe-missing-font-face-rule.html";
document.documentElement.classList.remove('reftest-wait');
};
</script>
</body>
</html>

View file

@ -0,0 +1,2 @@
<!DOCTYPE html>
<div style="font-size: 30px; font-family: CustomFontFamily">Hello!</div>

View file

@ -0,0 +1,8 @@
<!DOCTYPE html>
<style>
@font-face {
font-family: CustomFontFamily;
src: url(/fonts/Ahem.ttf);
}
</style>
<div style="font-size: 30px; font-family: CustomFontFamily">Hello!</div>

View file

@ -0,0 +1,2 @@
<!DOCTYPE html>
<div style="font-size: 30px;">Hello!</div>