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