Bug 1560374 - Set testharness and reftest web-platform-tests to Tier-1; r=jmaher...
[gecko.git] / dom / html / nsRadioVisitor.h
blob0e74871c817ebd1b4b486ab15c90c68ec0460e46
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 class nsIFormControl;
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() {}
23 public:
24 nsRadioVisitor() {}
26 NS_DECL_ISUPPORTS
28 virtual bool Visit(nsIFormControl* 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(nsIFormControl* 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 nsIFormControl* aExcludeElement)
59 : mCheckedChanged(aCheckedChanged), mExcludeElement(aExcludeElement) {}
61 virtual bool Visit(nsIFormControl* aRadio) override;
63 protected:
64 bool* mCheckedChanged;
65 nsIFormControl* 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(nsIFormControl* aExcludeElement, bool aValidity,
76 bool aNotify)
77 : mExcludeElement(aExcludeElement),
78 mValidity(aValidity),
79 mNotify(aNotify) {}
81 virtual bool Visit(nsIFormControl* aRadio) override;
83 protected:
84 nsIFormControl* mExcludeElement;
85 bool mValidity;
86 bool mNotify;
89 class nsRadioUpdateStateVisitor : public nsRadioVisitor {
90 public:
91 explicit nsRadioUpdateStateVisitor(nsIFormControl* aExcludeElement)
92 : mExcludeElement(aExcludeElement) {}
94 virtual bool Visit(nsIFormControl* aRadio) override;
96 protected:
97 nsIFormControl* mExcludeElement;
100 #endif // _nsRadioVisitor_h__