Bug 1550804 - Add color scheme simulation to the inspector. r=pbro
[gecko.git] / layout / style / BindingStyleRule.h
blob46041c908fdb94c9cd8eec580b12433ea9980e9b
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/. */
7 #ifndef mozilla_BindingStyleRule_h__
8 #define mozilla_BindingStyleRule_h__
10 #include "nscore.h"
11 #include "nsString.h"
12 #include "mozilla/css/Rule.h"
13 #include "mozilla/NotNull.h"
15 /**
16 * Shared superclass for mozilla::css::StyleRule and mozilla::ServoStyleRule,
17 * for use from bindings code.
20 class nsICSSDeclaration;
22 namespace mozilla {
23 class DeclarationBlock;
24 namespace dom {
25 class Element;
28 class BindingStyleRule : public css::Rule {
29 protected:
30 BindingStyleRule(StyleSheet* aSheet, css::Rule* aParentRule,
31 uint32_t aLineNumber, uint32_t aColumnNumber)
32 : css::Rule(aSheet, aParentRule, aLineNumber, aColumnNumber) {}
33 BindingStyleRule(const BindingStyleRule& aCopy) : css::Rule(aCopy) {}
34 virtual ~BindingStyleRule() {}
36 public:
37 // This is pure virtual because we have no members, and are an abstract class
38 // to start with. The fact that we have to have this declaration at all is
39 // kinda dumb. :(
40 virtual size_t SizeOfIncludingThis(
41 mozilla::MallocSizeOf aMallocSizeOf) const override MOZ_MUST_OVERRIDE = 0;
43 // Likewise for this one. We have to override our superclass, but don't
44 // really need to do anything in this method.
45 virtual bool IsCCLeaf() const override MOZ_MUST_OVERRIDE = 0;
47 virtual uint32_t GetSelectorCount() = 0;
48 virtual nsresult GetSelectorText(uint32_t aSelectorIndex,
49 nsAString& aText) = 0;
50 virtual nsresult GetSpecificity(uint32_t aSelectorIndex,
51 uint64_t* aSpecificity) = 0;
52 virtual nsresult SelectorMatchesElement(dom::Element* aElement,
53 uint32_t aSelectorIndex,
54 const nsAString& aPseudo,
55 bool aRelevantLinkVisited,
56 bool* aMatches) = 0;
57 virtual NotNull<DeclarationBlock*> GetDeclarationBlock() const = 0;
59 // WebIDL API
60 virtual void GetSelectorText(nsAString& aSelectorText) = 0;
61 virtual void SetSelectorText(const nsAString& aSelectorText) = 0;
62 virtual nsICSSDeclaration* Style() = 0;
64 virtual JSObject* WrapObject(JSContext* aCx,
65 JS::Handle<JSObject*> aGivenProto) override;
68 } // namespace mozilla
70 #endif // mozilla_BindingStyleRule_h__