Line data Source code
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/dom/CSSImportRule.h"
15 :
16 : class nsMediaList;
17 : class nsString;
18 :
19 : namespace mozilla {
20 :
21 : class CSSStyleSheet;
22 : class StyleSheet;
23 :
24 : namespace dom {
25 : class MediaList;
26 : }
27 :
28 : namespace css {
29 :
30 : class ImportRule final : public dom::CSSImportRule
31 : {
32 : public:
33 : ImportRule(nsMediaList* aMedia, const nsString& aURLSpec,
34 : uint32_t aLineNumber, uint32_t aColumnNumber);
35 : private:
36 : // for |Clone|
37 : ImportRule(const ImportRule& aCopy);
38 : ~ImportRule();
39 : public:
40 3 : NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(ImportRule, Rule)
41 : NS_DECL_ISUPPORTS_INHERITED
42 :
43 : // unhide since nsIDOMCSSImportRule has its own GetStyleSheet and GetMedia
44 : using dom::CSSImportRule::GetStyleSheet;
45 : using dom::CSSImportRule::GetMedia;
46 :
47 : // Rule methods
48 : #ifdef DEBUG
49 : virtual void List(FILE* out = stdout, int32_t aIndent = 0) const override;
50 : #endif
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 : // nsIDOMCSSImportRule interface
58 : NS_IMETHOD GetHref(nsAString& aHref) final;
59 :
60 : // WebIDL interface
61 : void GetCssTextImpl(nsAString& aCssText) const override;
62 : dom::MediaList* GetMedia() const final;
63 : StyleSheet* GetStyleSheet() const final;
64 :
65 : private:
66 : nsString mURLSpec;
67 : RefPtr<nsMediaList> mMedia;
68 : RefPtr<CSSStyleSheet> mChildSheet;
69 : };
70 :
71 : } // namespace css
72 : } // namespace mozilla
73 :
74 : #endif /* mozilla_css_ImportRule_h__ */
|