1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/layout/style/nsDOMCSSRGBColor.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,68 @@ 1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.8 + 1.9 +/* DOM object representing color values in DOM computed style */ 1.10 + 1.11 +#ifndef nsDOMCSSRGBColor_h__ 1.12 +#define nsDOMCSSRGBColor_h__ 1.13 + 1.14 +#include "mozilla/Attributes.h" 1.15 +#include "nsAutoPtr.h" 1.16 +#include "nsWrapperCache.h" 1.17 + 1.18 +class nsROCSSPrimitiveValue; 1.19 + 1.20 +class nsDOMCSSRGBColor : public nsWrapperCache 1.21 +{ 1.22 +public: 1.23 + nsDOMCSSRGBColor(nsROCSSPrimitiveValue* aRed, 1.24 + nsROCSSPrimitiveValue* aGreen, 1.25 + nsROCSSPrimitiveValue* aBlue, 1.26 + nsROCSSPrimitiveValue* aAlpha, 1.27 + bool aHasAlpha); 1.28 + 1.29 + virtual ~nsDOMCSSRGBColor(void); 1.30 + 1.31 + NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(nsDOMCSSRGBColor) 1.32 + 1.33 + NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS(nsDOMCSSRGBColor) 1.34 + 1.35 + bool HasAlpha() const { return mHasAlpha; } 1.36 + 1.37 + // RGBColor webidl interface 1.38 + nsROCSSPrimitiveValue* Red() const 1.39 + { 1.40 + return mRed; 1.41 + } 1.42 + nsROCSSPrimitiveValue* Green() const 1.43 + { 1.44 + return mGreen; 1.45 + } 1.46 + nsROCSSPrimitiveValue* Blue() const 1.47 + { 1.48 + return mBlue; 1.49 + } 1.50 + nsROCSSPrimitiveValue* Alpha() const 1.51 + { 1.52 + return mAlpha; 1.53 + } 1.54 + 1.55 + nsISupports* GetParentObject() const 1.56 + { 1.57 + return nullptr; 1.58 + } 1.59 + 1.60 + virtual JSObject *WrapObject(JSContext *cx) 1.61 + MOZ_OVERRIDE MOZ_FINAL; 1.62 + 1.63 +private: 1.64 + nsRefPtr<nsROCSSPrimitiveValue> mRed; 1.65 + nsRefPtr<nsROCSSPrimitiveValue> mGreen; 1.66 + nsRefPtr<nsROCSSPrimitiveValue> mBlue; 1.67 + nsRefPtr<nsROCSSPrimitiveValue> mAlpha; 1.68 + bool mHasAlpha; 1.69 +}; 1.70 + 1.71 +#endif // nsDOMCSSRGBColor_h__