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___
|
|
|
|
|
2013-01-14 09:29:27 -08:00
|
|
|
#include "nsIDOMCSSValueList.h"
|
2012-10-01 09:49:41 -07:00
|
|
|
#include "CSSValue.h"
|
2011-10-28 00:35:45 -07:00
|
|
|
#include "nsTArray.h"
|
|
|
|
|
2012-10-01 09:49:41 -07:00
|
|
|
class nsDOMCSSValueList MOZ_FINAL : public mozilla::dom::CSSValue,
|
2013-01-14 09:29:27 -08:00
|
|
|
public nsIDOMCSSValueList
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
|
|
|
public:
|
2012-10-01 09:49:41 -07:00
|
|
|
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
|
|
|
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_AMBIGUOUS(nsDOMCSSValueList, mozilla::dom::CSSValue)
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
// 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
|
|
|
|
|
|
|
/**
|
|
|
|
* Adds a value to this list.
|
|
|
|
*/
|
2012-10-01 09:49:41 -07: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);
|
|
|
|
}
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2012-10-01 09:49:41 -07:00
|
|
|
CSSValue* Item(uint32_t aIndex) const
|
2008-10-22 07:31:14 -07:00
|
|
|
{
|
2012-10-01 09:49:41 -07:00
|
|
|
return mCSSValues.SafeElementAt(aIndex);
|
2008-10-22 07:31:14 -07:00
|
|
|
}
|
|
|
|
|
2012-10-01 09:49:41 -07:00
|
|
|
uint32_t Length() const
|
2008-10-22 07:31:14 -07:00
|
|
|
{
|
2012-10-01 09:49:41 -07:00
|
|
|
return mCSSValues.Length();
|
2008-10-22 07:31:14 -07:00
|
|
|
}
|
|
|
|
|
2012-10-01 09:49:41 -07:00
|
|
|
nsISupports* GetParentObject()
|
|
|
|
{
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
2014-04-08 15:27:18 -07:00
|
|
|
virtual JSObject *WrapObject(JSContext *cx) MOZ_OVERRIDE;
|
2012-10-01 09:49:41 -07:00
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
private:
|
2014-06-26 09:29:06 -07:00
|
|
|
~nsDOMCSSValueList();
|
|
|
|
|
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
|
|
|
|
2012-10-01 09:49:41 -07:00
|
|
|
InfallibleTArray<nsRefPtr<CSSValue> > mCSSValues;
|
2007-03-22 10:30:00 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* nsDOMCSSValueList_h___ */
|