Bug 1880558: Allow PnP windows to enter macOS native fullscreen. r=pip-reviewers...
[gecko.git] / dom / html / CustomStateSet.h
blob095974b5f4d3eefd455d7460733ded2b34319e58
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_dom_CustomStateSet_h
8 #define mozilla_dom_CustomStateSet_h
10 #include "js/TypeDecls.h"
11 #include "mozilla/ErrorResult.h"
13 #include "nsCycleCollectionParticipant.h"
14 #include "nsWrapperCache.h"
15 #include "nsCOMPtr.h"
17 namespace mozilla::dom {
19 class HTMLElement;
20 class GlobalObject;
22 class CustomStateSet final : public nsISupports, public nsWrapperCache {
23 public:
24 NS_DECL_CYCLE_COLLECTING_ISUPPORTS
25 NS_DECL_CYCLE_COLLECTION_WRAPPERCACHE_CLASS(CustomStateSet)
27 explicit CustomStateSet(HTMLElement* aTarget);
29 // WebIDL interface
30 nsISupports* GetParentObject() const;
32 JSObject* WrapObject(JSContext* aCx,
33 JS::Handle<JSObject*> aGivenProto) override;
35 static MOZ_CAN_RUN_SCRIPT_BOUNDARY already_AddRefed<CustomStateSet>
36 Constructor(const GlobalObject& aGlobal, ErrorResult& aRv);
38 void InvalidateStyleFromCustomStateSetChange() const;
40 MOZ_CAN_RUN_SCRIPT void Clear(ErrorResult& aRv);
42 /**
43 * @brief Removes a given string from the state set.
45 MOZ_CAN_RUN_SCRIPT bool Delete(const nsAString& aState, ErrorResult& aRv);
47 /**
48 * @brief Adds a string to this state set.
50 MOZ_CAN_RUN_SCRIPT void Add(const nsAString& aState, ErrorResult& aRv);
52 private:
53 virtual ~CustomStateSet() = default;
55 RefPtr<HTMLElement> mTarget;
58 } // namespace mozilla::dom
60 #endif // mozilla_dom_CustomStateSet_h