Bug 1206418 - Fix origin of animations and scissors for preserves3d. r=roc

This commit is contained in:
Thinker K.F. Li 2015-09-28 03:43:00 -04:00
parent b46bb87da6
commit 53c8508d85
5 changed files with 84 additions and 4 deletions

View File

@ -760,7 +760,8 @@ Layer::CalculateScissorRect(const RenderTargetIntRect& aCurrentScissorRect)
NS_ASSERTION(GetParent(), "This can't be called on the root!");
// Find the layer creating the 3D context.
while (container->Extend3DContext()) {
while (container->Extend3DContext() &&
!container->UseIntermediateSurface()) {
containerChild = container;
container = container->GetParent();
MOZ_ASSERT(container);
@ -1288,7 +1289,8 @@ ContainerLayer::Collect3DContextLeaves(nsTArray<Layer*>& aToSort)
{
for (Layer* l = GetFirstChild(); l; l = l->GetNextSibling()) {
ContainerLayer* container = l->AsContainerLayer();
if (container && container->Extend3DContext()) {
if (container && container->Extend3DContext() &&
!container->UseIntermediateSurface()) {
container->Collect3DContextLeaves(aToSort);
} else {
aToSort.AppendElement(l);
@ -1303,7 +1305,8 @@ ContainerLayer::SortChildrenBy3DZOrder(nsTArray<Layer*>& aArray)
for (Layer* l = GetFirstChild(); l; l = l->GetNextSibling()) {
ContainerLayer* container = l->AsContainerLayer();
if (container && container->Extend3DContext()) {
if (container && container->Extend3DContext() &&
!container->UseIntermediateSurface()) {
container->Collect3DContextLeaves(toSort);
} else {
if (toSort.Length() > 0) {

View File

@ -572,9 +572,17 @@ nsDisplayListBuilder::AddAnimationsAndTransitionsToLayer(Layer* aLayer,
}
nsPoint origin;
if (aItem) {
// This branch is for display items to leverage the cache of
// nsDisplayListBuilder.
origin = aItem->ToReferenceFrame();
} else {
nsIFrame* referenceFrame = nsLayoutUtils::GetReferenceFrame(aFrame);
// This branch is running for restyling.
// Animations are animated at the coordination of the reference
// frame outside, not the given frame itself. The given frame
// is also reference frame too, so the parent's reference frame
// are used.
nsIFrame* referenceFrame =
nsLayoutUtils::GetReferenceFrame(nsLayoutUtils::GetCrossDocParentFrame(aFrame));
origin = aFrame->GetOffsetToCrossDoc(referenceFrame);
}

View File

@ -0,0 +1,30 @@
<html>
<head>
<style type="text/css">
.pad {
display: block;
height: 20px;
}
.out {
display: block;
position: absolute;
transform-origin: 0 0;
width: 100px;
height: 50px;
overflow: hidden;
left: 108px;
}
.rect {
width: 100px;
height: 50px;
background-color: grey;
}
</style>
</head>
<body>
<div class="pad"></div>
<div class="out">
<div class="rect"></div>
</div>
</body>
</html>

View File

@ -0,0 +1,38 @@
<html>
<head>
<style type="text/css">
.pad {
display: block;
height: 20px;
}
.out {
display: block;
position: absolute;
transform-origin: 0 0;
width: 100px;
height: 50px;
overflow: hidden;
}
.rect {
width: 100px;
height: 50px;
background-color: grey;
}
.ani {
animation: rot 200s linear infinite;
animation-timing-function: steps(2, start);
transform-origin: 50px 50px;
}
@keyframes rot {
to { transform: translate(200px, 0px); }
}
</style>
</head>
<body>
<div class="pad"></div>
<div class="out ani">
<div class="rect"></div>
</div>
</body>
</html>

View File

@ -3,3 +3,4 @@
fails == print-no-animations.html print-no-animations-ref.html # reftest harness doesn't actually make pres context non-dynamic for reftest-print tests
fails != print-no-animations.html print-no-animations-notref.html # reftest harness doesn't actually make pres context non-dynamic for reftest-print tests
== animate-opacity.html animate-opacity-ref.html
== animate-preserves3d.html animate-preserves3d-ref.html