1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim:set ts=2 sw=2 et tw=78: */
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_ScreenLuminance_h
8 #define mozilla_dom_ScreenLuminance_h
10 #include "nsCycleCollectionParticipant.h"
11 #include "nsISupportsImpl.h"
12 #include "nsWrapperCache.h"
16 namespace mozilla::dom
{
18 class ScreenLuminance final
: public nsWrapperCache
{
20 // Ref counting and cycle collection
21 NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(ScreenLuminance
)
22 NS_DECL_CYCLE_COLLECTION_NATIVE_WRAPPERCACHE_CLASS(ScreenLuminance
)
25 double Min() const { return mMin
; }
26 double Max() const { return mMax
; }
27 double MaxAverage() const { return mMaxAverage
; }
30 ScreenLuminance(nsScreen
* aScreen
, double aMin
, double aMax
,
32 : mScreen(aScreen
), mMin(aMin
), mMax(aMax
), mMaxAverage(aMaxAverage
) {}
34 nsScreen
* GetParentObject() const { return mScreen
; }
35 JSObject
* WrapObject(JSContext
* aCx
,
36 JS::Handle
<JSObject
*> aGivenProto
) override
;
39 virtual ~ScreenLuminance() = default;
41 RefPtr
<nsScreen
> mScreen
;
47 } // namespace mozilla::dom
49 #endif // mozilla_dom_ScreenLuminance_h