Bug 1331047: Implement the new traversal semantics for stylo. r=bholley,hiro

MozReview-Commit-ID: 4BXx9JpGZKX
Signed-off-by: Emilio Cobos Álvarez <emilio@crisal.io>
This commit is contained in:
Emilio Cobos Álvarez 2017-04-22 23:12:01 +02:00
parent 85ad961104
commit be0139ff3c
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C
11 changed files with 548 additions and 363 deletions

View file

@ -532,6 +532,21 @@ impl ElementData {
self.styles = Some(styles);
}
/// Sets the computed element rules, and returns whether the rules changed.
pub fn set_primary_rules(&mut self, rules: StrongRuleNode) -> bool {
if !self.has_styles() {
self.set_styles(ElementStyles::new(ComputedStyle::new_partial(rules)));
return true;
}
if self.styles().primary.rules == rules {
return false;
}
self.styles_mut().primary.rules = rules;
true
}
/// Returns true if the Element has a RestyleData.
pub fn has_restyle(&self) -> bool {
self.restyle.is_some()