Bug 1852740: add tests for the `fetchpriority` attribute in Link headers. r=necko...
[gecko.git] / dom / vr / XRRigidTransform.h
blobdefeebe13d42ffad643df4fdc5a136a94282490e
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
5 * You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #ifndef mozilla_dom_XRRigidTransform_h_
8 #define mozilla_dom_XRRigidTransform_h_
10 #include "mozilla/DOMEventTargetHelper.h"
11 #include "mozilla/dom/WebXRBinding.h"
13 #include "gfxVR.h"
15 namespace mozilla::dom {
17 class VRFrameData;
19 class XRRigidTransform final : public nsWrapperCache {
20 public:
21 NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(XRRigidTransform)
22 NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS(XRRigidTransform)
24 explicit XRRigidTransform(nsISupports* aParent,
25 const gfx::PointDouble3D& aPosition,
26 const gfx::QuaternionDouble& aOrientation);
27 explicit XRRigidTransform(nsISupports* aParent,
28 const gfx::Matrix4x4Double& aTransform);
29 static already_AddRefed<XRRigidTransform> Constructor(
30 const GlobalObject& aGlobal, const DOMPointInit& aOrigin,
31 const DOMPointInit& aDirection, ErrorResult& aRv);
32 XRRigidTransform& operator=(const XRRigidTransform& aOther);
33 gfx::QuaternionDouble RawOrientation() const;
34 gfx::PointDouble3D RawPosition() const;
35 void Update(const gfx::PointDouble3D& aPosition,
36 const gfx::QuaternionDouble& aOrientation);
37 void Update(const gfx::Matrix4x4Double& aTransform);
38 // WebIDL Boilerplate
39 nsISupports* GetParentObject() const { return mParent; }
40 JSObject* WrapObject(JSContext* aCx,
41 JS::Handle<JSObject*> aGivenProto) override;
43 // WebIDL Members
44 DOMPoint* Position();
45 DOMPoint* Orientation();
46 void GetMatrix(JSContext* aCx, JS::MutableHandle<JSObject*> aRetval,
47 ErrorResult& aRv);
48 already_AddRefed<XRRigidTransform> Inverse();
50 protected:
51 void UpdateInternal();
52 virtual ~XRRigidTransform();
54 nsCOMPtr<nsISupports> mParent;
55 JS::Heap<JSObject*> mMatrixArray;
56 RefPtr<DOMPoint> mPosition;
57 RefPtr<DOMPoint> mOrientation;
58 RefPtr<XRRigidTransform> mInverse;
59 gfx::Matrix4x4Double mRawTransformMatrix;
60 gfx::PointDouble3D mRawPosition;
61 gfx::QuaternionDouble mRawOrientation;
62 bool mNeedsUpdate;
65 } // namespace mozilla::dom
67 #endif // mozilla_dom_XRRigidTransform_h_