mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-29 15:52:07 +00:00
Bug 788549 Part 7: Make RecvGetTransform() return the untranslated transform since that is what getComputedStyle returns r=roc
This commit is contained in:
parent
2091ff11cc
commit
59d3f26cc4
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user