mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
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:
parent
5140ce81f0
commit
28c9ceedf6
6 changed files with 4 additions and 49 deletions
|
@ -177,9 +177,6 @@ pub struct DebugOptions {
|
|||
/// Log GC passes and their durations.
|
||||
pub gc_profile: bool,
|
||||
|
||||
/// Load web fonts synchronously to avoid non-deterministic network-driven reflows.
|
||||
pub load_webfonts_synchronously: bool,
|
||||
|
||||
/// Show webrender profiling stats on screen.
|
||||
pub webrender_stats: bool,
|
||||
|
||||
|
@ -209,7 +206,6 @@ impl DebugOptions {
|
|||
"dump-rule-tree" => self.dump_rule_tree = true,
|
||||
"dump-style-tree" => self.dump_style_tree = true,
|
||||
"gc-profile" => self.gc_profile = true,
|
||||
"load-webfonts-synchronously" => self.load_webfonts_synchronously = true,
|
||||
"precache-shaders" => self.precache_shaders = true,
|
||||
"profile-script-events" => self.profile_script_events = true,
|
||||
"relayout-event" => self.relayout_event = true,
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -639,22 +639,12 @@ impl LayoutThread {
|
|||
);
|
||||
};
|
||||
|
||||
// Find all font-face rules and notify the FontContext of them.
|
||||
// GWTODO: Need to handle unloading web fonts.
|
||||
let newly_loading_font_count = self.font_context.add_all_web_fonts_from_stylesheet(
|
||||
self.font_context.add_all_web_fonts_from_stylesheet(
|
||||
stylesheet,
|
||||
guard,
|
||||
self.stylist.device(),
|
||||
Arc::new(web_font_finished_loading_callback) as WebFontLoadFinishedCallback,
|
||||
self.debug.load_webfonts_synchronously,
|
||||
);
|
||||
|
||||
if self.debug.load_webfonts_synchronously && newly_loading_font_count > 0 {
|
||||
// TODO: Handle failure in web font loading
|
||||
let _ = self
|
||||
.script_chan
|
||||
.send(ConstellationControlMsg::WebFontLoaded(self.id, true));
|
||||
}
|
||||
}
|
||||
|
||||
fn try_get_layout_root<'dom>(&self, node: impl LayoutNode<'dom>) -> Option<FlowRef> {
|
||||
|
|
|
@ -618,22 +618,12 @@ impl LayoutThread {
|
|||
));
|
||||
};
|
||||
|
||||
// Find all font-face rules and notify the font cache of them.
|
||||
// GWTODO: Need to handle unloading web fonts.
|
||||
let newly_loading_font_count = self.font_context.add_all_web_fonts_from_stylesheet(
|
||||
self.font_context.add_all_web_fonts_from_stylesheet(
|
||||
stylesheet,
|
||||
guard,
|
||||
self.stylist.device(),
|
||||
Arc::new(web_font_finished_loading_callback) as WebFontLoadFinishedCallback,
|
||||
self.debug.load_webfonts_synchronously,
|
||||
);
|
||||
|
||||
if self.debug.load_webfonts_synchronously && newly_loading_font_count > 0 {
|
||||
// TODO: Handle failure in web font loading
|
||||
let _ = self
|
||||
.script_chan
|
||||
.send(ConstellationControlMsg::WebFontLoaded(self.id, true));
|
||||
}
|
||||
}
|
||||
|
||||
/// The high-level routine that performs layout.
|
||||
|
|
2
tests/wpt/meta/MANIFEST.json
vendored
2
tests/wpt/meta/MANIFEST.json
vendored
|
@ -503873,7 +503873,7 @@
|
|||
[]
|
||||
],
|
||||
"executorservo.py": [
|
||||
"1d96ffa41da33c9b3c2650ee68c27174bf3081a6",
|
||||
"8b6db6091a84e9e83ec8d161fc86b1d0387f41e6",
|
||||
[]
|
||||
],
|
||||
"executorservodriver.py": [
|
||||
|
|
|
@ -231,7 +231,7 @@ class ServoRefTestExecutor(ServoExecutor):
|
|||
extra_args = ["--exit",
|
||||
"--output=%s" % output_path,
|
||||
"--window-size", viewport_size or "800x600"]
|
||||
debug_opts = "disable-text-aa,load-webfonts-synchronously,replace-surrogates"
|
||||
debug_opts = "disable-text-aa,replace-surrogates"
|
||||
|
||||
if dpi:
|
||||
extra_args += ["--device-pixel-ratio", dpi]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue