|
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 "nsAutoPtr.h" |
|
13 #include "nsWrapperCache.h" |
|
14 |
|
15 class nsROCSSPrimitiveValue; |
|
16 |
|
17 class nsDOMCSSRGBColor : public nsWrapperCache |
|
18 { |
|
19 public: |
|
20 nsDOMCSSRGBColor(nsROCSSPrimitiveValue* aRed, |
|
21 nsROCSSPrimitiveValue* aGreen, |
|
22 nsROCSSPrimitiveValue* aBlue, |
|
23 nsROCSSPrimitiveValue* aAlpha, |
|
24 bool aHasAlpha); |
|
25 |
|
26 virtual ~nsDOMCSSRGBColor(void); |
|
27 |
|
28 NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(nsDOMCSSRGBColor) |
|
29 |
|
30 NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS(nsDOMCSSRGBColor) |
|
31 |
|
32 bool HasAlpha() const { return mHasAlpha; } |
|
33 |
|
34 // RGBColor webidl interface |
|
35 nsROCSSPrimitiveValue* Red() const |
|
36 { |
|
37 return mRed; |
|
38 } |
|
39 nsROCSSPrimitiveValue* Green() const |
|
40 { |
|
41 return mGreen; |
|
42 } |
|
43 nsROCSSPrimitiveValue* Blue() const |
|
44 { |
|
45 return mBlue; |
|
46 } |
|
47 nsROCSSPrimitiveValue* Alpha() const |
|
48 { |
|
49 return mAlpha; |
|
50 } |
|
51 |
|
52 nsISupports* GetParentObject() const |
|
53 { |
|
54 return nullptr; |
|
55 } |
|
56 |
|
57 virtual JSObject *WrapObject(JSContext *cx) |
|
58 MOZ_OVERRIDE MOZ_FINAL; |
|
59 |
|
60 private: |
|
61 nsRefPtr<nsROCSSPrimitiveValue> mRed; |
|
62 nsRefPtr<nsROCSSPrimitiveValue> mGreen; |
|
63 nsRefPtr<nsROCSSPrimitiveValue> mBlue; |
|
64 nsRefPtr<nsROCSSPrimitiveValue> mAlpha; |
|
65 bool mHasAlpha; |
|
66 }; |
|
67 |
|
68 #endif // nsDOMCSSRGBColor_h__ |