Line data Source code
1 : /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 : /* This Source Code Form is subject to the terms of the Mozilla Public
3 : * License, v. 2.0. If a copy of the MPL was not distributed with this
4 : * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 :
6 : /* DOM object representing color values in DOM computed style */
7 :
8 : #ifndef nsDOMCSSRGBColor_h__
9 : #define nsDOMCSSRGBColor_h__
10 :
11 : #include "mozilla/Attributes.h"
12 : #include "nsWrapperCache.h"
13 :
14 : class nsROCSSPrimitiveValue;
15 :
16 : class nsDOMCSSRGBColor : public nsWrapperCache
17 : {
18 : public:
19 : nsDOMCSSRGBColor(nsROCSSPrimitiveValue* aRed,
20 : nsROCSSPrimitiveValue* aGreen,
21 : nsROCSSPrimitiveValue* aBlue,
22 : nsROCSSPrimitiveValue* aAlpha,
23 : bool aHasAlpha);
24 :
25 6 : NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(nsDOMCSSRGBColor)
26 :
27 6 : NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS(nsDOMCSSRGBColor)
28 :
29 6 : bool HasAlpha() const { return mHasAlpha; }
30 :
31 : // RGBColor webidl interface
32 3 : nsROCSSPrimitiveValue* Red() const
33 : {
34 3 : return mRed;
35 : }
36 3 : nsROCSSPrimitiveValue* Green() const
37 : {
38 3 : return mGreen;
39 : }
40 3 : nsROCSSPrimitiveValue* Blue() const
41 : {
42 3 : return mBlue;
43 : }
44 0 : nsROCSSPrimitiveValue* Alpha() const
45 : {
46 0 : return mAlpha;
47 : }
48 :
49 0 : nsISupports* GetParentObject() const
50 : {
51 0 : return nullptr;
52 : }
53 :
54 : virtual JSObject *WrapObject(JSContext *cx, JS::Handle<JSObject*> aGivenProto)
55 : override final;
56 :
57 : private:
58 : virtual ~nsDOMCSSRGBColor(void);
59 :
60 : RefPtr<nsROCSSPrimitiveValue> mRed;
61 : RefPtr<nsROCSSPrimitiveValue> mGreen;
62 : RefPtr<nsROCSSPrimitiveValue> mBlue;
63 : RefPtr<nsROCSSPrimitiveValue> mAlpha;
64 : bool mHasAlpha;
65 : };
66 :
67 : #endif // nsDOMCSSRGBColor_h__
|