Trigger restyle if important rules are changed.

If we add/remove important rules, we may need to update a list of all important
rules (in Gecko) which overrides animation properties. Therefore, we need to
set a flag if we update the primary rules which includes important ones.

If we have animations on this element, we update its effect properties, and
also send a task to update cascade results.

Calling get_properties_overriding_animations() might cases some impact
on performance because we need to walk the rule tree, so if possible, we could
just store this set into TNode to avoid finding the properties for both old
and new rules each time. This could be a future work if necessary.
This commit is contained in:
Boris Chiou 2017-05-19 16:00:52 +08:00
parent 60e7a89d57
commit 63dc43648e
5 changed files with 111 additions and 28 deletions

View file

@ -486,7 +486,10 @@ impl<'le> TElement for ServoLayoutElement<'le> {
}
fn has_animations(&self) -> bool {
unreachable!("this should be only called on gecko");
// We use this function not only for Gecko but also for Servo to know if this element has
// animations, so we maybe try to get the important rules of this element. This is used for
// off-main thread animations, but we don't support it on Servo, so return false directly.
false
}
fn has_css_animations(&self) -> bool {