Bug 1382136 - Part 3: address for peudo element. r?hiro
For pseudo element, although we could get computed value correctly during
animation by patch part 1, 2, displaying was not animated.
We should resolve it.
MozReview-Commit-ID: GwPk0MKI58H
--- a/servo/components/style/matching.rs
+++ b/servo/components/style/matching.rs
@@ -504,16 +504,30 @@ pub trait MatchMethods : TElement {
}
// Also, don't do anything if there was no style.
let old_primary_style = match old_styles.primary {
Some(s) => s,
None => return ChildCascadeRequirement::MustCascadeChildren,
};
+ // If pseudo element's 'content' propety was changed, we need to update pseudo style
+ // of parent since we construct a new frame for the psudo element by parent's style.
+ if let Some(pseudo) = self.implemented_pseudo_element() {
+ if pseudo.is_before_or_after() &&
+ new_primary_style.get_counters().clone_content() !=
+ old_primary_style.get_counters().clone_content() {
+ let parent_element =
+ self.inheritance_parent().expect("Faild to get parent");
+ let mut parent_data = unsafe { parent_element.ensure_data() };
+ parent_data.styles.pseudos.set(&pseudo, new_primary_style.clone());
+ parent_data.restyle.damage |= RestyleDamage::reconstruct();
+ }
+ }
+
cascade_requirement = cmp::max(
cascade_requirement,
self.accumulate_damage_for(
context.shared,
&mut data.restyle,
&old_primary_style,
new_primary_style,
None,