Bug 1704628 Part 4: Avoid use of ESC to close context menu in browser_toolbox_content...
[gecko.git] / dom / vr / XRViewerPose.cpp
blob5e1577ae50b199a87cb14e3a36c4c2e3cef47346
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 #include "mozilla/dom/XRViewerPose.h"
8 #include "mozilla/dom/XRView.h"
10 namespace mozilla {
11 namespace dom {
13 NS_IMPL_CYCLE_COLLECTION_CLASS(XRViewerPose)
15 NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(XRViewerPose, XRPose)
16 NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mViews)
17 NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
19 NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(XRViewerPose, XRPose)
20 NS_IMPL_CYCLE_COLLECTION_UNLINK(mViews)
21 // Don't need NS_IMPL_CYCLE_COLLECTION_UNLINK_PRESERVED_WRAPPER because
22 // XRPose does it for us.
23 NS_IMPL_CYCLE_COLLECTION_UNLINK_END
25 NS_IMPL_ISUPPORTS_CYCLE_COLLECTION_INHERITED_0(XRViewerPose, XRPose)
27 XRViewerPose::XRViewerPose(nsISupports* aParent, XRRigidTransform* aTransform,
28 bool aEmulatedPosition,
29 const nsTArray<RefPtr<XRView>>& aViews)
30 : XRPose(aParent, aTransform, aEmulatedPosition), mViews(aViews.Clone()) {}
32 JSObject* XRViewerPose::WrapObject(JSContext* aCx,
33 JS::Handle<JSObject*> aGivenProto) {
34 return XRViewerPose_Binding::Wrap(aCx, this, aGivenProto);
37 RefPtr<XRView>& XRViewerPose::GetEye(int32_t aIndex) {
38 return mViews.ElementAt(aIndex);
41 void XRViewerPose::GetViews(nsTArray<RefPtr<XRView>>& aResult) {
42 aResult = mViews.Clone();
45 } // namespace dom
46 } // namespace mozilla