2007-03-22 10:30:00 -07:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 04:12:37 -07:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
/* DOM object representing color values in DOM computed style */
|
|
|
|
|
|
|
|
#include "nsISupports.h"
|
|
|
|
#include "nsCOMPtr.h"
|
|
|
|
#include "nsIDOMCSSPrimitiveValue.h"
|
|
|
|
#include "nsDOMCSSRGBColor.h"
|
|
|
|
#include "nsContentUtils.h"
|
2012-07-20 09:42:08 -07:00
|
|
|
#include "nsDOMClassInfoID.h"
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
nsDOMCSSRGBColor::nsDOMCSSRGBColor(nsIDOMCSSPrimitiveValue* aRed,
|
|
|
|
nsIDOMCSSPrimitiveValue* aGreen,
|
|
|
|
nsIDOMCSSPrimitiveValue* aBlue,
|
|
|
|
nsIDOMCSSPrimitiveValue* aAlpha,
|
2011-09-28 23:19:26 -07:00
|
|
|
bool aHasAlpha)
|
2007-03-22 10:30:00 -07:00
|
|
|
: mRed(aRed), mGreen(aGreen), mBlue(aBlue), mAlpha(aAlpha)
|
|
|
|
, mHasAlpha(aHasAlpha)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
nsDOMCSSRGBColor::~nsDOMCSSRGBColor(void)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2010-01-12 05:08:43 -08:00
|
|
|
DOMCI_DATA(CSSRGBColor, nsDOMCSSRGBColor)
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
NS_INTERFACE_MAP_BEGIN(nsDOMCSSRGBColor)
|
|
|
|
NS_INTERFACE_MAP_ENTRY(nsIDOMRGBColor)
|
|
|
|
NS_INTERFACE_MAP_ENTRY(nsIDOMNSRGBAColor)
|
|
|
|
NS_INTERFACE_MAP_ENTRY(nsISupports)
|
2010-03-17 08:09:05 -07:00
|
|
|
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(CSSRGBColor)
|
2007-03-22 10:30:00 -07:00
|
|
|
NS_INTERFACE_MAP_END
|
|
|
|
|
|
|
|
NS_IMPL_ADDREF(nsDOMCSSRGBColor)
|
|
|
|
NS_IMPL_RELEASE(nsDOMCSSRGBColor)
|
|
|
|
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsDOMCSSRGBColor::GetRed(nsIDOMCSSPrimitiveValue** aRed)
|
|
|
|
{
|
|
|
|
NS_ENSURE_TRUE(mRed, NS_ERROR_NOT_INITIALIZED);
|
|
|
|
*aRed = mRed;
|
|
|
|
NS_ADDREF(*aRed);
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsDOMCSSRGBColor::GetGreen(nsIDOMCSSPrimitiveValue** aGreen)
|
|
|
|
{
|
|
|
|
NS_ENSURE_TRUE(mGreen, NS_ERROR_NOT_INITIALIZED);
|
|
|
|
*aGreen = mGreen;
|
|
|
|
NS_ADDREF(*aGreen);
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsDOMCSSRGBColor::GetBlue(nsIDOMCSSPrimitiveValue** aBlue)
|
|
|
|
{
|
|
|
|
NS_ENSURE_TRUE(mBlue, NS_ERROR_NOT_INITIALIZED);
|
|
|
|
*aBlue = mBlue;
|
|
|
|
NS_ADDREF(*aBlue);
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsDOMCSSRGBColor::GetAlpha(nsIDOMCSSPrimitiveValue** aAlpha)
|
|
|
|
{
|
|
|
|
NS_ENSURE_TRUE(mAlpha, NS_ERROR_NOT_INITIALIZED);
|
|
|
|
*aAlpha = mAlpha;
|
|
|
|
NS_ADDREF(*aAlpha);
|
|
|
|
return NS_OK;
|
|
|
|
}
|