Closed Bug 1471174 Opened 6 years ago Closed 6 years ago

Don't send invisible animations that we already throttled on the main thread

Categories

(Core :: DOM: Animation, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla63
Tracking Status
firefox63 --- fixed

People

(Reporter: hiro, Assigned: hiro)

References

(Regressed 1 open bug)

Details

Attachments

(3 files)

This avoids opacity animations on visibility:hidden elements keep running on the compositor, thus we can drop 'opacity: 0' style from some test cases in file_restyles.html.  Also this can avoid trying to send transform animations on visibility:hidden elements to the compositor, thus this will reduce the frequency of bug 1471106.  Also, this will fix bug 1456389 for some particular cases.

https://treeherder.mozilla.org/#/jobs?repo=try&revision=827f7f12a19ebabb007c0ce4be26fc05eb5b9aa6
Comment on attachment 8987984 [details]
Bug 1471174 - Constify nsIFrame::IsScrolledOutOfView.

https://reviewboard.mozilla.org/r/253248/#review259872
Attachment #8987984 - Flags: review?(bbirtles) → review+
Comment on attachment 8987985 [details]
Bug 1471174 - Don't try to send invisible animations that we already throttled on the main thread.

https://reviewboard.mozilla.org/r/253250/#review259870

::: dom/animation/EffectCompositor.cpp:111
(Diff revision 1)
> +  // If we know that the animation is not visible, we don't need to send the
> +  // animation to the compositor.
> +  if (!aFrame->IsVisibleOrMayHaveVisibleDescendants() ||
> +      aFrame->IsScrolledOutOfView()) {
> +    return MatchForCompositor::No;
> +  }

I was wondering if, as an optimization, we should make this MatchForCompositor::NoAndBlockThisProperty. Since this check is only related to the frame, it's impossible to return Yes or IfNeeded from this function for any of the other effects targeting this frame.

Then again, that sort of optimization is probably not important so MatchForCompositor::No is fine.
Attachment #8987985 - Flags: review?(bbirtles) → review+
Comment on attachment 8987986 [details]
Bug 1471174 - Drop opacity value that was for preventing the animations run on the compositor and check the animation is NOT running on the compositor.

https://reviewboard.mozilla.org/r/253252/#review259874
Attachment #8987986 - Flags: review?(bbirtles) → review+
(In reply to Brian Birtles (:birtles) from comment #5)
> Comment on attachment 8987985 [details]
> Bug 1471174 - Don't try to send invisible animations that we already
> throttled on the main thread.
> 
> https://reviewboard.mozilla.org/r/253250/#review259870
> 
> ::: dom/animation/EffectCompositor.cpp:111
> (Diff revision 1)
> > +  // If we know that the animation is not visible, we don't need to send the
> > +  // animation to the compositor.
> > +  if (!aFrame->IsVisibleOrMayHaveVisibleDescendants() ||
> > +      aFrame->IsScrolledOutOfView()) {
> > +    return MatchForCompositor::No;
> > +  }
> 
> I was wondering if, as an optimization, we should make this
> MatchForCompositor::NoAndBlockThisProperty. Since this check is only related
> to the frame, it's impossible to return Yes or IfNeeded from this function
> for any of the other effects targeting this frame.

Oh right, NoAndBlockThisProperty makes much more sense.  Thanks, I will use it.
Pushed by hikezoe@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/b6b24ba30090
Constify nsIFrame::IsScrolledOutOfView. r=birtles
https://hg.mozilla.org/integration/autoland/rev/41dabd41e63e
Don't try to send invisible animations that we already throttled on the main thread. r=birtles
https://hg.mozilla.org/integration/autoland/rev/c1bab94cd24f
Drop opacity value that was for preventing the animations run on the compositor and check the animation is NOT running on the compositor. r=birtles
https://hg.mozilla.org/mozilla-central/rev/b6b24ba30090
https://hg.mozilla.org/mozilla-central/rev/41dabd41e63e
https://hg.mozilla.org/mozilla-central/rev/c1bab94cd24f
Status: ASSIGNED → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla63
Blocks: 1449267
Regressions: 1608194
Regressions: 1633276
Regressions: 1818192
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: