1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 /* This Source Code Form is subject to the terms of the Mozilla Public 3 * License, v. 2.0. If a copy of the MPL was not distributed with this 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 5 6 /* class for CSS @import rules */ 7 8 #ifndef mozilla_css_ImportRule_h__ 9 #define mozilla_css_ImportRule_h__ 10 11 #include "mozilla/Attributes.h" 12 13 #include "mozilla/MemoryReporting.h" 14 #include "mozilla/css/Rule.h" 15 #include "nsIDOMCSSImportRule.h" 16 17 class nsMediaList; 18 class nsString; 19 20 namespace mozilla { 21 22 class CSSStyleSheet; 23 24 namespace css { 25 26 class ImportRule final : public Rule, 27 public nsIDOMCSSImportRule 28 { 29 public: 30 ImportRule(nsMediaList* aMedia, const nsString& aURLSpec, 31 uint32_t aLineNumber, uint32_t aColumnNumber); 32 private: 33 // for |Clone| 34 ImportRule(const ImportRule& aCopy); 35 ~ImportRule(); 36 public: 37 NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(ImportRule, mozilla::css::Rule) 38 NS_DECL_CYCLE_COLLECTING_ISUPPORTS 39 40 DECL_STYLE_RULE_INHERIT 41 42 #ifdef HAVE_CPP_AMBIGUITY_RESOLVING_USING 43 using Rule::GetStyleSheet; // unhide since nsIDOMCSSImportRule has its own GetStyleSheet 44 #endif 45 46 // Rule methods 47 #ifdef DEBUG 48 virtual void List(FILE* out = stdout, int32_t aIndent = 0) const override; 49 #endif 50 virtual int32_t GetType() const override; 51 virtual already_AddRefed<Rule> Clone() const override; 52 53 void SetSheet(CSSStyleSheet*); 54 55 virtual size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const override; 56 57 // nsIDOMCSSRule interface 58 NS_DECL_NSIDOMCSSRULE 59 60 // nsIDOMCSSImportRule interface 61 NS_DECL_NSIDOMCSSIMPORTRULE 62 63 private: 64 nsString mURLSpec; 65 RefPtr<nsMediaList> mMedia; 66 RefPtr<CSSStyleSheet> mChildSheet; 67 }; 68 69 } // namespace css 70 } // namespace mozilla 71 72 #endif /* mozilla_css_ImportRule_h__ */ 73