mirror of
https://github.com/servo/servo.git
synced 2025-08-07 06:25:32 +01:00
Eliminate RestyleData entirely.
Without this change, the previous commit increases the size of ElementData. MozReview-Commit-ID: 87BZuXINiT9
This commit is contained in:
parent
61cad869d9
commit
50cee3e133
12 changed files with 66 additions and 94 deletions
|
@ -19,7 +19,7 @@ use app_units::Au;
|
|||
use applicable_declarations::ApplicableDeclarationBlock;
|
||||
use atomic_refcell::{AtomicRefCell, AtomicRefMut};
|
||||
use context::{QuirksMode, SharedStyleContext, PostAnimationTasks, UpdateAnimationsTasks};
|
||||
use data::{ElementData, RestyleData};
|
||||
use data::ElementData;
|
||||
use dom::{LayoutIterator, NodeInfo, TElement, TNode, UnsafeNode};
|
||||
use dom::{OpaqueNode, PresentationalHintsSynthesizer};
|
||||
use element_state::{ElementState, DocumentState, NS_DOCUMENT_STATE_WINDOW_INACTIVE};
|
||||
|
@ -498,12 +498,12 @@ impl<'le> GeckoElement<'le> {
|
|||
|
||||
/// Returns true if a traversal starting from this element requires a post-traversal.
|
||||
pub fn needs_post_traversal(&self) -> bool {
|
||||
debug!("needs_post_traversal: dd={}, aodd={}, lfcd={}, lfc={}, restyle={:?}",
|
||||
debug!("needs_post_traversal: dd={}, aodd={}, lfcd={}, lfc={}, data={:?}",
|
||||
self.has_dirty_descendants(),
|
||||
self.has_animation_only_dirty_descendants(),
|
||||
self.descendants_need_frames(),
|
||||
self.needs_frame(),
|
||||
self.borrow_data().unwrap().restyle);
|
||||
self.borrow_data().unwrap());
|
||||
|
||||
let has_flag =
|
||||
self.flags() & (ELEMENT_HAS_DIRTY_DESCENDANTS_FOR_SERVO as u32 |
|
||||
|
@ -688,10 +688,9 @@ impl<'le> GeckoElement<'le> {
|
|||
/// Also this function schedules style flush.
|
||||
unsafe fn maybe_restyle<'a>(&self,
|
||||
data: &'a mut ElementData,
|
||||
animation_only: bool) -> Option<&'a mut RestyleData> {
|
||||
// Don't generate a useless RestyleData if the element hasn't been styled.
|
||||
animation_only: bool) -> bool {
|
||||
if !data.has_styles() {
|
||||
return None;
|
||||
return false;
|
||||
}
|
||||
|
||||
// Propagate the bit up the chain.
|
||||
|
@ -702,7 +701,7 @@ impl<'le> GeckoElement<'le> {
|
|||
}
|
||||
|
||||
// Ensure and return the RestyleData.
|
||||
Some(&mut data.restyle)
|
||||
true
|
||||
}
|
||||
|
||||
/// Set restyle and change hints to the element data.
|
||||
|
@ -722,12 +721,12 @@ impl<'le> GeckoElement<'le> {
|
|||
"Animation restyle hints should not appear with non-animation restyle hints");
|
||||
|
||||
let mut maybe_data = self.mutate_data();
|
||||
let maybe_restyle_data = maybe_data.as_mut().and_then(|d| unsafe {
|
||||
let should_restyle = maybe_data.as_mut().map_or(false, |d| unsafe {
|
||||
self.maybe_restyle(d, restyle_hint.has_animation_hint())
|
||||
});
|
||||
if let Some(restyle_data) = maybe_restyle_data {
|
||||
restyle_data.hint.insert(restyle_hint.into());
|
||||
restyle_data.damage |= damage;
|
||||
if should_restyle {
|
||||
maybe_data.as_mut().unwrap().hint.insert(restyle_hint.into());
|
||||
maybe_data.as_mut().unwrap().damage |= damage;
|
||||
} else {
|
||||
debug!("(Element not styled, discarding hints)");
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue