author | Hiroyuki Ikezoe <hikezoe@mozilla.com> |
Tue, 05 Jun 2018 09:18:22 +0900 | |
changeset 421328 | cf6231e7ef0c03eabcaf06083ecdc1b17adda6ba |
parent 421327 | 88bbaa441a370279eb24f8850947974772d93697 |
child 421329 | a5e8c4b793e6a57995b3c3da91dcae8d362e6743 |
push id | 34091 |
push user | btara@mozilla.com |
push date | Tue, 05 Jun 2018 13:52:34 +0000 |
treeherder | mozilla-central@752465b44c79 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | froydnj, kats |
bugs | 1464568 |
milestone | 62.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/gfx/layers/ipc/LayerTransactionParent.cpp +++ b/gfx/layers/ipc/LayerTransactionParent.cpp @@ -739,16 +739,68 @@ LayerTransactionParent::RecvGetAnimation *aTransform = *transform; } else { *aTransform = mozilla::void_t(); } return IPC_OK(); } mozilla::ipc::IPCResult +LayerTransactionParent::RecvGetTransform(const LayerHandle& aLayerHandle, + MaybeTransform* aTransform) +{ + if (mDestroyed || !mLayerManager || mLayerManager->IsDestroyed()) { + return IPC_FAIL_NO_REASON(this); + } + + Layer* layer = AsLayer(aLayerHandle); + if (!layer) { + return IPC_FAIL_NO_REASON(this); + } + + mCompositorBridge->ApplyAsyncProperties( + this, CompositorBridgeParentBase::TransformsToSkip::NoneOfThem); + + Matrix4x4 transform = layer->AsHostLayer()->GetShadowBaseTransform(); + // Undo the scale transform applied by FrameTransformToTransformInDevice in + // AsyncCompositionManager.cpp. + if (ContainerLayer* c = layer->AsContainerLayer()) { + transform.PostScale(1.0f/c->GetInheritedXScale(), + 1.0f/c->GetInheritedYScale(), + 1.0f); + } + float scale = 1; + Point3D scaledOrigin; + Point3D transformOrigin; + 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 = + Point3D(NS_round(NSAppUnitsToFloatPixels(data.origin().x, scale)), + NS_round(NSAppUnitsToFloatPixels(data.origin().y, scale)), + 0.0f); + transformOrigin = data.transformOrigin(); + break; + } + } + + // If our parent isn't a perspective layer, then the offset into reference + // frame coordinates will have been applied to us. Add an inverse translation + // to cancel it out. + if (!layer->GetParent() || !layer->GetParent()->GetTransformIsPerspective()) { + transform.PostTranslate(-scaledOrigin.x, -scaledOrigin.y, -scaledOrigin.z); + } + + *aTransform = transform; + + return IPC_OK(); +} + +mozilla::ipc::IPCResult LayerTransactionParent::RecvSetAsyncScrollOffset(const FrameMetrics::ViewID& aScrollID, const float& aX, const float& aY) { if (mDestroyed || !mLayerManager || mLayerManager->IsDestroyed()) { return IPC_FAIL_NO_REASON(this); } mCompositorBridge->SetTestAsyncScrollOffset(GetId(), aScrollID, CSSPoint(aX, aY));
--- a/gfx/layers/ipc/LayerTransactionParent.h +++ b/gfx/layers/ipc/LayerTransactionParent.h @@ -120,16 +120,18 @@ protected: mozilla::ipc::IPCResult RecvScheduleComposite() override; mozilla::ipc::IPCResult RecvSetTestSampleTime(const TimeStamp& aTime) override; mozilla::ipc::IPCResult RecvLeaveTestMode() override; mozilla::ipc::IPCResult RecvGetAnimationOpacity(const uint64_t& aCompositorAnimationsId, float* aOpacity, bool* aHasAnimationOpacity) override; mozilla::ipc::IPCResult RecvGetAnimationTransform(const uint64_t& aCompositorAnimationsId, MaybeTransform* aTransform) override; + mozilla::ipc::IPCResult RecvGetTransform(const LayerHandle& aHandle, + MaybeTransform* aTransform) override; mozilla::ipc::IPCResult RecvSetAsyncScrollOffset(const FrameMetrics::ViewID& aId, const float& aX, const float& aY) override; mozilla::ipc::IPCResult RecvSetAsyncZoom(const FrameMetrics::ViewID& aId, const float& aValue) override; mozilla::ipc::IPCResult RecvFlushApzRepaints() override; mozilla::ipc::IPCResult RecvGetAPZTestData(APZTestData* aOutData) override; mozilla::ipc::IPCResult RecvRequestProperty(const nsString& aProperty, float* aValue) override; mozilla::ipc::IPCResult RecvSetConfirmedTargetAPZC(const uint64_t& aBlockId,
--- a/gfx/layers/ipc/PLayerTransaction.ipdl +++ b/gfx/layers/ipc/PLayerTransaction.ipdl @@ -83,16 +83,20 @@ parent: // Returns the value of the transform applied to the layer by animation after // factoring out translation components introduced to account for the offset // of the corresponding frame and transform origin and after converting to CSS // pixels. If the layer is not transformed by animation, the return value will // be void_t. sync GetAnimationTransform(uint64_t aCompositorAnimationId) returns (MaybeTransform transform); + // Returns the value of the transform applied to the layer by animation and + // APZC. + sync GetTransform(LayerHandle layer) returns (MaybeTransform transform); + // The next time the layer tree is composited, add this async scroll offset in // CSS pixels for the given ViewID. // Useful for testing rendering of async scrolling. sync SetAsyncScrollOffset(ViewID id, float x, float y); // The next time the layer tree is composited, include this async zoom in // for the given ViewID. // Useful for testing rendering of async zooming.
--- a/ipc/ipdl/sync-messages.ini +++ b/ipc/ipdl/sync-messages.ini @@ -995,16 +995,18 @@ description = [PLayerTransaction::SetTestSampleTime] description = [PLayerTransaction::LeaveTestMode] description = [PLayerTransaction::GetAnimationOpacity] description = [PLayerTransaction::GetAnimationTransform] description = +[PLayerTransaction::GetTransform] +description = test only [PLayerTransaction::SetAsyncScrollOffset] description = [PLayerTransaction::SetAsyncZoom] description = [PLayerTransaction::GetAPZTestData] description = [PLayerTransaction::RequestProperty] description =