michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: /* DOM object representing lists of values in DOM computed style */ michael@0: michael@0: #ifndef nsDOMCSSValueList_h___ michael@0: #define nsDOMCSSValueList_h___ michael@0: michael@0: #include "nsIDOMCSSValueList.h" michael@0: #include "CSSValue.h" michael@0: #include "nsTArray.h" michael@0: michael@0: class nsDOMCSSValueList MOZ_FINAL : public mozilla::dom::CSSValue, michael@0: public nsIDOMCSSValueList michael@0: { michael@0: public: michael@0: NS_DECL_CYCLE_COLLECTING_ISUPPORTS michael@0: NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_AMBIGUOUS(nsDOMCSSValueList, mozilla::dom::CSSValue) michael@0: michael@0: // nsIDOMCSSValue michael@0: NS_DECL_NSIDOMCSSVALUE michael@0: michael@0: // nsDOMCSSValueList michael@0: nsDOMCSSValueList(bool aCommaDelimited, bool aReadonly); michael@0: ~nsDOMCSSValueList(); michael@0: michael@0: /** michael@0: * Adds a value to this list. michael@0: */ michael@0: void AppendCSSValue(CSSValue* aValue); michael@0: michael@0: virtual void GetCssText(nsString& aText, mozilla::ErrorResult& aRv) michael@0: MOZ_OVERRIDE MOZ_FINAL; michael@0: virtual void SetCssText(const nsAString& aText, michael@0: mozilla::ErrorResult& aRv) MOZ_OVERRIDE MOZ_FINAL; michael@0: virtual uint16_t CssValueType() const MOZ_OVERRIDE MOZ_FINAL; michael@0: michael@0: CSSValue* IndexedGetter(uint32_t aIdx, bool& aFound) const michael@0: { michael@0: aFound = aIdx <= Length(); michael@0: return Item(aIdx); michael@0: } michael@0: michael@0: CSSValue* Item(uint32_t aIndex) const michael@0: { michael@0: return mCSSValues.SafeElementAt(aIndex); michael@0: } michael@0: michael@0: uint32_t Length() const michael@0: { michael@0: return mCSSValues.Length(); michael@0: } michael@0: michael@0: nsISupports* GetParentObject() michael@0: { michael@0: return nullptr; michael@0: } michael@0: michael@0: virtual JSObject *WrapObject(JSContext *cx) MOZ_OVERRIDE; michael@0: michael@0: private: michael@0: bool mCommaDelimited; // some value lists use a comma michael@0: // as the delimiter, some just use michael@0: // spaces. michael@0: michael@0: bool mReadonly; // Are we read-only? michael@0: michael@0: InfallibleTArray > mCSSValues; michael@0: }; michael@0: michael@0: #endif /* nsDOMCSSValueList_h___ */