gecko-dev/dom/animation
Hiroyuki Ikezoe 54a0194045 Bug 1237454 - Throttle animations on visibility:hidden element. r=birtles,boris,emilio
This patch does basically throttle animations on visibility:hidden element
and unthrottle it once the animating element became visible or a child of the
animating element became visible.  But still there are some cases that we don't
throttle such animations perfectly.  For example;

  div.style.visibility = 'hidden'; // the 'div' has no children at this moment
  div.animate(..);
  // The animation is throttled

  div.appendChild(visibleChild);
  // The animation isn't throttled

  visibleChild.style.visibility = 'hidden';
  // Now the animation should be throttled again, but actually it's not.

To throttle this case properly, when the |visibleChild|'s visibility changed
to hidden, we would need to do either

 1) Check all siblings of the |visibleChild| have no visible children

or

 2) The parent element stores visible children count somewhere and decrease it
    and check whether the count is zero

To achieve 1) we need to walk up ancestors and their siblings, actually it's
inefficient.

2) is somewhat similar to what we already do for animating images but it's hard
to reuse it for CSS animations since it does not take into account that
descendants' visibilities.

Another example that this patch does not optimize is the the case where
animating element has children whose visibility is inherited and the element
itself initially visible something like this;

  let child = document.createElement('div'); // child visibility is 'inherit'
  div.appendChild(child);

  div.animate(..); // the 'div' is visible
  // The animation isn't throttled since the animating element is visible

  div.style.visiblily = 'hidden';
  // Now the animation should be throttled, but it's not since this patch does
  // not descend down all descendants to check they are invisible or not when the
  // animating element visibility changed to hidden.

This patch adds a test case for this case introduced with todo_is().

Another test case added in this patch fails if we don't use
nsPlaceholderFrame::GetRealFrameFor() in HasNoVisibleDescendants().

MozReview-Commit-ID: BJwzQvP9Yc4

--HG--
extra : rebase_source : e56505706bb2799b59bbfb3bbcce4a9ce86892f4
2018-02-09 10:43:10 +09:00
..
test Bug 1237454 - Throttle animations on visibility:hidden element. r=birtles,boris,emilio 2018-02-09 10:43:10 +09:00
AnimValuesStyleRule.cpp
AnimValuesStyleRule.h
Animation.cpp Bug 1430014 - Part 4: #ifdef out unnecessary code when the old style system is not built. r=xidorn 2018-02-01 15:04:04 +11:00
Animation.h Bug 1430975 - Don't pass a copy of StickyTimeDuration. r=boris 2018-01-17 18:05:03 +09:00
AnimationComparator.h Bug 1417365 - Unified build issues in dom/animation. r=baku 2017-10-26 11:55:28 +01:00
AnimationEffectReadOnly.cpp Bug 1425548 - Update references to Web Animations spec in dom/animation; r=hiro 2017-12-15 14:55:08 -06:00
AnimationEffectReadOnly.h
AnimationEffectTiming.cpp Bug 1412125, part 2 - Fix dom/ mode lines. r=qdot 2017-10-26 15:08:41 -07:00
AnimationEffectTiming.h Bug 1412125, part 2 - Fix dom/ mode lines. r=qdot 2017-10-26 15:08:41 -07:00
AnimationEffectTimingReadOnly.cpp Bug 1412125, part 2 - Fix dom/ mode lines. r=qdot 2017-10-26 15:08:41 -07:00
AnimationEffectTimingReadOnly.h Bug 1412125, part 2 - Fix dom/ mode lines. r=qdot 2017-10-26 15:08:41 -07:00
AnimationEventDispatcher.cpp Bug 1415780 - Let AnimationEventDispatcher observe nsRefreshDriver. r=birtles 2018-01-27 21:17:27 +09:00
AnimationEventDispatcher.h Bug 1433008 - Make AnimationEventInfo, InternalTransitionEvent and InternalAnimationEvent movable. r=masayuki 2018-01-30 09:26:48 +09:00
AnimationPerformanceWarning.cpp
AnimationPerformanceWarning.h
AnimationPropertySegment.h
AnimationTarget.h
AnimationTimeline.cpp
AnimationTimeline.h
AnimationUtils.cpp Bug 1418220 - Drop AnimationUtils::IsCoreAPIEnabled(ForCaller) and use nsContentUtils::AnimationsAPICoreEnabled / nsDocument::IsWebAnimationsEnabled instead; r=hiro 2017-11-20 14:18:43 +09:00
AnimationUtils.h Bug 1435296 Do not apply timer clamping to CSS animations. r=birtles 2018-02-07 16:50:57 -06:00
CSSPseudoElement.cpp Bug 1413216 - Fix some missing includes in dom code. r=baku 2017-10-12 13:50:23 +01:00
CSSPseudoElement.h Bug 1412125, part 2 - Fix dom/ mode lines. r=qdot 2017-10-26 15:08:41 -07:00
ComputedTiming.h Bug 1431295 - Drop 'undef None' macro in dom/animation/. r=boris 2018-01-18 14:12:51 +09:00
ComputedTimingFunction.cpp
ComputedTimingFunction.h Bug 1425548 - Update references to Web Animations spec in dom/animation; r=hiro 2017-12-15 14:55:08 -06:00
DocumentTimeline.cpp Bug 1416966 - Perform a micro task checkpoint in DocumentTimeline::WillRefresh. r=bevis,birtles 2017-12-12 18:44:05 +09:00
DocumentTimeline.h
EffectCompositor.cpp Bug 1430014 - Part 5: Stop building old style system classes when MOZ_OLD_STYLE is not defined. r=xidorn 2018-02-01 15:04:04 +11:00
EffectCompositor.h Bug 1430014 - Part 5: Stop building old style system classes when MOZ_OLD_STYLE is not defined. r=xidorn 2018-02-01 15:04:04 +11:00
EffectSet.cpp Bug 1400460 - Rename nsIAtom as nsAtom. r=hiro. 2017-10-03 09:05:19 +11:00
EffectSet.h Bug 1430014 - Part 5: Stop building old style system classes when MOZ_OLD_STYLE is not defined. r=xidorn 2018-02-01 15:04:04 +11:00
Keyframe.h
KeyframeEffect.cpp Bug 1413104 - Drop telemetry probes for layer size; r=botond 2017-12-14 21:36:09 +00:00
KeyframeEffect.h
KeyframeEffectParams.h Bug 1431295 - Drop 'undef None' macro in dom/animation/. r=boris 2018-01-18 14:12:51 +09:00
KeyframeEffectReadOnly.cpp Bug 1237454 - Throttle animations on visibility:hidden element. r=birtles,boris,emilio 2018-02-09 10:43:10 +09:00
KeyframeEffectReadOnly.h Bug 1430014 - Part 6: #ifdef out a bit more animation-related code. r=hiro 2018-02-01 15:04:04 +11:00
KeyframeUtils.cpp Bug 1430014 - Part 6: #ifdef out a bit more animation-related code. r=hiro 2018-02-01 15:04:04 +11:00
KeyframeUtils.h Bug 1425548 - Update references to Web Animations spec in dom/animation; r=hiro 2017-12-15 14:55:08 -06:00
PendingAnimationTracker.cpp Bug 1403433 - Add another variant of SchedulePaint that does not call InvalidateRenderingObservers for PendingAnimationTracker. r=birtles 2017-09-29 19:42:13 +09:00
PendingAnimationTracker.h Bug 1282691 - Drop the assertion about an animation that we're making play-pending not already being pause-pending; r=boris 2017-10-13 14:37:51 +09:00
PseudoElementHashEntry.h
TimingParams.cpp Bug 1430014 - Part 5: Stop building old style system classes when MOZ_OLD_STYLE is not defined. r=xidorn 2018-02-01 15:04:04 +11:00
TimingParams.h Bug 1431295 - Drop 'undef None' macro in dom/animation/. r=boris 2018-01-18 14:12:51 +09:00
moz.build Bug 1430014 - Part 5: Stop building old style system classes when MOZ_OLD_STYLE is not defined. r=xidorn 2018-02-01 15:04:04 +11:00