Bug 1700051: part 48) Slightly simplify `mozInlineSpellWordUtil::FindRealWordContaini...
[gecko.git] / layout / style / nsICSSDeclaration.h
blob273f53cbafcdcc2477d0d364ba25530fea2ee442
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 /*
8 * interface for accessing style declarations using enums instead of strings,
9 * for internal use
12 #ifndef nsICSSDeclaration_h__
13 #define nsICSSDeclaration_h__
15 /**
16 * This interface provides access to methods analogous to those of
17 * CSSStyleDeclaration; the difference is that these use nsCSSPropertyID
18 * enums for the prop names instead of using strings.
21 #include "mozilla/Attributes.h"
22 #include "nsCSSPropertyID.h"
23 #include "mozilla/dom/CSSValue.h"
24 #include "mozilla/ErrorResult.h"
25 #include "nsWrapperCache.h"
26 #include "nsStringFwd.h"
27 #include "nsCOMPtr.h"
29 class nsINode;
30 class nsIPrincipal;
31 namespace mozilla {
32 class ErrorResult;
34 namespace css {
35 class Rule;
36 } // namespace css
37 namespace dom {
38 class DocGroup;
39 } // namespace dom
40 } // namespace mozilla
42 // dbeabbfa-6cb3-4f5c-aec2-dd558d9d681f
43 #define NS_ICSSDECLARATION_IID \
44 { \
45 0xdbeabbfa, 0x6cb3, 0x4f5c, { \
46 0xae, 0xc2, 0xdd, 0x55, 0x8d, 0x9d, 0x68, 0x1f \
47 } \
50 class nsICSSDeclaration : public nsISupports, public nsWrapperCache {
51 public:
52 NS_DECLARE_STATIC_IID_ACCESSOR(NS_ICSSDECLARATION_IID)
54 virtual nsINode* GetAssociatedNode() const = 0;
55 virtual nsISupports* GetParentObject() const = 0;
57 mozilla::dom::DocGroup* GetDocGroup();
59 NS_IMETHOD GetPropertyValue(const nsACString& aPropName,
60 nsACString& aValue) = 0;
61 virtual void RemoveProperty(const nsACString& aPropertyName,
62 nsACString& aReturn,
63 mozilla::ErrorResult& aRv) = 0;
64 virtual void SetProperty(const nsACString& aPropertyName,
65 const nsACString& aValue,
66 const nsACString& aPriority,
67 nsIPrincipal* aSubjectPrincipal,
68 mozilla::ErrorResult& aRv) = 0;
69 // For C++ callers.
70 void SetProperty(const nsACString& aPropertyName, const nsACString& aValue,
71 const nsACString& aPriority, mozilla::ErrorResult& aRv) {
72 SetProperty(aPropertyName, aValue, aPriority, nullptr, aRv);
75 void Item(uint32_t aIndex, nsACString& aReturn) {
76 bool found;
77 IndexedGetter(aIndex, found, aReturn);
78 if (!found) {
79 aReturn.Truncate();
83 virtual void GetCSSImageURLs(const nsACString& aPropertyName,
84 nsTArray<nsCString>& aImageURLs,
85 mozilla::ErrorResult& aRv) {
86 aRv.Throw(NS_ERROR_NOT_IMPLEMENTED);
89 // WebIDL interface for CSSStyleDeclaration
90 virtual void SetCssText(const nsACString& aString,
91 nsIPrincipal* aSubjectPrincipal,
92 mozilla::ErrorResult& rv) = 0;
93 virtual void GetCssText(nsACString& aString) = 0;
94 virtual uint32_t Length() = 0;
96 // The actual implementation of the Item method and the WebIDL indexed getter
97 virtual void IndexedGetter(uint32_t aIndex, bool& aFound,
98 nsACString& aPropName) = 0;
100 void GetPropertyValue(const nsACString& aPropName, nsACString& aValue,
101 mozilla::ErrorResult& rv) {
102 rv = GetPropertyValue(aPropName, aValue);
104 virtual void GetPropertyPriority(const nsACString& aPropName,
105 nsACString& aPriority) = 0;
106 virtual mozilla::css::Rule* GetParentRule() = 0;
108 protected:
109 bool IsReadOnly();
112 NS_DEFINE_STATIC_IID_ACCESSOR(nsICSSDeclaration, NS_ICSSDECLARATION_IID)
114 #define NS_DECL_NSIDOMCSSSTYLEDECLARATION_HELPER \
115 void GetCssText(nsACString& aCssText) override; \
116 void SetCssText(const nsACString& aCssText, nsIPrincipal* aSubjectPrincipal, \
117 mozilla::ErrorResult& aRv) override; \
118 NS_IMETHOD GetPropertyValue(const nsACString& propertyName, \
119 nsACString& _retval) override; \
120 void RemoveProperty(const nsACString& propertyName, nsACString& _retval, \
121 mozilla::ErrorResult& aRv) override; \
122 void GetPropertyPriority(const nsACString& propertyName, \
123 nsACString& aPriority) override; \
124 void SetProperty(const nsACString& propertyName, const nsACString& value, \
125 const nsACString& priority, \
126 nsIPrincipal* aSubjectPrincipal, mozilla::ErrorResult& aRv) \
127 override; \
128 uint32_t Length() override; \
129 mozilla::css::Rule* GetParentRule() override;
131 #endif // nsICSSDeclaration_h__