Bug 1890277: part 2) Add `require-trusted-types-for` directive to CSP parser, guarded...
[gecko.git] / dom / base / RadioGroupContainer.h
blob6331c71dd9b698f1a4524c478a812f1f6df02949
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_nsRadioGroupStruct_h
8 #define mozilla_dom_nsRadioGroupStruct_h
10 #include "nsClassHashtable.h"
12 class nsIContent;
13 class nsIRadioVisitor;
15 namespace mozilla::dom {
17 class HTMLInputElement;
18 struct nsRadioGroupStruct;
20 class RadioGroupContainer final {
21 public:
22 RadioGroupContainer();
23 ~RadioGroupContainer();
25 static void Traverse(RadioGroupContainer* tmp,
26 nsCycleCollectionTraversalCallback& cb);
27 size_t SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const;
29 NS_IMETHOD WalkRadioGroup(const nsAString& aName, nsIRadioVisitor* aVisitor);
30 void SetCurrentRadioButton(const nsAString& aName, HTMLInputElement* aRadio);
31 HTMLInputElement* GetCurrentRadioButton(const nsAString& aName);
32 nsresult GetNextRadioButton(const nsAString& aName, const bool aPrevious,
33 HTMLInputElement* aFocusedRadio,
34 HTMLInputElement** aRadioOut);
35 HTMLInputElement* GetFirstRadioButton(const nsAString& aName);
36 void AddToRadioGroup(const nsAString& aName, HTMLInputElement* aRadio,
37 nsIContent* aAncestor);
38 void RemoveFromRadioGroup(const nsAString& aName, HTMLInputElement* aRadio);
39 uint32_t GetRequiredRadioCount(const nsAString& aName) const;
40 void RadioRequiredWillChange(const nsAString& aName, bool aRequiredAdded);
41 bool GetValueMissingState(const nsAString& aName) const;
42 void SetValueMissingState(const nsAString& aName, bool aValue);
44 // for radio group
45 nsRadioGroupStruct* GetRadioGroup(const nsAString& aName) const;
46 nsRadioGroupStruct* GetOrCreateRadioGroup(const nsAString& aName);
48 private:
49 nsClassHashtable<nsStringHashKey, nsRadioGroupStruct> mRadioGroups;
52 } // namespace mozilla::dom
54 #endif // mozilla_dom_nsRadioGroupStruct_h