mirror of
https://github.com/servo/servo.git
synced 2025-08-08 06:55:31 +01:00
Move match and cascade temporaries to CurrentElementInfo
Before this change, the `ComputedStyle` struct that is part of permanent style data per element holds 2 `StrongRuleNode`s (unvisited and visited) and 2 `Arc<ComputedValues>` (unvisited and visited). Both rule nodes and the visited values don't actually need to be here. This patch moves these 3 to new temporary storage in `CascadeInputs` on `CurrentElementInfo` during the match and cascade process. Rule nodes are pushed down inside the `ComputedValues` for later access after the cascade. (Visited values were already available there.) The permanent style data per element now has just the `Arc<ComputedValues>` for itself and eager pseudo-elements (plus the `RestyleHint`). MozReview-Commit-ID: 3wq52ERMpdi
This commit is contained in:
parent
c3b2a2f4de
commit
2b5c56e6a8
19 changed files with 738 additions and 746 deletions
|
@ -515,7 +515,7 @@ impl<'le> GeckoElement<'le> {
|
|||
Some(x) => x,
|
||||
None => {
|
||||
debug!("Creating ElementData for {:?}", self);
|
||||
let ptr = Box::into_raw(Box::new(AtomicRefCell::new(ElementData::new(None))));
|
||||
let ptr = Box::into_raw(Box::new(AtomicRefCell::new(ElementData::default())));
|
||||
self.0.mServoData.set(ptr);
|
||||
unsafe { &* ptr }
|
||||
},
|
||||
|
@ -532,7 +532,7 @@ impl<'le> GeckoElement<'le> {
|
|||
Some(mem::replace(old.borrow_mut().deref_mut(), replace_data))
|
||||
}
|
||||
(Some(old), None) => {
|
||||
let old_data = mem::replace(old.borrow_mut().deref_mut(), ElementData::new(None));
|
||||
let old_data = mem::replace(old.borrow_mut().deref_mut(), ElementData::default());
|
||||
self.0.mServoData.set(ptr::null_mut());
|
||||
Some(old_data)
|
||||
}
|
||||
|
@ -985,7 +985,7 @@ impl<'le> TElement for GeckoElement<'le> {
|
|||
// should destroy all CSS animations in display:none subtree.
|
||||
let computed_data = self.borrow_data();
|
||||
let computed_values =
|
||||
computed_data.as_ref().map(|d| d.styles().primary.values());
|
||||
computed_data.as_ref().map(|d| d.styles.primary());
|
||||
let computed_values_opt =
|
||||
computed_values.map(|v| *HasArcFFI::arc_as_borrowed(v));
|
||||
let before_change_values =
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue