mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +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
|
@ -745,7 +745,7 @@ pub trait ElementMatchMethods : TElement {
|
|||
RestyleResult::Continue
|
||||
};
|
||||
|
||||
node.set_style(Some(shared_style));
|
||||
node.set_style(shared_style);
|
||||
|
||||
return StyleSharingResult::StyleWasShared(i, damage, restyle_result)
|
||||
}
|
||||
|
@ -890,9 +890,7 @@ pub trait MatchMethods : TNode {
|
|||
// In Servo, this is also true, since text nodes generate UnscannedText
|
||||
// fragments, which aren't repairable by incremental layout.
|
||||
if self.is_text_node() {
|
||||
let cloned_parent_style = ComputedValues::style_for_child_text_node(parent_style.as_ref().unwrap());
|
||||
|
||||
self.set_style(Some(cloned_parent_style));
|
||||
self.style_text_node(ComputedValues::style_for_child_text_node(parent_style.as_ref().unwrap()));
|
||||
|
||||
return RestyleResult::Continue;
|
||||
}
|
||||
|
@ -931,7 +929,7 @@ pub trait MatchMethods : TNode {
|
|||
context, applicable_declarations,
|
||||
&mut applicable_declarations_cache);
|
||||
|
||||
self.set_style(Some(new_style));
|
||||
self.set_style(new_style);
|
||||
|
||||
self.set_can_be_fragmented(parent.map_or(false, |p| {
|
||||
p.can_be_fragmented() ||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue