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