mirror of
https://github.com/servo/servo.git
synced 2025-07-23 07:13:52 +01:00
Make Restyle tracking more granular.
The primary idea of this patch is to ditch the rigid enum of Previous/Current styles, and replace it with a series of indicators for the various types of work that needs to be performed (expanding snapshots, rematching, recascading, and damage processing). This loses us a little bit of sanity checking (since the up-to-date-ness of our style is no longer baked into the type system), but gives us a lot more flexibility that we'll need going forward (especially when we separate matching from cascading). We also eliminate get_styling_mode in favor of a method on the traversal. This patch does a few other things as ridealongs: * Temporarily eliminates the handling for transfering ownership of styles to the frame. We'll need this again at some point, but for now it's causing too much complexity for a half-implemented feature. * Ditches TRestyleDamage, which is no longer necessary post-crate-merge, and is a constant source of compilation failures from either needing to be imported or being unnecessarily imported (which varies between gecko and servo). * Expands Snapshots for the traversal root, which was missing before. * Fixes up the skip_root stuff to avoid visiting the skipped root. * Unifies parallel traversal and avoids spawning for a single work item. * Adds an explicit pre_traverse step do any pre-processing and determine whether we need to traverse at all. MozReview-Commit-ID: IKhLAkAigXE
This commit is contained in:
parent
4cb3404c09
commit
80460cc549
27 changed files with 502 additions and 474 deletions
|
@ -317,7 +317,7 @@ pub trait ThreadSafeLayoutElement: Clone + Copy + Sized + Debug +
|
|||
if self.get_style_data()
|
||||
.unwrap()
|
||||
.borrow()
|
||||
.current_styles().pseudos
|
||||
.styles().pseudos
|
||||
.contains_key(&PseudoElement::Before) {
|
||||
Some(self.with_pseudo(PseudoElementType::Before(None)))
|
||||
} else {
|
||||
|
@ -330,7 +330,7 @@ pub trait ThreadSafeLayoutElement: Clone + Copy + Sized + Debug +
|
|||
if self.get_style_data()
|
||||
.unwrap()
|
||||
.borrow()
|
||||
.current_styles().pseudos
|
||||
.styles().pseudos
|
||||
.contains_key(&PseudoElement::After) {
|
||||
Some(self.with_pseudo(PseudoElementType::After(None)))
|
||||
} else {
|
||||
|
@ -371,7 +371,7 @@ pub trait ThreadSafeLayoutElement: Clone + Copy + Sized + Debug +
|
|||
fn style(&self, context: &SharedStyleContext) -> Arc<ServoComputedValues> {
|
||||
match self.get_pseudo_element_type() {
|
||||
PseudoElementType::Normal => self.get_style_data().unwrap().borrow()
|
||||
.current_styles().primary.values.clone(),
|
||||
.styles().primary.values.clone(),
|
||||
other => {
|
||||
// Precompute non-eagerly-cascaded pseudo-element styles if not
|
||||
// cached before.
|
||||
|
@ -383,14 +383,14 @@ pub trait ThreadSafeLayoutElement: Clone + Copy + Sized + Debug +
|
|||
if !self.get_style_data()
|
||||
.unwrap()
|
||||
.borrow()
|
||||
.current_styles().pseudos.contains_key(&style_pseudo) {
|
||||
.styles().pseudos.contains_key(&style_pseudo) {
|
||||
let mut data = self.get_style_data().unwrap().borrow_mut();
|
||||
let new_style =
|
||||
context.stylist.precomputed_values_for_pseudo(
|
||||
&style_pseudo,
|
||||
Some(&data.current_styles().primary.values),
|
||||
Some(&data.styles().primary.values),
|
||||
false);
|
||||
data.current_styles_mut().pseudos
|
||||
data.styles_mut().pseudos
|
||||
.insert(style_pseudo.clone(), new_style.unwrap());
|
||||
}
|
||||
}
|
||||
|
@ -398,22 +398,22 @@ pub trait ThreadSafeLayoutElement: Clone + Copy + Sized + Debug +
|
|||
if !self.get_style_data()
|
||||
.unwrap()
|
||||
.borrow()
|
||||
.current_styles().pseudos.contains_key(&style_pseudo) {
|
||||
.styles().pseudos.contains_key(&style_pseudo) {
|
||||
let mut data = self.get_style_data().unwrap().borrow_mut();
|
||||
let new_style =
|
||||
context.stylist
|
||||
.lazily_compute_pseudo_element_style(
|
||||
self,
|
||||
&style_pseudo,
|
||||
&data.current_styles().primary.values);
|
||||
data.current_styles_mut().pseudos
|
||||
&data.styles().primary.values);
|
||||
data.styles_mut().pseudos
|
||||
.insert(style_pseudo.clone(), new_style.unwrap());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
self.get_style_data().unwrap().borrow()
|
||||
.current_styles().pseudos.get(&style_pseudo)
|
||||
.styles().pseudos.get(&style_pseudo)
|
||||
.unwrap().values.clone()
|
||||
}
|
||||
}
|
||||
|
@ -422,9 +422,9 @@ pub trait ThreadSafeLayoutElement: Clone + Copy + Sized + Debug +
|
|||
#[inline]
|
||||
fn selected_style(&self) -> Arc<ServoComputedValues> {
|
||||
let data = self.get_style_data().unwrap().borrow();
|
||||
data.current_styles().pseudos
|
||||
data.styles().pseudos
|
||||
.get(&PseudoElement::Selection).map(|s| s)
|
||||
.unwrap_or(&data.current_styles().primary)
|
||||
.unwrap_or(&data.styles().primary)
|
||||
.values.clone()
|
||||
}
|
||||
|
||||
|
@ -440,9 +440,9 @@ pub trait ThreadSafeLayoutElement: Clone + Copy + Sized + Debug +
|
|||
let data = self.get_style_data().unwrap().borrow();
|
||||
match self.get_pseudo_element_type() {
|
||||
PseudoElementType::Normal
|
||||
=> data.current_styles().primary.values.clone(),
|
||||
=> data.styles().primary.values.clone(),
|
||||
other
|
||||
=> data.current_styles().pseudos
|
||||
=> data.styles().pseudos
|
||||
.get(&other.style_pseudo_element()).unwrap().values.clone(),
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue