Auto merge of #19016 - emilio:animation-avoid-flush-not-quite, r=hiro

style: Fix detection of animations to avoid style flushing in getComputedStyle.

This fixes multiple things:

 * EffectCompositor was using the light tree instead of the flat tree.

 * When we insert an element inside the document, we may not style it right away
   (we mark it for lazy frame construction with the NODE_NEEDS_FRAME). Since we
   trigger animations and transitions from the traversal, we can't skip flushing
   if we call getComputedStyle on any of those.

Bug: 1406750
Reviewed-by: hiro
MozReview-Commit-ID: DpAhmLH3uJ2

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/19016)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2017-10-25 10:28:18 -05:00 committed by GitHub
commit 6035b75d39

View file

@ -4395,11 +4395,23 @@ pub extern "C" fn Servo_ProcessInvalidations(
pub extern "C" fn Servo_HasPendingRestyleAncestor(element: RawGeckoElementBorrowed) -> bool { pub extern "C" fn Servo_HasPendingRestyleAncestor(element: RawGeckoElementBorrowed) -> bool {
let mut element = Some(GeckoElement(element)); let mut element = Some(GeckoElement(element));
while let Some(e) = element { while let Some(e) = element {
if e.has_animations() {
return true;
}
// If the element needs a frame, it means that we haven't styled it yet
// after it got inserted in the document, and thus we may need to do
// that for transitions and animations to trigger.
if e.needs_frame() {
return true;
}
if let Some(data) = e.borrow_data() { if let Some(data) = e.borrow_data() {
if !data.hint.is_empty() { if !data.hint.is_empty() {
return true; return true;
} }
} }
element = e.traversal_parent(); element = e.traversal_parent();
} }
false false