mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Simplify TNode a bit.
A couple of changes here: * Remove the option to unset with the dirty bit setters. * Add an explicit API for setting text node style. * Hoist has_changed handling into the restyle damage setter and text node style setter. * Make set_style take a non-Option.
This commit is contained in:
parent
ee713bc7d9
commit
cc96b292c2
8 changed files with 70 additions and 81 deletions
|
@ -6,7 +6,7 @@
|
|||
|
||||
use animation;
|
||||
use context::{LocalStyleContext, SharedStyleContext, StyleContext};
|
||||
use dom::{OpaqueNode, TNode, TRestyleDamage, UnsafeNode};
|
||||
use dom::{OpaqueNode, TNode, UnsafeNode};
|
||||
use matching::{ApplicableDeclarations, ElementMatchMethods, MatchMethods, StyleSharingResult};
|
||||
use selectors::bloom::BloomFilter;
|
||||
use selectors::matching::StyleRelations;
|
||||
|
@ -191,8 +191,8 @@ pub trait DomTraversalContext<N: TNode> {
|
|||
// the child, since we have exclusive access to both of them.
|
||||
if parent.is_dirty() {
|
||||
unsafe {
|
||||
kid.set_dirty(true);
|
||||
parent.set_dirty_descendants(true);
|
||||
kid.set_dirty();
|
||||
parent.set_dirty_descendants();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -298,12 +298,6 @@ pub fn recalc_style_at<'a, N, C>(context: &'a C,
|
|||
let nonincremental_layout = opts::get().nonincremental_layout;
|
||||
let mut restyle_result = RestyleResult::Continue;
|
||||
if nonincremental_layout || node.is_dirty() {
|
||||
// Remove existing CSS styles from nodes whose content has changed (e.g. text changed),
|
||||
// to force non-incremental reflow.
|
||||
if node.has_changed() {
|
||||
node.set_style(None);
|
||||
}
|
||||
|
||||
// Check to see whether we can share a style with someone.
|
||||
let style_sharing_candidate_cache =
|
||||
&mut context.local_context().style_sharing_candidate_cache.borrow_mut();
|
||||
|
@ -348,9 +342,6 @@ pub fn recalc_style_at<'a, N, C>(context: &'a C,
|
|||
},
|
||||
None => {
|
||||
relations = StyleRelations::empty();
|
||||
if node.has_changed() {
|
||||
node.set_restyle_damage(N::ConcreteRestyleDamage::rebuild_and_reflow())
|
||||
}
|
||||
None
|
||||
},
|
||||
};
|
||||
|
@ -385,7 +376,7 @@ pub fn recalc_style_at<'a, N, C>(context: &'a C,
|
|||
context.shared_context()
|
||||
);
|
||||
if had_animations_to_expire {
|
||||
node.set_style(Some(existing_style));
|
||||
node.set_style(existing_style);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue