Bug 1688354 [wpt PR 27298] - Treat 'rem' as an absolute unit for font size, a=testonly
[gecko.git] / dom / vr / XRView.h
blob7cc4f1954b04b1a10bed10ad23ec987d9ee61855
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_XRView_h_
8 #define mozilla_dom_XRView_h_
10 #include "mozilla/DOMEventTargetHelper.h"
11 #include "mozilla/dom/WebXRBinding.h"
13 #include "gfxVR.h"
15 namespace mozilla {
16 namespace dom {
18 enum class XREye : uint8_t;
19 class XRRigidTransform;
21 class XRView final : public nsWrapperCache {
22 public:
23 NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(XRView)
24 NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS(XRView)
26 explicit XRView(nsISupports* aParent, const XREye& aEye);
28 void Update(const gfx::PointDouble3D& aPosition,
29 const gfx::QuaternionDouble& aOrientation,
30 const gfx::Matrix4x4& aProjectionMatrix);
31 // WebIDL Boilerplate
32 nsISupports* GetParentObject() const { return mParent; }
33 JSObject* WrapObject(JSContext* aCx,
34 JS::Handle<JSObject*> aGivenProto) override;
36 // WebIDL Members
37 XREye Eye() const;
38 void GetProjectionMatrix(JSContext* aCx, JS::MutableHandle<JSObject*> aRetval,
39 ErrorResult& aRv);
40 already_AddRefed<XRRigidTransform> GetTransform(ErrorResult& aRv);
42 protected:
43 virtual ~XRView();
45 nsCOMPtr<nsISupports> mParent;
46 XREye mEye;
47 gfx::PointDouble3D mPosition;
48 gfx::QuaternionDouble mOrientation;
49 gfx::Matrix4x4 mProjectionMatrix;
50 JS::Heap<JSObject*> mJSProjectionMatrix;
51 bool mProjectionNeedsUpdate = true;
52 RefPtr<XRRigidTransform> mTransform;
55 } // namespace dom
56 } // namespace mozilla
58 #endif // mozilla_dom_XRView_h_