Backed out changeset 2450366cf7ca (bug 1891629) for causing win msix mochitest failures
[gecko.git] / dom / html / nsRadioVisitor.h
blob0ec20a25a00626aec0ceff32bcc243fa7116e580
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 _nsRadioVisitor_h__
8 #define _nsRadioVisitor_h__
10 #include "mozilla/Attributes.h"
11 #include "nsIRadioVisitor.h"
13 using mozilla::dom::HTMLInputElement;
15 /**
16 * nsRadioVisitor is the base class implementing nsIRadioVisitor and inherited
17 * by all radio visitors.
19 class nsRadioVisitor : public nsIRadioVisitor {
20 protected:
21 virtual ~nsRadioVisitor() = default;
23 public:
24 nsRadioVisitor() = default;
26 NS_DECL_ISUPPORTS
28 virtual bool Visit(HTMLInputElement* aRadio) override = 0;
31 /**
32 * The following declarations are radio visitors inheriting from nsRadioVisitor.
35 /**
36 * nsRadioSetCheckedChangedVisitor is calling SetCheckedChanged with the given
37 * parameter to all radio elements in the group.
39 class nsRadioSetCheckedChangedVisitor : public nsRadioVisitor {
40 public:
41 explicit nsRadioSetCheckedChangedVisitor(bool aCheckedChanged)
42 : mCheckedChanged(aCheckedChanged) {}
44 virtual bool Visit(HTMLInputElement* aRadio) override;
46 protected:
47 bool mCheckedChanged;
50 /**
51 * nsRadioGetCheckedChangedVisitor is getting the current checked changed value.
52 * Getting it from one radio element is the group is enough given that all
53 * elements should have the same value.
55 class nsRadioGetCheckedChangedVisitor : public nsRadioVisitor {
56 public:
57 nsRadioGetCheckedChangedVisitor(bool* aCheckedChanged,
58 HTMLInputElement* aExcludeElement)
59 : mCheckedChanged(aCheckedChanged), mExcludeElement(aExcludeElement) {}
61 virtual bool Visit(HTMLInputElement* aRadio) override;
63 protected:
64 bool* mCheckedChanged;
65 HTMLInputElement* mExcludeElement;
68 /**
69 * nsRadioSetValueMissingState is calling SetValueMissingState with the given
70 * parameter to all radio elements in the group.
71 * It is also calling ContentStatesChanged if needed.
73 class nsRadioSetValueMissingState : public nsRadioVisitor {
74 public:
75 nsRadioSetValueMissingState(HTMLInputElement* aExcludeElement, bool aValidity)
76 : mExcludeElement(aExcludeElement), mValidity(aValidity) {}
78 virtual bool Visit(HTMLInputElement* aRadio) override;
80 protected:
81 HTMLInputElement* mExcludeElement;
82 bool mValidity;
85 class nsRadioUpdateStateVisitor : public nsRadioVisitor {
86 public:
87 explicit nsRadioUpdateStateVisitor(HTMLInputElement* aExcludeElement)
88 : mExcludeElement(aExcludeElement) {}
90 virtual bool Visit(HTMLInputElement* aRadio) override;
92 protected:
93 HTMLInputElement* mExcludeElement;
96 #endif // _nsRadioVisitor_h__