mirror of
https://github.com/servo/servo.git
synced 2025-08-10 16:05:43 +01:00
stylo: Store font metrics provider in thread local style context
This commit is contained in:
parent
2ea8d61fbf
commit
e402c72d0e
19 changed files with 158 additions and 35 deletions
|
@ -12,6 +12,7 @@ use data::ElementData;
|
|||
use dom::{OpaqueNode, TNode, TElement, SendElement};
|
||||
use error_reporting::ParseErrorReporter;
|
||||
use euclid::Size2D;
|
||||
use font_metrics::FontMetricsProvider;
|
||||
#[cfg(feature = "gecko")] use gecko_bindings::structs;
|
||||
use matching::StyleSharingCandidateCache;
|
||||
use parking_lot::RwLock;
|
||||
|
@ -291,6 +292,9 @@ pub struct ThreadLocalStyleContext<E: TElement> {
|
|||
pub statistics: TraversalStatistics,
|
||||
/// Information related to the current element, non-None during processing.
|
||||
pub current_element_info: Option<CurrentElementInfo>,
|
||||
/// The struct used to compute and cache font metrics from style
|
||||
/// for evaluation of the font-relative em/ch units and font-size
|
||||
pub font_metrics_provider: E::FontMetricsProvider,
|
||||
}
|
||||
|
||||
impl<E: TElement> ThreadLocalStyleContext<E> {
|
||||
|
@ -303,6 +307,7 @@ impl<E: TElement> ThreadLocalStyleContext<E> {
|
|||
tasks: Vec::new(),
|
||||
statistics: TraversalStatistics::default(),
|
||||
current_element_info: None,
|
||||
font_metrics_provider: E::FontMetricsProvider::create_from(shared),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue