2017-10-27 20:33:53 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
2012-05-21 15:12:37 +04: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 11:11:59 +04:00
|
|
|
|
2006-03-25 08:47:31 +03:00
|
|
|
/* DOM object representing lists of values in DOM computed style */
|
|
|
|
|
2002-07-08 11:11:59 +04:00
|
|
|
#ifndef nsDOMCSSValueList_h___
|
|
|
|
#define nsDOMCSSValueList_h___
|
|
|
|
|
2012-10-01 20:49:41 +04:00
|
|
|
#include "CSSValue.h"
|
2011-10-28 11:35:45 +04:00
|
|
|
#include "nsTArray.h"
|
|
|
|
|
2018-01-11 11:17:57 +03:00
|
|
|
class nsDOMCSSValueList final : public mozilla::dom::CSSValue
|
2002-07-08 11:11:59 +04:00
|
|
|
{
|
|
|
|
public:
|
2012-10-01 20:49:41 +04:00
|
|
|
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
2018-01-11 11:17:57 +03:00
|
|
|
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(nsDOMCSSValueList)
|
2002-07-08 11:11:59 +04:00
|
|
|
|
|
|
|
// nsDOMCSSValueList
|
2011-09-29 10:19:26 +04:00
|
|
|
nsDOMCSSValueList(bool aCommaDelimited, bool aReadonly);
|
2002-07-08 11:11:59 +04:00
|
|
|
|
2005-03-20 16:35:31 +03:00
|
|
|
/**
|
|
|
|
* Adds a value to this list.
|
|
|
|
*/
|
2015-12-24 03:25:43 +03:00
|
|
|
void AppendCSSValue(already_AddRefed<CSSValue> aValue);
|
2012-10-01 20:49:41 +04:00
|
|
|
|
2018-02-09 08:22:43 +03:00
|
|
|
void GetCssText(nsString& aText, mozilla::ErrorResult& aRv) final;
|
|
|
|
void SetCssText(const nsAString& aText, mozilla::ErrorResult& aRv) final;
|
|
|
|
uint16_t CssValueType() const final;
|
2012-10-01 20:49:41 +04:00
|
|
|
|
2018-01-11 11:17:57 +03:00
|
|
|
void GetCssText(nsAString& aText);
|
|
|
|
|
2012-10-01 20:49:41 +04:00
|
|
|
CSSValue* IndexedGetter(uint32_t aIdx, bool& aFound) const
|
|
|
|
{
|
|
|
|
aFound = aIdx <= Length();
|
|
|
|
return Item(aIdx);
|
|
|
|
}
|
2002-07-08 11:11:59 +04:00
|
|
|
|
2012-10-01 20:49:41 +04:00
|
|
|
CSSValue* Item(uint32_t aIndex) const
|
2008-10-22 18:31:14 +04:00
|
|
|
{
|
2012-10-01 20:49:41 +04:00
|
|
|
return mCSSValues.SafeElementAt(aIndex);
|
2008-10-22 18:31:14 +04:00
|
|
|
}
|
|
|
|
|
2012-10-01 20:49:41 +04:00
|
|
|
uint32_t Length() const
|
2008-10-22 18:31:14 +04:00
|
|
|
{
|
2012-10-01 20:49:41 +04:00
|
|
|
return mCSSValues.Length();
|
2008-10-22 18:31:14 +04:00
|
|
|
}
|
|
|
|
|
2012-10-01 20:49:41 +04:00
|
|
|
nsISupports* GetParentObject()
|
|
|
|
{
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual JSObject *WrapObject(JSContext *cx, JS::Handle<JSObject*> aGivenProto) override;
|
2012-10-01 20:49:41 +04:00
|
|
|
|
2002-07-08 11:11:59 +04:00
|
|
|
private:
|
2014-06-26 20:29:06 +04:00
|
|
|
~nsDOMCSSValueList();
|
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
bool mCommaDelimited; // some value lists use a comma
|
2002-07-08 11:11:59 +04:00
|
|
|
// as the delimiter, some just use
|
|
|
|
// spaces.
|
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
bool mReadonly; // Are we read-only?
|
2002-07-08 11:11:59 +04:00
|
|
|
|
2015-10-18 08:24:48 +03:00
|
|
|
InfallibleTArray<RefPtr<CSSValue> > mCSSValues;
|
2002-07-08 11:11:59 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* nsDOMCSSValueList_h___ */
|