michael@0: /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: /* DOM object representing color values in DOM computed style */ michael@0: michael@0: #ifndef nsDOMCSSRGBColor_h__ michael@0: #define nsDOMCSSRGBColor_h__ michael@0: michael@0: #include "mozilla/Attributes.h" michael@0: #include "nsAutoPtr.h" michael@0: #include "nsWrapperCache.h" michael@0: michael@0: class nsROCSSPrimitiveValue; michael@0: michael@0: class nsDOMCSSRGBColor : public nsWrapperCache michael@0: { michael@0: public: michael@0: nsDOMCSSRGBColor(nsROCSSPrimitiveValue* aRed, michael@0: nsROCSSPrimitiveValue* aGreen, michael@0: nsROCSSPrimitiveValue* aBlue, michael@0: nsROCSSPrimitiveValue* aAlpha, michael@0: bool aHasAlpha); michael@0: michael@0: virtual ~nsDOMCSSRGBColor(void); michael@0: michael@0: NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(nsDOMCSSRGBColor) michael@0: michael@0: NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS(nsDOMCSSRGBColor) michael@0: michael@0: bool HasAlpha() const { return mHasAlpha; } michael@0: michael@0: // RGBColor webidl interface michael@0: nsROCSSPrimitiveValue* Red() const michael@0: { michael@0: return mRed; michael@0: } michael@0: nsROCSSPrimitiveValue* Green() const michael@0: { michael@0: return mGreen; michael@0: } michael@0: nsROCSSPrimitiveValue* Blue() const michael@0: { michael@0: return mBlue; michael@0: } michael@0: nsROCSSPrimitiveValue* Alpha() const michael@0: { michael@0: return mAlpha; michael@0: } michael@0: michael@0: nsISupports* GetParentObject() const michael@0: { michael@0: return nullptr; michael@0: } michael@0: michael@0: virtual JSObject *WrapObject(JSContext *cx) michael@0: MOZ_OVERRIDE MOZ_FINAL; michael@0: michael@0: private: michael@0: nsRefPtr mRed; michael@0: nsRefPtr mGreen; michael@0: nsRefPtr mBlue; michael@0: nsRefPtr mAlpha; michael@0: bool mHasAlpha; michael@0: }; michael@0: michael@0: #endif // nsDOMCSSRGBColor_h__