ScreenLuminance.h (1506B)
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/. */ 6 7 #ifndef mozilla_dom_ScreenLuminance_h 8 #define mozilla_dom_ScreenLuminance_h 9 10 #include "nsCycleCollectionParticipant.h" 11 #include "nsISupportsImpl.h" 12 #include "nsWrapperCache.h" 13 14 class nsScreen; 15 16 namespace mozilla::dom { 17 18 class ScreenLuminance final : public nsWrapperCache { 19 public: 20 // Ref counting and cycle collection 21 NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(ScreenLuminance) 22 NS_DECL_CYCLE_COLLECTION_NATIVE_WRAPPERCACHE_CLASS(ScreenLuminance) 23 24 // WebIDL methods 25 double Min() const { return mMin; } 26 double Max() const { return mMax; } 27 double MaxAverage() const { return mMaxAverage; } 28 // End WebIDL methods 29 30 ScreenLuminance(nsScreen* aScreen, double aMin, double aMax, 31 double aMaxAverage) 32 : mScreen(aScreen), mMin(aMin), mMax(aMax), mMaxAverage(aMaxAverage) {} 33 34 nsScreen* GetParentObject() const { return mScreen; } 35 JSObject* WrapObject(JSContext* aCx, 36 JS::Handle<JSObject*> aGivenProto) override; 37 38 private: 39 virtual ~ScreenLuminance() = default; 40 41 RefPtr<nsScreen> mScreen; 42 double mMin; 43 double mMax; 44 double mMaxAverage; 45 }; 46 47 } // namespace mozilla::dom 48 49 #endif // mozilla_dom_ScreenLuminance_h