Bug 1176969 - Disable OMT animation for any frame in a preserve-3d scene rather than only frames whose parent and child are in a preserve-3d scene. r=mattwoodrow

frame->Preserves3D() is whether the frame's parent has transform-style:
preserve-3d, which means that the frame is part of the same 3-D scene as
its parent.  frame->Preserves3DChildren() is whether the frame itself
has transform-style: preserve-3d, which means that the frame is part of
the same 3-D scene as its children.

Neither of these are valid cases for doing off-main-thread (OMT)
animation because all of the layers in a preserve-3d scene are currently
siblings of each other, rather than preserving ancestor/descendant
relationships.  This means that it's not valid to animate transform of
the parent on the compositor because the compositor animation won't
update any of its children that have layers.  Likewise, it's not valid
to animate transform of the child on the compositor because the code
that sends transform information to the compositor doesn't handle the
accumulation of transforms needed to get the "right" transform for the
child (i.e., with the transforms of its ancestors up to the top of the
3-D scene merged in).

This means that we do OMT animation for slightly fewer cases with the
patch than we did without the patch.  This means it's pretty low risk in
terms of correctness, although there's a chance it might regress
performance on one of the (somewhat limited) set of cases where the
optimization was valid.  (Bug 779598 covers doing OMT animation for
preserve-3d cases, and depends on the work ongoing in bug 1097464.)

The animate-preserve3d-parent.html reftest doesn't fail without the
patch, since something seems to invalidate in the test; it was testing
the testcase that showed correct behavior when the mouse was moving, so
this isn't incredibly surprising (although that invalidation from mouse
movement is itself worth debugging).  The animate-preserve3d-child.html
test does fail without the patch, though.

(With an initial transform of none instead of the 30deg transform, both
tests also show an invalidation bug without the patch.)
This commit is contained in:
L. David Baron 2015-06-30 11:29:55 -07:00
Родитель 39e70b65f4
Коммит 38a633181f
5 изменённых файлов: 144 добавлений и 1 удалений

Просмотреть файл

@ -0,0 +1,56 @@
<!DOCTYPE HTML>
<html class="reftest-wait">
<title>Testcase, bug 1176969</title>
<style>
body { padding: 50px }
#grandparent { perspective: 400px }
@keyframes spin {
0% { transform: rotateX(-30deg) rotateY(-30deg) rotateZ(-30deg); }
0.01%, 100% { transform: rotateX(-45deg) rotateY(-45deg) rotateZ(-45deg); }
}
#parent {
background: blue;
height: 200px; width: 200px;
border: 1px solid black;
transform-style: preserve-3d;
animation: spin 100s linear;
}
@keyframes noop {
from, to { transform: translateZ(15px) }
}
#child {
height: 100px; width: 100px; margin: 50px;
background: yellow;
box-shadow: 3px 3px olive;
animation: noop infinite 10s linear;
}
</style>
<div id="grandparent">
<div id="parent">
<div id="child">
</div>
</div>
</div>
<script>
document.getElementById("parent").addEventListener("animationstart", StartListener, false);
function StartListener(event) {
// Animation should be at final state after 10ms; give it longer.
setTimeout(RemoveReftestWait, 100);
}
function RemoveReftestWait() {
document.documentElement.classList.remove("reftest-wait");
}
</script>

Просмотреть файл

@ -0,0 +1,52 @@
<!DOCTYPE HTML>
<html class="reftest-wait">
<title>Testcase, bug 1176969</title>
<style>
body { padding: 50px }
#grandparent { perspective: 400px }
@keyframes spin {
0% { transform: rotateX(-30deg) rotateY(-30deg) rotateZ(-30deg); }
0.01%, 100% { transform: rotateX(-45deg) rotateY(-45deg) rotateZ(-45deg); }
}
#parent {
background: blue;
height: 200px; width: 200px;
border: 1px solid black;
transform-style: preserve-3d;
animation: spin 100s linear;
}
#child {
transform: translateZ(15px);
height: 100px; width: 100px; margin: 50px;
background: yellow;
box-shadow: 3px 3px olive;
}
</style>
<div id="grandparent">
<div id="parent">
<div id="child">
</div>
</div>
</div>
<script>
document.getElementById("parent").addEventListener("animationstart", StartListener, false);
function StartListener(event) {
// Animation should be at final state after 10ms; give it longer.
setTimeout(RemoveReftestWait, 100);
}
function RemoveReftestWait() {
document.documentElement.classList.remove("reftest-wait");
}
</script>

Просмотреть файл

@ -0,0 +1,33 @@
<!DOCTYPE HTML>
<html>
<title>Testcase, bug 1176969</title>
<style>
body { padding: 50px }
#grandparent { perspective: 400px }
#parent {
background: blue;
height: 200px; width: 200px;
border: 1px solid black;
transform-style: preserve-3d;
transform: rotateX(-45deg) rotateY(-45deg) rotateZ(-45deg);
will-change: transform;
}
#child {
transform: translateZ(15px);
height: 100px; width: 100px; margin: 50px;
background: yellow;
box-shadow: 3px 3px olive;
}
</style>
<div id="grandparent">
<div id="parent">
<div id="child">
</div>
</div>
</div>

Просмотреть файл

@ -63,3 +63,5 @@ fuzzy(3,99) fuzzy-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)&&!layersGPUAccele
fuzzy(3,99) == animate-cube-degrees.html animate-cube-degrees-ref.html # subpixel AA
== animate-cube-degrees-zoom.html animate-cube-degrees-zoom-ref.html
!= animate-cube-degrees-ref.html animate-cube-degrees-zoom-ref.html
skip-if(Android) == animate-preserve3d-parent.html animate-preserve3d-ref.html
== animate-preserve3d-child.html animate-preserve3d-ref.html

Просмотреть файл

@ -527,7 +527,7 @@ AnimationCollection::CanAnimatePropertyOnCompositor(
return false;
}
if (aProperty == eCSSProperty_transform) {
if (frame->Preserves3D() &&
if (frame->Preserves3D() ||
frame->Preserves3DChildren()) {
if (shouldLog) {
nsCString message;