Bug 1550519 - Show a translucent parent highlight when a subgrid is highlighted....
[gecko.git] / dom / gamepad / GamepadTouch.h
blobeb961f57a0c008e2d367580ca4eb203dc7bac568
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_gamepad_GamepadTouch_h
8 #define mozilla_dom_gamepad_GamepadTouch_h
10 #include "mozilla/dom/GamepadTouchBinding.h"
11 #include "mozilla/dom/GamepadTouchState.h"
13 namespace mozilla {
14 namespace dom {
16 class GamepadTouch final : public nsWrapperCache {
17 public:
18 explicit GamepadTouch(nsISupports* aParent);
20 NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(GamepadTouch)
21 NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS(GamepadTouch)
23 nsISupports* GetParentObject() const { return mParent; }
24 virtual JSObject* WrapObject(JSContext* aCx,
25 JS::Handle<JSObject*> aGivenProto) override;
26 uint32_t TouchId() const { return mTouchState.touchId; }
27 uint32_t SurfaceId() const { return mTouchState.surfaceId; }
28 void GetPosition(JSContext* aCx, JS::MutableHandle<JSObject*> aRetval,
29 ErrorResult& aRv);
30 void GetSurfaceDimensions(JSContext* aCx,
31 JS::MutableHandle<JSObject*> aRetval,
32 ErrorResult& aRv);
33 void SetTouchState(const GamepadTouchState& aTouch);
34 void Set(const GamepadTouch* aOther);
36 private:
37 virtual ~GamepadTouch();
39 nsCOMPtr<nsISupports> mParent;
40 JS::Heap<JSObject*> mPosition;
41 JS::Heap<JSObject*> mSurfaceDimensions;
42 GamepadTouchState mTouchState;
45 } // namespace dom
46 } // namespace mozilla
48 #endif // mozilla_dom_gamepad_GamepadTouch_h