Bug 1383001: Minor reformatting. r?heycam
MozReview-Commit-ID: KVCfX3LqccF
--- a/servo/components/style/data.rs
+++ b/servo/components/style/data.rs
@@ -300,19 +300,20 @@ impl ElementData {
/// Returns whether we have any outstanding style invalidation.
pub fn has_invalidations(&self) -> bool {
self.restyle.hint.has_self_invalidations()
}
/// Returns the kind of restyling that we're going to need to do on this
/// element, based of the stored restyle hint.
- pub fn restyle_kind(&self,
- shared_context: &SharedStyleContext)
- -> RestyleKind {
+ pub fn restyle_kind(
+ &self,
+ shared_context: &SharedStyleContext
+ ) -> RestyleKind {
if shared_context.traversal_flags.for_animation_only() {
return self.restyle_kind_for_animation(shared_context);
}
debug_assert!(!self.has_styles() || self.has_invalidations(),
"Should've stopped earlier");
if !self.has_styles() {
return RestyleKind::MatchAndCascade;
@@ -330,46 +331,49 @@ impl ElementData {
}
debug_assert!(hint.has_recascade_self(),
"We definitely need to do something!");
return RestyleKind::CascadeOnly;
}
/// Returns the kind of restyling for animation-only restyle.
- pub fn restyle_kind_for_animation(&self,
- shared_context: &SharedStyleContext)
- -> RestyleKind {
+ fn restyle_kind_for_animation(
+ &self,
+ shared_context: &SharedStyleContext,
+ ) -> RestyleKind {
debug_assert!(shared_context.traversal_flags.for_animation_only());
debug_assert!(self.has_styles(),
"Unstyled element shouldn't be traversed during \
animation-only traversal");
// return either CascadeWithReplacements or CascadeOnly in case of
// animation-only restyle. I.e. animation-only restyle never does
// selector matching.
let hint = self.restyle.hint;
if hint.has_animation_hint() {
return RestyleKind::CascadeWithReplacements(hint & RestyleHint::for_animations());
}
+
return RestyleKind::CascadeOnly;
-
}
/// Return true if important rules are different.
/// We use this to make sure the cascade of off-main thread animations is correct.
/// Note: Ignore custom properties for now because we only support opacity and transform
/// properties for animations running on compositor. Actually, we only care about opacity
/// and transform for now, but it's fine to compare all properties and let the user
/// the check which properties do they want.
/// If it costs too much, get_properties_overriding_animations() should return a set
/// containing only opacity and transform properties.
- pub fn important_rules_are_different(&self,
- rules: &StrongRuleNode,
- guards: &StylesheetGuards) -> bool {
+ pub fn important_rules_are_different(
+ &self,
+ rules: &StrongRuleNode,
+ guards: &StylesheetGuards
+ ) -> bool {
debug_assert!(self.has_styles());
let (important_rules, _custom) =
self.styles.primary().rules().get_properties_overriding_animations(&guards);
let (other_important_rules, _custom) = rules.get_properties_overriding_animations(&guards);
important_rules != other_important_rules
}
/// Drops any restyle state from the element.
--- a/servo/components/style/dom.rs
+++ b/servo/components/style/dom.rs
@@ -475,19 +475,21 @@ pub trait TElement : Eq + PartialEq + De
if self.has_snapshot() && !self.handled_snapshot() {
return false;
}
data.has_styles() && !data.has_invalidations()
}
/// Returns whether the element's styles are up-to-date for |traversal_flags|.
- fn has_current_styles_for_traversal(&self,
- data: &ElementData,
- traversal_flags: TraversalFlags) -> bool {
+ fn has_current_styles_for_traversal(
+ &self,
+ data: &ElementData,
+ traversal_flags: TraversalFlags,
+ ) -> bool {
if traversal_flags.for_animation_only() {
// In animation-only restyle we never touch snapshots and don't
// care about them. But we can't assert '!self.handled_snapshot()'
// here since there are some cases that a second animation-only
// restyle which is a result of normal restyle (e.g. setting
// animation-name in normal restyle and creating a new CSS
// animation in a SequentialTask) is processed after the normal
// traversal in that we had elements that handled snapshot.