mirror of
https://github.com/servo/servo.git
synced 2025-07-23 07:13:52 +01:00
script: Move the FontContext
to Window
(#34845)
This will allow using layout's `FontContext` in `Window` letting script manage font selection and download. Signed-off-by: Martin Robinson <mrobinson@igalia.com> Co-authored-by: Mukilan Thiyagarajan <mukilan@igalia.com>
This commit is contained in:
parent
fe8a22b72c
commit
7142a96d36
6 changed files with 61 additions and 45 deletions
|
@ -22,7 +22,7 @@ use embedder_traits::resources::{self, Resource};
|
|||
use euclid::default::{Point2D as UntypedPoint2D, Rect as UntypedRect, Size2D as UntypedSize2D};
|
||||
use euclid::{Point2D, Scale, Size2D, Vector2D};
|
||||
use fnv::FnvHashMap;
|
||||
use fonts::{FontContext, FontContextWebFontMethods, SystemFontServiceProxy};
|
||||
use fonts::{FontContext, FontContextWebFontMethods};
|
||||
use fonts_traits::WebFontLoadFinishedCallback;
|
||||
use fxhash::FxHashMap;
|
||||
use ipc_channel::ipc::IpcSender;
|
||||
|
@ -39,7 +39,6 @@ use log::{debug, error};
|
|||
use malloc_size_of::{MallocSizeOf, MallocSizeOfOps};
|
||||
use metrics::{PaintTimeMetrics, ProfilerMetadataFactory};
|
||||
use net_traits::image_cache::{ImageCache, UsePlaceholder};
|
||||
use net_traits::ResourceThreads;
|
||||
use parking_lot::{Mutex, RwLock};
|
||||
use profile_traits::mem::{Report, ReportKind};
|
||||
use profile_traits::time::{
|
||||
|
@ -176,8 +175,7 @@ impl LayoutFactory for LayoutFactoryImpl {
|
|||
config.is_iframe,
|
||||
config.script_chan,
|
||||
config.image_cache,
|
||||
config.resource_threads,
|
||||
config.system_font_service,
|
||||
config.font_context,
|
||||
config.time_profiler_chan,
|
||||
config.compositor_api,
|
||||
config.paint_time_metrics,
|
||||
|
@ -201,10 +199,6 @@ impl Layout for LayoutThread {
|
|||
self.stylist.device()
|
||||
}
|
||||
|
||||
fn waiting_for_web_fonts_to_load(&self) -> bool {
|
||||
self.font_context.web_fonts_still_loading() != 0
|
||||
}
|
||||
|
||||
fn current_epoch(&self) -> Epoch {
|
||||
self.epoch.get()
|
||||
}
|
||||
|
@ -491,8 +485,7 @@ impl LayoutThread {
|
|||
is_iframe: bool,
|
||||
script_chan: IpcSender<ConstellationControlMsg>,
|
||||
image_cache: Arc<dyn ImageCache>,
|
||||
resource_threads: ResourceThreads,
|
||||
system_font_service: Arc<SystemFontServiceProxy>,
|
||||
font_context: Arc<FontContext>,
|
||||
time_profiler_chan: profile_time::ProfilerChan,
|
||||
compositor_api: CrossProcessCompositorApi,
|
||||
paint_time_metrics: PaintTimeMetrics,
|
||||
|
@ -511,11 +504,6 @@ impl LayoutThread {
|
|||
|
||||
// The device pixel ratio is incorrect (it does not have the hidpi value),
|
||||
// but it will be set correctly when the initial reflow takes place.
|
||||
let font_context = Arc::new(FontContext::new(
|
||||
system_font_service,
|
||||
compositor_api.clone(),
|
||||
resource_threads,
|
||||
));
|
||||
let device = Device::new(
|
||||
MediaType::screen(),
|
||||
QuirksMode::NoQuirks,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue