/work/obj-fuzz/dist/include/mozilla/BindingStyleRule.h
Line | Count | Source (jump to first uncovered line) |
1 | | /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
2 | | /* vim: set ts=8 sts=2 et sw=2 tw=80: */ |
3 | | /* This Source Code Form is subject to the terms of the Mozilla Public |
4 | | * License, v. 2.0. If a copy of the MPL was not distributed with this |
5 | | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
6 | | |
7 | | #ifndef mozilla_BindingStyleRule_h__ |
8 | | #define mozilla_BindingStyleRule_h__ |
9 | | |
10 | | #include "nscore.h" |
11 | | #include "nsString.h" |
12 | | #include "mozilla/css/Rule.h" |
13 | | #include "mozilla/NotNull.h" |
14 | | |
15 | | /** |
16 | | * Shared superclass for mozilla::css::StyleRule and mozilla::ServoStyleRule, |
17 | | * for use from bindings code. |
18 | | */ |
19 | | |
20 | | class nsICSSDeclaration; |
21 | | |
22 | | namespace mozilla { |
23 | | class DeclarationBlock; |
24 | | namespace dom { |
25 | | class Element; |
26 | | } |
27 | | |
28 | | class BindingStyleRule : public css::Rule |
29 | | { |
30 | | protected: |
31 | | BindingStyleRule(StyleSheet* aSheet, |
32 | | css::Rule* aParentRule, |
33 | | uint32_t aLineNumber, |
34 | | uint32_t aColumnNumber) |
35 | | : css::Rule(aSheet, aParentRule, aLineNumber, aColumnNumber) |
36 | 0 | { |
37 | 0 | } |
38 | | BindingStyleRule(const BindingStyleRule& aCopy) |
39 | | : css::Rule(aCopy) |
40 | 0 | { |
41 | 0 | } |
42 | 0 | virtual ~BindingStyleRule() {} |
43 | | |
44 | | public: |
45 | | // This is pure virtual because we have no members, and are an abstract class |
46 | | // to start with. The fact that we have to have this declaration at all is |
47 | | // kinda dumb. :( |
48 | | virtual size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) |
49 | | const override MOZ_MUST_OVERRIDE = 0; |
50 | | |
51 | | // Likewise for this one. We have to override our superclass, but don't |
52 | | // really need to do anything in this method. |
53 | | virtual bool IsCCLeaf() const override MOZ_MUST_OVERRIDE = 0; |
54 | | |
55 | | virtual uint32_t GetSelectorCount() = 0; |
56 | | virtual nsresult GetSelectorText(uint32_t aSelectorIndex, nsAString& aText) = 0; |
57 | | virtual nsresult GetSpecificity(uint32_t aSelectorIndex, |
58 | | uint64_t* aSpecificity) = 0; |
59 | | virtual nsresult SelectorMatchesElement(dom::Element* aElement, |
60 | | uint32_t aSelectorIndex, |
61 | | const nsAString& aPseudo, |
62 | | bool* aMatches) = 0; |
63 | | virtual NotNull<DeclarationBlock*> GetDeclarationBlock() const = 0; |
64 | | |
65 | | // WebIDL API |
66 | | virtual void GetSelectorText(nsAString& aSelectorText) = 0; |
67 | | virtual void SetSelectorText(const nsAString& aSelectorText) = 0; |
68 | | virtual nsICSSDeclaration* Style() = 0; |
69 | | |
70 | | virtual JSObject* WrapObject(JSContext* aCx, |
71 | | JS::Handle<JSObject*> aGivenProto) override; |
72 | | }; |
73 | | |
74 | | } // namespace mozilla |
75 | | |
76 | | #endif // mozilla_BindingStyleRule_h__ |