fonts: Remove synchronous web font loading functionality (#35000)

Synchronous web font loading is not specification compliant and was
added in #8341 to work around issues that do not exist any longer. This
change removes the functionality and ensures that WPT tests are run with
the spec compliant loader.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
This commit is contained in:
Martin Robinson 2025-01-15 12:16:43 +01:00 committed by GitHub
parent 5140ce81f0
commit 28c9ceedf6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 4 additions and 49 deletions

View file

@ -9,7 +9,6 @@ use std::sync::atomic::{AtomicBool, Ordering};
use std::sync::Arc;
use app_units::Au;
use crossbeam_channel::unbounded;
use fnv::FnvHasher;
use fonts_traits::WebFontLoadFinishedCallback;
use log::{debug, trace};
@ -374,7 +373,6 @@ pub trait FontContextWebFontMethods {
guard: &SharedRwLockReadGuard,
device: &Device,
finished_callback: WebFontLoadFinishedCallback,
synchronous: bool,
) -> usize;
fn remove_all_web_fonts_from_stylesheet(&self, stylesheet: &DocumentStyleSheet);
fn collect_unused_webrender_resources(&self, all: bool)
@ -388,21 +386,7 @@ impl FontContextWebFontMethods for Arc<FontContext> {
guard: &SharedRwLockReadGuard,
device: &Device,
finished_callback: WebFontLoadFinishedCallback,
synchronous: bool,
) -> usize {
let (finished_callback, synchronous_receiver) = if synchronous {
let (sender, receiver) = unbounded();
let finished_callback = move |_succeeded: bool| {
let _ = sender.send(());
};
(
Arc::new(finished_callback) as WebFontLoadFinishedCallback,
Some(receiver),
)
} else {
(finished_callback, None)
};
let mut number_loading = 0;
for rule in stylesheet.effective_rules(device, guard) {
let CssRule::FontFace(ref lock) = *rule else {
@ -464,11 +448,6 @@ impl FontContextWebFontMethods for Arc<FontContext> {
local_fonts: Arc::new(local_fonts),
stylesheet: stylesheet.clone(),
});
// If the load is synchronous wait for it to be signalled.
if let Some(ref synchronous_receiver) = synchronous_receiver {
synchronous_receiver.recv().unwrap();
}
}
number_loading