mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-21 17:25:36 +00:00
Bug 1430884 - Flatten CanThrottleIfNotVisible function with early returns. r=birtles
MozReview-Commit-ID: 3JQ0sG2oWfN --HG-- extra : rebase_source : d8b9406c6b30f47efbcb5a6ab0d1e2464385f527
This commit is contained in:
parent
110106dfc4
commit
50273c0888
@ -1199,33 +1199,38 @@ KeyframeEffect::CanThrottleIfNotVisible(nsIFrame& aFrame) const
|
||||
// Unless we are newly in-effect, we can throttle the animation if the
|
||||
// animation is paint only and the target frame is out of view or the document
|
||||
// is in background tabs.
|
||||
if (mInEffectOnLastAnimationTimingUpdate && CanIgnoreIfNotVisible()) {
|
||||
nsIPresShell* presShell = GetPresShell();
|
||||
if (presShell && !presShell->IsActive()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
const bool isVisibilityHidden =
|
||||
!aFrame.IsVisibleOrMayHaveVisibleDescendants();
|
||||
if ((isVisibilityHidden && !HasVisibilityChange()) ||
|
||||
aFrame.IsScrolledOutOfView()) {
|
||||
// Unthrottle the animation if there is a change hint that might affect
|
||||
// the overflow region.
|
||||
if (HasPropertiesThatMightAffectOverflow()) {
|
||||
// Don't throttle finite animations since the animation might suddenly
|
||||
// come into view and if it was throttled it will be out-of-sync.
|
||||
if (HasFiniteActiveDuration()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return isVisibilityHidden
|
||||
? CanThrottleOverflowChangesInScrollable(aFrame)
|
||||
: CanThrottleOverflowChanges(aFrame);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
if (!mInEffectOnLastAnimationTimingUpdate || !CanIgnoreIfNotVisible()) {
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
|
||||
nsIPresShell* presShell = GetPresShell();
|
||||
if (presShell && !presShell->IsActive()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
const bool isVisibilityHidden =
|
||||
!aFrame.IsVisibleOrMayHaveVisibleDescendants();
|
||||
if ((!isVisibilityHidden || HasVisibilityChange()) &&
|
||||
!aFrame.IsScrolledOutOfView()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// If there are no overflow change hints, we don't need to worry about
|
||||
// unthrottling the animation periodically to update scrollbar positions for
|
||||
// the overflow region.
|
||||
if (!HasPropertiesThatMightAffectOverflow()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Don't throttle finite animations since the animation might suddenly
|
||||
// come into view and if it was throttled it will be out-of-sync.
|
||||
if (HasFiniteActiveDuration()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return isVisibilityHidden
|
||||
? CanThrottleOverflowChangesInScrollable(aFrame)
|
||||
: CanThrottleOverflowChanges(aFrame);
|
||||
}
|
||||
|
||||
bool
|
||||
|
Loading…
Reference in New Issue
Block a user