Bug 1479234 - Drop GetAnimationOpacity and GetAnimationTransform ipc calls. r?boris,froydnj draft
authorHiroyuki Ikezoe <hikezoe@mozilla.com>
Tue, 31 Jul 2018 06:13:15 +0900
changeset 824449 53dea49782c9bd94f4d6e3be1b3b9ca2d4741cd2
parent 824448 7a137ca08ffff3833ba08337cfcb32da5e4504fc
child 824450 f054ad308dd54d6920cdbe8c79b91391b7d0c93c
push id117909
push userhikezoe@mozilla.com
push dateMon, 30 Jul 2018 21:13:32 +0000
reviewersboris, froydnj
bugs1479234
milestone63.0a1
Bug 1479234 - Drop GetAnimationOpacity and GetAnimationTransform ipc calls. r?boris,froydnj They are no longer used. MozReview-Commit-ID: 1SaIkj4ryUF
gfx/layers/AnimationHelper.cpp
gfx/layers/AnimationHelper.h
gfx/layers/ipc/LayerTransactionParent.cpp
gfx/layers/ipc/LayerTransactionParent.h
gfx/layers/ipc/PLayerTransaction.ipdl
gfx/layers/ipc/PWebRenderBridge.ipdl
gfx/layers/wr/WebRenderBridgeParent.cpp
gfx/layers/wr/WebRenderBridgeParent.h
ipc/ipdl/sync-messages.ini
--- a/gfx/layers/AnimationHelper.cpp
+++ b/gfx/layers/AnimationHelper.cpp
@@ -40,56 +40,16 @@ CompositorAnimationStorage::ClearById(co
 
 AnimatedValue*
 CompositorAnimationStorage::GetAnimatedValue(const uint64_t& aId) const
 {
   MOZ_ASSERT(CompositorThreadHolder::IsInCompositorThread());
   return mAnimatedValues.Get(aId);
 }
 
-Maybe<float>
-CompositorAnimationStorage::GetAnimationOpacity(const uint64_t& aId) const
-{
-  auto value = GetAnimatedValue(aId);
-  if (!value || value->mType != AnimatedValue::OPACITY) {
-    return Nothing();
-  }
-
-  return Some(value->mOpacity);
-}
-
-Maybe<gfx::Matrix4x4>
-CompositorAnimationStorage::GetAnimationTransform(const uint64_t& aId) const
-{
-  auto value = GetAnimatedValue(aId);
-  if (!value || value->mType != AnimatedValue::TRANSFORM) {
-    return Nothing();
-  }
-
-  gfx::Matrix4x4 transform = value->mTransform.mFrameTransform;
-  const TransformData& data = value->mTransform.mData;
-  float scale = data.appUnitsPerDevPixel();
-  gfx::Point3D transformOrigin = data.transformOrigin();
-
-  // Undo the rebasing applied by
-  // nsDisplayTransform::GetResultingTransformMatrixInternal
-  transform.ChangeBasis(-transformOrigin);
-
-  // Convert to CSS pixels (this undoes the operations performed by
-  // nsStyleTransformMatrix::ProcessTranslatePart which is called from
-  // nsDisplayTransform::GetResultingTransformMatrix)
-  double devPerCss =
-    double(scale) / double(nsDeviceContext::AppUnitsPerCSSPixel());
-  transform._41 *= devPerCss;
-  transform._42 *= devPerCss;
-  transform._43 *= devPerCss;
-
-  return Some(transform);
-}
-
 OMTAValue
 CompositorAnimationStorage::GetOMTAValue(const uint64_t& aId) const
 {
   OMTAValue omtaValue = mozilla::null_t();
   auto animatedValue = GetAnimatedValue(aId);
   if (!animatedValue) {
     return omtaValue;
   }
--- a/gfx/layers/AnimationHelper.h
+++ b/gfx/layers/AnimationHelper.h
@@ -127,30 +127,16 @@ public:
    */
   void SetAnimatedValue(uint64_t aId, const float& aOpacity);
 
   /**
    * Return the animated value if a given id can map to its animated value
    */
   AnimatedValue* GetAnimatedValue(const uint64_t& aId) const;
 
-  /**
-   * Like GetAnimatedValue(), but ensures the value is an opacity and returns
-   * the float value if possible, or Nothing() otherwise.
-   */
-  Maybe<float> GetAnimationOpacity(const uint64_t& aId) const;
-
-  /**
-   * Like GetAnimatedValue(), but ensures the value is a transform and returns
-   * the transform matrix if possible, or Nothing() otherwise. It also does
-   * some post-processing on the transform matrix as well. See the comments
-   * inside the function for details.
-   */
-  Maybe<gfx::Matrix4x4> GetAnimationTransform(const uint64_t& aId) const;
-
   OMTAValue GetOMTAValue(const uint64_t& aId) const;
 
   /**
    * Return the iterator of animated value table
    */
   AnimatedValueTable::Iterator ConstAnimatedValueTableIter() const
   {
     return mAnimatedValues.ConstIter();
--- a/gfx/layers/ipc/LayerTransactionParent.cpp
+++ b/gfx/layers/ipc/LayerTransactionParent.cpp
@@ -676,69 +676,16 @@ LayerTransactionParent::RecvSetTestSampl
 mozilla::ipc::IPCResult
 LayerTransactionParent::RecvLeaveTestMode()
 {
   mCompositorBridge->LeaveTestMode(GetId());
   return IPC_OK();
 }
 
 mozilla::ipc::IPCResult
-LayerTransactionParent::RecvGetAnimationOpacity(const uint64_t& aCompositorAnimationsId,
-                                                float* aOpacity,
-                                                bool* aHasAnimationOpacity)
-{
-  *aHasAnimationOpacity = false;
-  if (mDestroyed || !mLayerManager || mLayerManager->IsDestroyed()) {
-    return IPC_FAIL_NO_REASON(this);
-  }
-
-  mCompositorBridge->ApplyAsyncProperties(
-    this, CompositorBridgeParentBase::TransformsToSkip::APZ);
-
-  if (!mAnimStorage) {
-    return IPC_FAIL_NO_REASON(this);
-  }
-
-  Maybe<float> opacity = mAnimStorage->GetAnimationOpacity(aCompositorAnimationsId);
-  if (opacity) {
-    *aOpacity = *opacity;
-    *aHasAnimationOpacity = true;
-  }
-  return IPC_OK();
-}
-
-mozilla::ipc::IPCResult
-LayerTransactionParent::RecvGetAnimationTransform(const uint64_t& aCompositorAnimationsId,
-                                                  MaybeTransform* aTransform)
-{
-  if (mDestroyed || !mLayerManager || mLayerManager->IsDestroyed()) {
-    return IPC_FAIL_NO_REASON(this);
-  }
-
-  // Make sure we apply the latest animation style or else we can end up with
-  // a race between when we temporarily clear the animation transform (in
-  // CompositorBridgeParent::SetShadowProperties) and when animation recalculates
-  // the value.
-  mCompositorBridge->ApplyAsyncProperties(
-    this, CompositorBridgeParentBase::TransformsToSkip::APZ);
-
-  if (!mAnimStorage) {
-    return IPC_FAIL_NO_REASON(this);
-  }
-
-  Maybe<Matrix4x4> transform = mAnimStorage->GetAnimationTransform(aCompositorAnimationsId);
-  if (transform) {
-    *aTransform = *transform;
-  } else {
-    *aTransform = mozilla::void_t();
-  }
-  return IPC_OK();
-}
-
-mozilla::ipc::IPCResult
 LayerTransactionParent::RecvGetAnimationValue(const uint64_t& aCompositorAnimationsId,
                                               OMTAValue* aValue)
 {
   if (mDestroyed || !mLayerManager || mLayerManager->IsDestroyed()) {
     return IPC_FAIL_NO_REASON(this);
   }
 
   // Make sure we apply the latest animation style or else we can end up with
--- a/gfx/layers/ipc/LayerTransactionParent.h
+++ b/gfx/layers/ipc/LayerTransactionParent.h
@@ -120,21 +120,16 @@ protected:
                                               const TextureInfo& aInfo) override;
   mozilla::ipc::IPCResult RecvReleaseLayer(const LayerHandle& aHandle) override;
   mozilla::ipc::IPCResult RecvReleaseCompositable(const CompositableHandle& aHandle) override;
 
   mozilla::ipc::IPCResult RecvClearCachedResources() override;
   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 RecvGetAnimationValue(const uint64_t& aCompositorAnimationsId,
                                                 OMTAValue* aValue) 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;
--- a/gfx/layers/ipc/PLayerTransaction.ipdl
+++ b/gfx/layers/ipc/PLayerTransaction.ipdl
@@ -74,29 +74,16 @@ parent:
   // animations. sampleTime must not be null.
   sync SetTestSampleTime(TimeStamp sampleTime);
   // Leave test mode and resume normal compositing
   sync LeaveTestMode();
 
   // Returns |OMTAValue| applied to the layer.
   sync GetAnimationValue(uint64_t aCompositorAnimationId) returns (OMTAValue value);
 
-  // Returns the value of the opacity applied to the layer by animation.
-  // |hasAnimationOpacity| is true if the layer has an opacity value
-  // specified by animation. If it's false, |opacity| value is indefinite.
-  sync GetAnimationOpacity(uint64_t aCompositorAnimationsId) returns (float opacity,
-                                                  bool hasAnimationOpacity);
-
-  // 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);
--- a/gfx/layers/ipc/PWebRenderBridge.ipdl
+++ b/gfx/layers/ipc/PWebRenderBridge.ipdl
@@ -65,19 +65,16 @@ parent:
 
   // These correspond exactly to the equivalent APIs in PLayerTransaction -
   // see those for documentation.
   async SetConfirmedTargetAPZC(uint64_t aInputBlockId, ScrollableLayerGuid[] aTargets);
   // More copied from PLayerTransaction, but these are only used for testing.
   sync SetTestSampleTime(TimeStamp sampleTime);
   sync LeaveTestMode();
   sync GetAnimationValue(uint64_t aCompositorAnimationsId) returns (OMTAValue value);
-  sync GetAnimationOpacity(uint64_t aCompositorAnimationsId) returns (float opacity,
-                                                  bool hasAnimationOpacity);
-  sync GetAnimationTransform(uint64_t aCompositorAnimationId) returns (MaybeTransform transform);
   sync SetAsyncScrollOffset(ViewID scrollId, float x, float y);
   sync SetAsyncZoom(ViewID scrollId, float zoom);
   async FlushApzRepaints();
   sync GetAPZTestData() returns (APZTestData data);
 
   async Shutdown();
   sync ShutdownSync();
 child:
--- a/gfx/layers/wr/WebRenderBridgeParent.cpp
+++ b/gfx/layers/wr/WebRenderBridgeParent.cpp
@@ -1375,66 +1375,16 @@ WebRenderBridgeParent::RecvGetAnimationV
     AdvanceAnimations();
   }
 
   *aValue = mAnimStorage->GetOMTAValue(aCompositorAnimationsId);
   return IPC_OK();
 }
 
 mozilla::ipc::IPCResult
-WebRenderBridgeParent::RecvGetAnimationOpacity(const uint64_t& aCompositorAnimationsId,
-                                               float* aOpacity,
-                                               bool* aHasAnimationOpacity)
-{
-  if (mDestroyed) {
-    return IPC_FAIL_NO_REASON(this);
-  }
-
-  MOZ_ASSERT(mAnimStorage);
-  if (RefPtr<WebRenderBridgeParent> root = GetRootWebRenderBridgeParent()) {
-    root->AdvanceAnimations();
-  } else {
-    AdvanceAnimations();
-  }
-
-  Maybe<float> opacity = mAnimStorage->GetAnimationOpacity(aCompositorAnimationsId);
-  if (opacity) {
-    *aOpacity = *opacity;
-    *aHasAnimationOpacity = true;
-  } else {
-    *aHasAnimationOpacity = false;
-  }
-  return IPC_OK();
-}
-
-mozilla::ipc::IPCResult
-WebRenderBridgeParent::RecvGetAnimationTransform(const uint64_t& aCompositorAnimationsId,
-                                                 MaybeTransform* aTransform)
-{
-  if (mDestroyed) {
-    return IPC_FAIL_NO_REASON(this);
-  }
-
-  MOZ_ASSERT(mAnimStorage);
-  if (RefPtr<WebRenderBridgeParent> root = GetRootWebRenderBridgeParent()) {
-    root->AdvanceAnimations();
-  } else {
-    AdvanceAnimations();
-  }
-
-  Maybe<Matrix4x4> transform = mAnimStorage->GetAnimationTransform(aCompositorAnimationsId);
-  if (transform) {
-    *aTransform = *transform;
-  } else {
-    *aTransform = mozilla::void_t();
-  }
-  return IPC_OK();
-}
-
-mozilla::ipc::IPCResult
 WebRenderBridgeParent::RecvSetAsyncScrollOffset(const FrameMetrics::ViewID& aScrollId,
                                                 const float& aX,
                                                 const float& aY)
 {
   if (mDestroyed) {
     return IPC_OK();
   }
   mCompositorBridge->SetTestAsyncScrollOffset(GetLayersId(), aScrollId, CSSPoint(aX, aY));
--- a/gfx/layers/wr/WebRenderBridgeParent.h
+++ b/gfx/layers/wr/WebRenderBridgeParent.h
@@ -115,21 +115,16 @@ public:
 
   mozilla::ipc::IPCResult RecvSetConfirmedTargetAPZC(const uint64_t& aBlockId,
                                                      nsTArray<ScrollableLayerGuid>&& aTargets) override;
 
   mozilla::ipc::IPCResult RecvSetTestSampleTime(const TimeStamp& aTime) override;
   mozilla::ipc::IPCResult RecvLeaveTestMode() override;
   mozilla::ipc::IPCResult RecvGetAnimationValue(const uint64_t& aCompositorAnimationsId,
                                                 OMTAValue* aValue) 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 RecvSetAsyncScrollOffset(const FrameMetrics::ViewID& aScrollId,
                                                    const float& aX,
                                                    const float& aY) override;
   mozilla::ipc::IPCResult RecvSetAsyncZoom(const FrameMetrics::ViewID& aScrollId,
                                            const float& aZoom) override;
   mozilla::ipc::IPCResult RecvFlushApzRepaints() override;
   mozilla::ipc::IPCResult RecvGetAPZTestData(APZTestData* data) override;
 
--- a/ipc/ipdl/sync-messages.ini
+++ b/ipc/ipdl/sync-messages.ini
@@ -990,20 +990,16 @@ platform = win
 [PImageBridge::WillClose]
 description =
 [PImageBridge::NewCompositable]
 description =
 [PLayerTransaction::SetTestSampleTime]
 description =
 [PLayerTransaction::LeaveTestMode]
 description =
-[PLayerTransaction::GetAnimationOpacity]
-description =
-[PLayerTransaction::GetAnimationTransform]
-description =
 [PLayerTransaction::GetAnimationValue]
 description = test only
 [PLayerTransaction::GetTransform]
 description = test only
 [PLayerTransaction::SetAsyncScrollOffset]
 description =
 [PLayerTransaction::SetAsyncZoom]
 description =
@@ -1024,20 +1020,16 @@ description =
 [PWebRenderBridge::GetSnapshot]
 description =
 [PWebRenderBridge::SetTestSampleTime]
 description = test only
 [PWebRenderBridge::LeaveTestMode]
 description = test only
 [PWebRenderBridge::GetAnimationValue]
 description = test only
-[PWebRenderBridge::GetAnimationOpacity]
-description = test only
-[PWebRenderBridge::GetAnimationTransform]
-description = test only
 [PWebRenderBridge::SetAsyncScrollOffset]
 description = test only
 [PWebRenderBridge::SetAsyncZoom]
 description = test only
 [PWebRenderBridge::GetAPZTestData]
 description = test only
 [PWebRenderBridge::ShutdownSync]
 description = bug 1377024