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___
|
|
|
|
|
2013-01-14 17:29:27 +00:00
|
|
|
#include "nsIDOMCSSValueList.h"
|
2012-10-01 16:49:41 +00:00
|
|
|
#include "CSSValue.h"
|
|
|
|
#include "nsAutoPtr.h"
|
2011-10-28 07:35:45 +00:00
|
|
|
#include "nsTArray.h"
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
class nsComputedDOMStyle;
|
2002-07-08 07:11:59 +00:00
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
class nsDOMCSSValueList MOZ_FINAL : public mozilla::dom::CSSValue,
|
2013-01-14 17:29:27 +00:00
|
|
|
public nsIDOMCSSValueList
|
2002-07-08 07:11:59 +00:00
|
|
|
{
|
|
|
|
public:
|
2012-10-01 16:49:41 +00:00
|
|
|
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
|
|
|
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_AMBIGUOUS(nsDOMCSSValueList, mozilla::dom::CSSValue)
|
2002-07-08 07:11:59 +00:00
|
|
|
|
|
|
|
// nsIDOMCSSValue
|
|
|
|
NS_DECL_NSIDOMCSSVALUE
|
|
|
|
|
|
|
|
// nsDOMCSSValueList
|
2011-09-29 06:19:26 +00:00
|
|
|
nsDOMCSSValueList(bool aCommaDelimited, bool aReadonly);
|
2012-10-01 16:49:41 +00:00
|
|
|
~nsDOMCSSValueList();
|
2002-07-08 07:11:59 +00:00
|
|
|
|
2005-03-20 13:35:31 +00:00
|
|
|
/**
|
|
|
|
* Adds a value to this list.
|
|
|
|
*/
|
2012-10-01 16:49:41 +00:00
|
|
|
void AppendCSSValue(CSSValue* aValue);
|
|
|
|
|
|
|
|
virtual void GetCssText(nsString& aText, mozilla::ErrorResult& aRv)
|
|
|
|
MOZ_OVERRIDE MOZ_FINAL;
|
|
|
|
virtual void SetCssText(const nsAString& aText,
|
|
|
|
mozilla::ErrorResult& aRv) MOZ_OVERRIDE MOZ_FINAL;
|
|
|
|
virtual uint16_t CssValueType() const MOZ_OVERRIDE MOZ_FINAL;
|
|
|
|
|
|
|
|
CSSValue* IndexedGetter(uint32_t aIdx, bool& aFound) const
|
|
|
|
{
|
|
|
|
aFound = aIdx <= Length();
|
|
|
|
return Item(aIdx);
|
|
|
|
}
|
2002-07-08 07:11:59 +00:00
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue* Item(uint32_t aIndex) const
|
2008-10-22 14:31:14 +00:00
|
|
|
{
|
2012-10-01 16:49:41 +00:00
|
|
|
return mCSSValues.SafeElementAt(aIndex);
|
2008-10-22 14:31:14 +00:00
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
uint32_t Length() const
|
2008-10-22 14:31:14 +00:00
|
|
|
{
|
2012-10-01 16:49:41 +00:00
|
|
|
return mCSSValues.Length();
|
2008-10-22 14:31:14 +00:00
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
nsISupports* GetParentObject()
|
|
|
|
{
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual JSObject *WrapObject(JSContext *cx, JSObject *scope, bool *triedToWrap);
|
|
|
|
|
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
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
InfallibleTArray<nsRefPtr<CSSValue> > mCSSValues;
|
2002-07-08 07:11:59 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* nsDOMCSSValueList_h___ */
|