static void
ProcessTranslate3D(Matrix4x4& aMatrix,
                   const nsCSSValue::Array* aData,
                   nsStyleContext* aContext,
                   nsPresContext* aPresContext,
                   RuleNodeCacheConditions& aConditions,
                   TransformReferenceBox& aRefBox)
{
  NS_PRECONDITION(aData->Count() == 4, "Invalid array!");

  Point3D temp;

  temp.x = ProcessTranslatePart(aData->Item(1),
                                aContext, aPresContext, aConditions,
                                &aRefBox, &TransformReferenceBox::Width);

  temp.y = ProcessTranslatePart(aData->Item(2),
                                aContext, aPresContext, aConditions,
                                &aRefBox, &TransformReferenceBox::Height);

  temp.z = ProcessTranslatePart(aData->Item(3),
                                aContext, aPresContext, aConditions,
                                nullptr);

  aMatrix.PreTranslate(temp);
}
    /*
    * Rotate around a specific point and orientation vector.
    *
    * The point is specified by [px], [py], and [pz].
    *
    * The orientation vector is specified by [ax], [ay], and [az].
    *
    * The parameter [local] determines whether local or world space is used.
    * If world space is used, it takes into account the  aggregated transform
    * of the scene object's ancestors.
    */
    void SceneObjectTransform::RotateAround(Real px, Real py, Real pz, Real ax, Real ay, Real az, Real angle, Bool local) {
        if (!local) {
            Matrix4x4 worldTransMat;
            worldTransMat.PreTranslate(-px, -py, -pz);
            worldTransMat.PreRotate(ax, ay, az, angle);
            worldTransMat.PreTranslate(px, py, pz);
            Transform worldTrans;
            worldTrans.SetTo(worldTransMat);

            Transform localTrans;
            GetLocalTransformationFromWorldTransformation(worldTrans, localTrans);

            this->TransformBy(localTrans);
        }
        else {
            Transform::RotateAround(px, py, pz, ax, ay, az, angle, true);
        }
    }
static void 
ProcessTranslateZ(Matrix4x4& aMatrix,
                  const nsCSSValue::Array* aData,
                  nsStyleContext* aContext,
                  nsPresContext* aPresContext,
                  RuleNodeCacheConditions& aConditions)
{
  NS_PRECONDITION(aData->Count() == 2, "Invalid array!");

  Point3D temp;

  temp.z = ProcessTranslatePart(aData->Item(1), aContext,
                                aPresContext, aConditions,
                                nullptr);
  aMatrix.PreTranslate(temp);
}
    /*
     * Apply translation transformation to this transform's matrix. The parameter [local]
     * determines if the transformation is relative to world coordinates or the transform's
     * local space, which includes the aggregated transform of the scene object's ancestors.
     */
    void SceneObjectTransform::Translate(Real x, Real y, Real z, Bool local) {
        if (!local) {
            Matrix4x4 transMat;
            transMat.PreTranslate(x, y, z);
            Transform worldTrans;
            worldTrans.SetTo(transMat);

            Transform localTrans;
            GetLocalTransformationFromWorldTransformation(worldTrans, localTrans);

            this->TransformBy(localTrans);
        }
        else {
            Transform::Translate(x, y, z, true);
        }
    }
/* Helper function to process a translate function. */
static void
ProcessTranslate(Matrix4x4& aMatrix,
                 const nsCSSValue::Array* aData,
                 nsStyleContext* aContext,
                 nsPresContext* aPresContext,
                 RuleNodeCacheConditions& aConditions,
                 TransformReferenceBox& aRefBox)
{
  NS_PRECONDITION(aData->Count() == 2 || aData->Count() == 3, "Invalid array!");

  Point3D temp;

  temp.x = ProcessTranslatePart(aData->Item(1),
                                aContext, aPresContext, aConditions,
                                &aRefBox, &TransformReferenceBox::Width);

  /* If we read in a Y component, set it appropriately */
  if (aData->Count() == 3) {
    temp.y = ProcessTranslatePart(aData->Item(2),
                                  aContext, aPresContext, aConditions,
                                  &aRefBox, &TransformReferenceBox::Height);
  }
  aMatrix.PreTranslate(temp);
}