Bug 788549 Part 7: Make RecvGetTransform() return the untranslated transform since that is what getComputedStyle returns r=roc

This commit is contained in:
David Zbarsky 2013-05-30 17:45:17 -07:00
parent 2091ff11cc
commit 59d3f26cc4

View File

@ -26,6 +26,7 @@
#include "mozilla/layers/ColorLayerComposite.h"
#include "mozilla/layers/ContainerLayerComposite.h"
#include "mozilla/layers/CanvasLayerComposite.h"
#include "mozilla/layers/PLayerTransaction.h"
typedef std::vector<mozilla::layers::EditReply> EditReplyVector;
@ -454,7 +455,29 @@ LayerTransactionParent::RecvGetTransform(PLayerParent* aParent,
return false;
}
*aTransform = cast(aParent)->AsLayer()->GetLocalTransform();
// The following code recovers the untranslated transform
// from the shadow transform by undoing the translations in
// AsyncCompositionManager::SampleValue.
Layer* layer = cast(aParent)->AsLayer();
*aTransform = layer->GetLocalTransform();
float scale = 1;
gfxPoint3D scaledOrigin;
gfxPoint3D mozOrigin;
for (uint32_t i=0; i < layer->GetAnimations().Length(); i++) {
if (layer->GetAnimations()[i].data().type() == AnimationData::TTransformData) {
const TransformData& data = layer->GetAnimations()[i].data().get_TransformData();
scale = data.appUnitsPerDevPixel();
scaledOrigin =
gfxPoint3D(NS_round(NSAppUnitsToFloatPixels(data.origin().x, scale)),
NS_round(NSAppUnitsToFloatPixels(data.origin().y, scale)),
0.0f);
mozOrigin = data.mozOrigin();
break;
}
}
aTransform->Translate(-scaledOrigin);
*aTransform = nsLayoutUtils::ChangeMatrixBasis(-scaledOrigin - mozOrigin, *aTransform);
return true;
}