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 lists of values in DOM computed style */
|
|
|
|
|
|
|
|
#ifndef nsDOMCSSValueList_h___
|
|
|
|
#define nsDOMCSSValueList_h___
|
|
|
|
|
|
|
|
#include "nsIDOMCSSValue.h"
|
|
|
|
#include "nsIDOMCSSValueList.h"
|
2011-10-28 00:35:45 -07:00
|
|
|
#include "nsTArray.h"
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
#include "nsCOMPtr.h"
|
|
|
|
|
|
|
|
class nsDOMCSSValueList : public nsIDOMCSSValueList
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
NS_DECL_ISUPPORTS
|
|
|
|
|
|
|
|
// nsIDOMCSSValueList
|
|
|
|
NS_DECL_NSIDOMCSSVALUELIST
|
|
|
|
|
|
|
|
// nsIDOMCSSValue
|
|
|
|
NS_DECL_NSIDOMCSSVALUE
|
|
|
|
|
|
|
|
// nsDOMCSSValueList
|
2011-09-28 23:19:26 -07:00
|
|
|
nsDOMCSSValueList(bool aCommaDelimited, bool aReadonly);
|
2007-03-22 10:30:00 -07:00
|
|
|
virtual ~nsDOMCSSValueList();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Adds a value to this list.
|
|
|
|
*/
|
2011-03-04 09:28:57 -08:00
|
|
|
void AppendCSSValue(nsIDOMCSSValue* aValue);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2008-10-22 07:31:14 -07:00
|
|
|
nsIDOMCSSValue* GetItemAt(PRUint32 aIndex)
|
|
|
|
{
|
2012-07-30 07:20:58 -07:00
|
|
|
return mCSSValues.SafeElementAt(aIndex, nullptr);
|
2008-10-22 07:31:14 -07: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);
|
|
|
|
}
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
private:
|
2011-09-28 23:19:26 -07:00
|
|
|
bool mCommaDelimited; // some value lists use a comma
|
2007-03-22 10:30:00 -07:00
|
|
|
// as the delimiter, some just use
|
|
|
|
// spaces.
|
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
bool mReadonly; // Are we read-only?
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2011-03-04 09:28:57 -08:00
|
|
|
InfallibleTArray<nsCOMPtr<nsIDOMCSSValue> > mCSSValues;
|
2007-03-22 10:30:00 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endif /* nsDOMCSSValueList_h___ */
|