2012-05-21 11:12:37 +00: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/. */
|
2002-07-08 07:11:59 +00:00
|
|
|
|
2006-03-25 05:47:31 +00:00
|
|
|
/* DOM object representing lists of values in DOM computed style */
|
|
|
|
|
2002-07-08 07:11:59 +00:00
|
|
|
#ifndef nsDOMCSSValueList_h___
|
|
|
|
#define nsDOMCSSValueList_h___
|
|
|
|
|
|
|
|
#include "nsIDOMCSSValue.h"
|
|
|
|
#include "nsIDOMCSSValueList.h"
|
2011-10-28 07:35:45 +00:00
|
|
|
#include "nsTArray.h"
|
|
|
|
|
2002-07-08 07:11:59 +00:00
|
|
|
|
|
|
|
#include "nsCOMPtr.h"
|
|
|
|
|
|
|
|
class nsDOMCSSValueList : public nsIDOMCSSValueList
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
NS_DECL_ISUPPORTS
|
|
|
|
|
|
|
|
// nsIDOMCSSValueList
|
|
|
|
NS_DECL_NSIDOMCSSVALUELIST
|
|
|
|
|
|
|
|
// nsIDOMCSSValue
|
|
|
|
NS_DECL_NSIDOMCSSVALUE
|
|
|
|
|
|
|
|
// nsDOMCSSValueList
|
2011-09-29 06:19:26 +00:00
|
|
|
nsDOMCSSValueList(bool aCommaDelimited, bool aReadonly);
|
2002-07-08 07:11:59 +00:00
|
|
|
virtual ~nsDOMCSSValueList();
|
|
|
|
|
2005-03-20 13:35:31 +00:00
|
|
|
/**
|
|
|
|
* Adds a value to this list.
|
|
|
|
*/
|
2011-03-04 17:28:57 +00:00
|
|
|
void AppendCSSValue(nsIDOMCSSValue* aValue);
|
2002-07-08 07:11:59 +00:00
|
|
|
|
2012-08-22 15:56:38 +00:00
|
|
|
nsIDOMCSSValue* GetItemAt(uint32_t aIndex)
|
2008-10-22 14:31:14 +00:00
|
|
|
{
|
2012-07-30 14:20:58 +00:00
|
|
|
return mCSSValues.SafeElementAt(aIndex, nullptr);
|
2008-10-22 14:31:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static nsDOMCSSValueList* FromSupports(nsISupports* aSupports)
|
|
|
|
{
|
|
|
|
#ifdef DEBUG
|
|
|
|
{
|
|
|
|
nsCOMPtr<nsIDOMCSSValueList> list_qi = do_QueryInterface(aSupports);
|
|
|
|
|
|
|
|
// If this assertion fires the QI implementation for the object in
|
|
|
|
// question doesn't use the nsIDOMCSSValueList pointer as the nsISupports
|
|
|
|
// pointer. That must be fixed, or we'll crash...
|
|
|
|
NS_ASSERTION(list_qi == static_cast<nsIDOMCSSValueList*>(aSupports),
|
|
|
|
"Uh, fix QI!");
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
return static_cast<nsDOMCSSValueList*>(aSupports);
|
|
|
|
}
|
|
|
|
|
2002-07-08 07:11:59 +00:00
|
|
|
private:
|
2011-09-29 06:19:26 +00:00
|
|
|
bool mCommaDelimited; // some value lists use a comma
|
2002-07-08 07:11:59 +00:00
|
|
|
// as the delimiter, some just use
|
|
|
|
// spaces.
|
|
|
|
|
2011-09-29 06:19:26 +00:00
|
|
|
bool mReadonly; // Are we read-only?
|
2002-07-08 07:11:59 +00:00
|
|
|
|
2011-03-04 17:28:57 +00:00
|
|
|
InfallibleTArray<nsCOMPtr<nsIDOMCSSValue> > mCSSValues;
|
2002-07-08 07:11:59 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endif /* nsDOMCSSValueList_h___ */
|