gecko-dev/layout
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
..
base Bug 1237454 - Throttle animations on visibility:hidden element. r=birtles,boris,emilio 2018-02-09 10:43:10 +09:00
build Bug 830221 - Remove nsIDOMDOMImplementation. r=bz 2018-02-12 21:49:07 +01:00
doc
forms Bug 1437362 - Remove nsIDOMWindowUtils.focus. r=bz 2018-02-11 17:16:58 +08:00
generic Bug 1237454 - Throttle animations on visibility:hidden element. r=birtles,boris,emilio 2018-02-09 10:43:10 +09:00
inspector Bug 1436508 part 13. Remove nsIDOMMutationEvent constants. r=masayuki 2018-02-09 11:17:10 -05:00
ipc Bug 1415225 - Move the EventRegionsOverride field to be on RefLayers only. r=botond 2017-11-09 09:03:52 -05:00
mathml Bug 1436508 part 13. Remove nsIDOMMutationEvent constants. r=masayuki 2018-02-09 11:17:10 -05:00
media
painting Bug 1437625: Promote a few nsCSSRendering.cpp static functions into exposed static methods, since another .cpp file is already using them. r=mattwoodrow 2018-02-12 11:38:53 -08:00
printing Bug 1436508 part 12. Remove nsIDOMKeyEvent. r=masayuki 2018-02-09 11:17:10 -05:00
reftests Bug 1435296 Address test failures caused by bumping timer precision to 2 ms r=baku 2018-02-12 11:39:41 -06:00
style Merge mozilla-central to autoland. a=merge CLOSED TREE 2018-02-13 00:12:21 +02:00
svg Bug 1436508 part 14. Remove nsIDOMMutationEvent. r=masayuki 2018-02-09 11:17:10 -05:00
tables 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
tools Bug 1434423 - Check for installation of correct test application when --app is passed to mach; r=jmaher 2018-02-09 14:34:20 -07:00
xul Bug 1436508 part 13. Remove nsIDOMMutationEvent constants. r=masayuki 2018-02-09 11:17:10 -05:00
moz.build Bug 1417978 - Stop packaging layout debugger on Android. r=nalexander 2018-01-04 15:22:35 -06:00