2001-09-25 01:32:19 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
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/. */
|
2006-03-25 05:47:31 +00:00
|
|
|
|
2011-03-17 17:41:52 +00:00
|
|
|
/* class for CSS @import rules */
|
2006-03-25 05:47:31 +00:00
|
|
|
|
2011-03-17 17:41:52 +00:00
|
|
|
#ifndef mozilla_css_ImportRule_h__
|
|
|
|
#define mozilla_css_ImportRule_h__
|
1999-06-10 05:32:38 +00:00
|
|
|
|
2011-11-21 06:21:16 +00:00
|
|
|
#include "mozilla/Attributes.h"
|
|
|
|
|
2013-06-23 12:03:39 +00:00
|
|
|
#include "mozilla/MemoryReporting.h"
|
2011-04-08 01:23:46 +00:00
|
|
|
#include "mozilla/css/Rule.h"
|
2011-03-17 17:41:52 +00:00
|
|
|
#include "nsIDOMCSSImportRule.h"
|
1999-06-10 05:32:38 +00:00
|
|
|
|
2005-03-30 00:36:57 +00:00
|
|
|
class nsMediaList;
|
2010-05-20 02:28:00 +00:00
|
|
|
class nsString;
|
1999-06-10 05:32:38 +00:00
|
|
|
|
2011-03-17 17:41:52 +00:00
|
|
|
namespace mozilla {
|
2014-06-20 10:32:49 +00:00
|
|
|
|
|
|
|
class CSSStyleSheet;
|
2017-01-13 15:41:03 +00:00
|
|
|
class StyleSheet;
|
2014-06-20 10:32:49 +00:00
|
|
|
|
2016-11-09 06:28:24 +00:00
|
|
|
namespace dom {
|
|
|
|
class MediaList;
|
|
|
|
}
|
|
|
|
|
2011-03-17 17:41:52 +00:00
|
|
|
namespace css {
|
2010-05-20 02:28:00 +00:00
|
|
|
|
2015-03-21 16:28:04 +00:00
|
|
|
class ImportRule final : public Rule,
|
2015-03-27 18:52:19 +00:00
|
|
|
public nsIDOMCSSImportRule
|
2011-03-17 17:41:52 +00:00
|
|
|
{
|
|
|
|
public:
|
2014-07-14 22:57:54 +00:00
|
|
|
ImportRule(nsMediaList* aMedia, const nsString& aURLSpec,
|
|
|
|
uint32_t aLineNumber, uint32_t aColumnNumber);
|
2011-03-17 17:41:52 +00:00
|
|
|
private:
|
|
|
|
// for |Clone|
|
|
|
|
ImportRule(const ImportRule& aCopy);
|
|
|
|
~ImportRule();
|
1999-06-10 05:32:38 +00:00
|
|
|
public:
|
2016-11-30 23:18:14 +00:00
|
|
|
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(ImportRule, Rule)
|
|
|
|
NS_DECL_ISUPPORTS_INHERITED
|
|
|
|
virtual bool IsCCLeaf() const override;
|
2017-01-15 19:50:10 +00:00
|
|
|
|
2011-03-07 03:59:03 +00:00
|
|
|
using Rule::GetStyleSheet; // unhide since nsIDOMCSSImportRule has its own GetStyleSheet
|
2010-08-08 05:30:57 +00:00
|
|
|
|
2015-11-05 08:44:10 +00:00
|
|
|
// Rule methods
|
2011-03-17 17:41:52 +00:00
|
|
|
#ifdef DEBUG
|
2015-03-21 16:28:04 +00:00
|
|
|
virtual void List(FILE* out = stdout, int32_t aIndent = 0) const override;
|
2011-03-17 17:41:52 +00:00
|
|
|
#endif
|
2015-03-21 16:28:04 +00:00
|
|
|
virtual int32_t GetType() const override;
|
2017-01-13 15:41:02 +00:00
|
|
|
using Rule::GetType;
|
2015-03-21 16:28:04 +00:00
|
|
|
virtual already_AddRefed<Rule> Clone() const override;
|
2011-03-17 17:41:52 +00:00
|
|
|
|
2014-06-20 10:32:49 +00:00
|
|
|
void SetSheet(CSSStyleSheet*);
|
1999-06-10 05:32:38 +00:00
|
|
|
|
2015-03-21 16:28:04 +00:00
|
|
|
virtual size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const override;
|
2012-01-03 02:19:14 +00:00
|
|
|
|
2017-01-13 15:41:02 +00:00
|
|
|
virtual JSObject* WrapObject(JSContext* aCx,
|
|
|
|
JS::Handle<JSObject*> aGivenProto) override;
|
|
|
|
|
2011-03-17 17:41:52 +00:00
|
|
|
// nsIDOMCSSImportRule interface
|
|
|
|
NS_DECL_NSIDOMCSSIMPORTRULE
|
2001-08-04 21:19:53 +00:00
|
|
|
|
2017-01-13 15:41:02 +00:00
|
|
|
// WebIDL interface
|
|
|
|
uint16_t Type() const override;
|
|
|
|
void GetCssTextImpl(nsAString& aCssText) const override;
|
2017-01-13 15:41:03 +00:00
|
|
|
// The XPCOM GetHref is fine, since it never fails.
|
2016-11-09 06:28:24 +00:00
|
|
|
dom::MediaList* Media() const;
|
2017-01-13 15:41:03 +00:00
|
|
|
StyleSheet* GetStyleSheet() const;
|
2017-01-13 15:41:02 +00:00
|
|
|
|
2011-03-17 17:41:52 +00:00
|
|
|
private:
|
|
|
|
nsString mURLSpec;
|
2015-10-18 05:24:48 +00:00
|
|
|
RefPtr<nsMediaList> mMedia;
|
|
|
|
RefPtr<CSSStyleSheet> mChildSheet;
|
1999-06-10 05:32:38 +00:00
|
|
|
};
|
|
|
|
|
2011-03-17 17:41:52 +00:00
|
|
|
} // namespace css
|
|
|
|
} // namespace mozilla
|
2005-11-11 14:36:26 +00:00
|
|
|
|
2011-03-17 17:41:52 +00:00
|
|
|
#endif /* mozilla_css_ImportRule_h__ */
|