Use SMIL override value that has been processed during animation-only restyles for normal restyle.

In the case where we process an element which has SMIL animations in normal travesal
the SMIL styles must have been computed in animation-only restyles. So we
have only to pick the computed styles instead of recomputing it.
This commit is contained in:
Hiroyuki Ikezoe 2017-05-24 11:11:25 +09:00
parent 96d6b30eff
commit d30c4fe79d
3 changed files with 60 additions and 21 deletions

View file

@ -6,12 +6,12 @@
use context::SharedStyleContext;
use dom::TElement;
use properties::ComputedValues;
use properties::{ComputedValues, PropertyDeclarationBlock};
use properties::longhands::display::computed_value as display;
use restyle_hints::{HintComputationContext, RestyleReplacements, RestyleHint};
use rule_tree::StrongRuleNode;
use selector_parser::{EAGER_PSEUDO_COUNT, PseudoElement, RestyleDamage};
use shared_lock::StylesheetGuards;
use shared_lock::{Locked, StylesheetGuards};
use std::fmt;
use stylearc::Arc;
use traversal::TraversalFlags;
@ -558,4 +558,17 @@ impl ElementData {
pub fn restyle_mut(&mut self) -> &mut RestyleData {
self.get_restyle_mut().expect("Calling restyle_mut without RestyleData")
}
/// Returns SMIL overriden value if exists.
pub fn get_smil_override(&self) -> Option<&Arc<Locked<PropertyDeclarationBlock>>> {
if cfg!(feature = "servo") {
// Servo has no knowledge of a SMIL rule, so just avoid looking for it.
return None;
}
match self.get_styles() {
Some(s) => s.primary.rules.get_smil_animation_rule(),
None => None,
}
}
}