2017-10-27 17:33:53 +00: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 11:12:37 +00: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-07-09 06:19:27 +00:00
|
|
|
|
2014-06-10 02:11:00 +00:00
|
|
|
#ifndef mozilla_dom_CSSRuleList_h
|
|
|
|
#define mozilla_dom_CSSRuleList_h
|
2007-07-09 06:19:27 +00:00
|
|
|
|
2016-09-26 12:03:25 +00:00
|
|
|
#include "mozilla/StyleSheetInlines.h"
|
2017-01-13 15:41:03 +00:00
|
|
|
#include "mozilla/css/Rule.h"
|
2013-07-24 07:27:17 +00:00
|
|
|
#include "nsIDOMCSSRule.h"
|
2008-10-22 14:31:14 +00:00
|
|
|
#include "nsIDOMCSSRuleList.h"
|
2014-05-03 07:32:54 +00:00
|
|
|
#include "nsWrapperCache.h"
|
|
|
|
|
2014-06-20 11:00:08 +00:00
|
|
|
namespace mozilla {
|
2014-06-10 02:11:00 +00:00
|
|
|
namespace dom {
|
|
|
|
|
|
|
|
// IID for the CSSRuleList interface
|
2008-10-22 14:31:14 +00:00
|
|
|
#define NS_ICSSRULELIST_IID \
|
2014-05-03 07:32:54 +00:00
|
|
|
{ 0x56ac8d1c, 0xc1ed, 0x45fe, \
|
|
|
|
{ 0x9a, 0x4d, 0x3a, 0xdc, 0xf9, 0xd1, 0xb9, 0x3f } }
|
2008-10-22 14:31:14 +00:00
|
|
|
|
2014-06-10 02:11:00 +00:00
|
|
|
class CSSRuleList : public nsIDOMCSSRuleList
|
|
|
|
, public nsWrapperCache
|
2007-07-09 06:19:27 +00:00
|
|
|
{
|
2008-10-22 14:31:14 +00:00
|
|
|
public:
|
|
|
|
NS_DECLARE_STATIC_IID_ACCESSOR(NS_ICSSRULELIST_IID)
|
|
|
|
|
2014-05-03 07:32:54 +00:00
|
|
|
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
2014-06-10 02:11:00 +00:00
|
|
|
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(CSSRuleList)
|
2014-05-03 07:32:54 +00:00
|
|
|
|
2016-11-22 23:26:20 +00:00
|
|
|
virtual StyleSheet* GetParentObject() = 0;
|
2015-03-21 16:28:04 +00:00
|
|
|
virtual JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override final;
|
2014-05-03 07:32:54 +00:00
|
|
|
|
2013-07-24 07:27:17 +00:00
|
|
|
NS_IMETHOD
|
2015-03-21 16:28:04 +00:00
|
|
|
GetLength(uint32_t* aLength) override final
|
2013-07-24 07:27:17 +00:00
|
|
|
{
|
|
|
|
*aLength = Length();
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
NS_IMETHOD
|
2015-03-21 16:28:04 +00:00
|
|
|
Item(uint32_t aIndex, nsIDOMCSSRule** aReturn) override final
|
2013-07-24 07:27:17 +00:00
|
|
|
{
|
|
|
|
NS_IF_ADDREF(*aReturn = Item(aIndex));
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
// WebIDL API
|
2017-01-13 15:41:03 +00:00
|
|
|
css::Rule* Item(uint32_t aIndex)
|
2013-07-24 07:27:17 +00:00
|
|
|
{
|
|
|
|
bool unused;
|
|
|
|
return IndexedGetter(aIndex, unused);
|
|
|
|
}
|
|
|
|
|
2017-01-13 15:41:03 +00:00
|
|
|
virtual css::Rule* IndexedGetter(uint32_t aIndex, bool& aFound) = 0;
|
2013-07-24 07:27:17 +00:00
|
|
|
virtual uint32_t Length() = 0;
|
2014-06-23 22:40:01 +00:00
|
|
|
|
|
|
|
protected:
|
|
|
|
virtual ~CSSRuleList() {}
|
2007-07-09 06:19:27 +00:00
|
|
|
};
|
2008-10-22 14:31:14 +00:00
|
|
|
|
2014-06-10 02:11:00 +00:00
|
|
|
NS_DEFINE_STATIC_IID_ACCESSOR(CSSRuleList, NS_ICSSRULELIST_IID)
|
|
|
|
|
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|
2008-10-22 14:31:14 +00:00
|
|
|
|
2014-06-10 02:11:00 +00:00
|
|
|
#endif /* mozilla_dom_CSSRuleList_h */
|