mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
stylo: Switch Gecko over to ServoStyleContext
This commit is contained in:
parent
74519cc1a7
commit
89930e7565
19 changed files with 4479 additions and 2353 deletions
|
@ -17,7 +17,7 @@ use invalidation::element::invalidation_map::InvalidationMap;
|
|||
use invalidation::media_queries::{EffectiveMediaQueryResults, ToMediaListKey};
|
||||
use media_queries::Device;
|
||||
use properties::{self, CascadeFlags, ComputedValues, ComputedValuesInner};
|
||||
use properties::{AnimationRules, PropertyDeclarationBlock};
|
||||
use properties::{AnimationRules, PropertyDeclarationBlock, PseudoInfo, ParentStyleContextInfo};
|
||||
#[cfg(feature = "servo")]
|
||||
use properties::INHERIT_ALL;
|
||||
use rule_tree::{CascadeLevel, RuleTree, StyleSource};
|
||||
|
@ -601,7 +601,9 @@ impl Stylist {
|
|||
pseudo: &PseudoElement,
|
||||
parent: Option<&ComputedValuesInner>,
|
||||
cascade_flags: CascadeFlags,
|
||||
font_metrics: &FontMetricsProvider)
|
||||
font_metrics: &FontMetricsProvider,
|
||||
pseudo_info: PseudoInfo,
|
||||
parent_style_context: ParentStyleContextInfo)
|
||||
-> Arc<ComputedValues> {
|
||||
debug_assert!(pseudo.is_precomputed());
|
||||
|
||||
|
@ -638,7 +640,8 @@ impl Stylist {
|
|||
None,
|
||||
font_metrics,
|
||||
cascade_flags,
|
||||
self.quirks_mode).to_outer()
|
||||
self.quirks_mode).to_outer(self.device(), parent_style_context,
|
||||
Some(pseudo_info))
|
||||
}
|
||||
|
||||
/// Returns the style for an anonymous box of the given type.
|
||||
|
@ -675,7 +678,7 @@ impl Stylist {
|
|||
cascade_flags.insert(INHERIT_ALL);
|
||||
}
|
||||
self.precomputed_values_for_pseudo(guards, &pseudo, Some(parent_style), cascade_flags,
|
||||
&ServoMetricsProvider)
|
||||
&ServoMetricsProvider, (), ())
|
||||
}
|
||||
|
||||
/// Computes a pseudo-element style lazily during layout.
|
||||
|
@ -692,7 +695,9 @@ impl Stylist {
|
|||
rule_inclusion: RuleInclusion,
|
||||
parent_style: &ComputedValuesInner,
|
||||
is_probe: bool,
|
||||
font_metrics: &FontMetricsProvider)
|
||||
font_metrics: &FontMetricsProvider,
|
||||
pseudo_info: PseudoInfo,
|
||||
parent_style_context: ParentStyleContextInfo)
|
||||
-> Option<Arc<ComputedValues>>
|
||||
where E: TElement,
|
||||
{
|
||||
|
@ -701,7 +706,9 @@ impl Stylist {
|
|||
self.compute_pseudo_element_style_with_inputs(&cascade_inputs,
|
||||
guards,
|
||||
parent_style,
|
||||
font_metrics)
|
||||
font_metrics,
|
||||
pseudo_info,
|
||||
parent_style_context)
|
||||
}
|
||||
|
||||
/// Computes a pseudo-element style lazily using the given CascadeInputs.
|
||||
|
@ -712,7 +719,9 @@ impl Stylist {
|
|||
inputs: &CascadeInputs,
|
||||
guards: &StylesheetGuards,
|
||||
parent_style: &ComputedValuesInner,
|
||||
font_metrics: &FontMetricsProvider)
|
||||
font_metrics: &FontMetricsProvider,
|
||||
pseudo_info: PseudoInfo,
|
||||
parent_style_context: ParentStyleContextInfo)
|
||||
-> Option<Arc<ComputedValues>>
|
||||
{
|
||||
// We may have only visited rules in cases when we are actually
|
||||
|
@ -734,7 +743,7 @@ impl Stylist {
|
|||
// We want to use the visited bits (if any) from our parent style as
|
||||
// our parent.
|
||||
let inherited_style =
|
||||
parent_style.get_visited_style().unwrap_or(parent_style);
|
||||
parent_style.get_visited_style().map(|x| &**x).unwrap_or(parent_style);
|
||||
|
||||
// FIXME(emilio): The lack of layout_parent_style here could be
|
||||
// worrying, but we're probably dropping the display fixup for
|
||||
|
@ -751,7 +760,8 @@ impl Stylist {
|
|||
None,
|
||||
font_metrics,
|
||||
CascadeFlags::empty(),
|
||||
self.quirks_mode).to_outer();
|
||||
self.quirks_mode).to_outer(self.device(), parent_style_context,
|
||||
Some(pseudo_info.clone()));
|
||||
|
||||
Some(computed)
|
||||
} else {
|
||||
|
@ -775,7 +785,9 @@ impl Stylist {
|
|||
None,
|
||||
font_metrics,
|
||||
CascadeFlags::empty(),
|
||||
self.quirks_mode).to_outer())
|
||||
self.quirks_mode).to_outer(self.device(),
|
||||
parent_style_context,
|
||||
Some(pseudo_info)))
|
||||
}
|
||||
|
||||
/// Computes the cascade inputs for a lazily-cascaded pseudo-element.
|
||||
|
@ -1313,7 +1325,8 @@ impl Stylist {
|
|||
pub fn compute_for_declarations(&self,
|
||||
guards: &StylesheetGuards,
|
||||
parent_style: &ComputedValuesInner,
|
||||
declarations: Arc<Locked<PropertyDeclarationBlock>>)
|
||||
declarations: Arc<Locked<PropertyDeclarationBlock>>,
|
||||
parent_style_context: ParentStyleContextInfo)
|
||||
-> Arc<ComputedValues> {
|
||||
use font_metrics::get_metrics_provider_for_product;
|
||||
|
||||
|
@ -1337,7 +1350,7 @@ impl Stylist {
|
|||
None,
|
||||
&metrics,
|
||||
CascadeFlags::empty(),
|
||||
self.quirks_mode).to_outer()
|
||||
self.quirks_mode).to_outer(self.device(), parent_style_context, None)
|
||||
}
|
||||
|
||||
/// Accessor for a shared reference to the device.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue