Wed, 31 Dec 2014 07:16:47 +0100
Revert simplistic fix pending revisit of Mozilla integration attempt.
michael@0 | 1 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 2 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 3 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 4 | |
michael@0 | 5 | /* DOM object representing lists of values in DOM computed style */ |
michael@0 | 6 | |
michael@0 | 7 | #ifndef nsDOMCSSValueList_h___ |
michael@0 | 8 | #define nsDOMCSSValueList_h___ |
michael@0 | 9 | |
michael@0 | 10 | #include "nsIDOMCSSValueList.h" |
michael@0 | 11 | #include "CSSValue.h" |
michael@0 | 12 | #include "nsTArray.h" |
michael@0 | 13 | |
michael@0 | 14 | class nsDOMCSSValueList MOZ_FINAL : public mozilla::dom::CSSValue, |
michael@0 | 15 | public nsIDOMCSSValueList |
michael@0 | 16 | { |
michael@0 | 17 | public: |
michael@0 | 18 | NS_DECL_CYCLE_COLLECTING_ISUPPORTS |
michael@0 | 19 | NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_AMBIGUOUS(nsDOMCSSValueList, mozilla::dom::CSSValue) |
michael@0 | 20 | |
michael@0 | 21 | // nsIDOMCSSValue |
michael@0 | 22 | NS_DECL_NSIDOMCSSVALUE |
michael@0 | 23 | |
michael@0 | 24 | // nsDOMCSSValueList |
michael@0 | 25 | nsDOMCSSValueList(bool aCommaDelimited, bool aReadonly); |
michael@0 | 26 | ~nsDOMCSSValueList(); |
michael@0 | 27 | |
michael@0 | 28 | /** |
michael@0 | 29 | * Adds a value to this list. |
michael@0 | 30 | */ |
michael@0 | 31 | void AppendCSSValue(CSSValue* aValue); |
michael@0 | 32 | |
michael@0 | 33 | virtual void GetCssText(nsString& aText, mozilla::ErrorResult& aRv) |
michael@0 | 34 | MOZ_OVERRIDE MOZ_FINAL; |
michael@0 | 35 | virtual void SetCssText(const nsAString& aText, |
michael@0 | 36 | mozilla::ErrorResult& aRv) MOZ_OVERRIDE MOZ_FINAL; |
michael@0 | 37 | virtual uint16_t CssValueType() const MOZ_OVERRIDE MOZ_FINAL; |
michael@0 | 38 | |
michael@0 | 39 | CSSValue* IndexedGetter(uint32_t aIdx, bool& aFound) const |
michael@0 | 40 | { |
michael@0 | 41 | aFound = aIdx <= Length(); |
michael@0 | 42 | return Item(aIdx); |
michael@0 | 43 | } |
michael@0 | 44 | |
michael@0 | 45 | CSSValue* Item(uint32_t aIndex) const |
michael@0 | 46 | { |
michael@0 | 47 | return mCSSValues.SafeElementAt(aIndex); |
michael@0 | 48 | } |
michael@0 | 49 | |
michael@0 | 50 | uint32_t Length() const |
michael@0 | 51 | { |
michael@0 | 52 | return mCSSValues.Length(); |
michael@0 | 53 | } |
michael@0 | 54 | |
michael@0 | 55 | nsISupports* GetParentObject() |
michael@0 | 56 | { |
michael@0 | 57 | return nullptr; |
michael@0 | 58 | } |
michael@0 | 59 | |
michael@0 | 60 | virtual JSObject *WrapObject(JSContext *cx) MOZ_OVERRIDE; |
michael@0 | 61 | |
michael@0 | 62 | private: |
michael@0 | 63 | bool mCommaDelimited; // some value lists use a comma |
michael@0 | 64 | // as the delimiter, some just use |
michael@0 | 65 | // spaces. |
michael@0 | 66 | |
michael@0 | 67 | bool mReadonly; // Are we read-only? |
michael@0 | 68 | |
michael@0 | 69 | InfallibleTArray<nsRefPtr<CSSValue> > mCSSValues; |
michael@0 | 70 | }; |
michael@0 | 71 | |
michael@0 | 72 | #endif /* nsDOMCSSValueList_h___ */ |