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/. */ 6 7 #include "nsRadioVisitor.h" 8 #include "mozilla/dom/HTMLInputElement.h" 9 #include "nsIConstraintValidation.h" 10 11 using namespace mozilla::dom; 12 NS_IMPL_ISUPPORTS(nsRadioVisitor,nsIRadioVisitor)13NS_IMPL_ISUPPORTS(nsRadioVisitor, nsIRadioVisitor) 14 15 bool nsRadioSetCheckedChangedVisitor::Visit(HTMLInputElement* aRadio) { 16 NS_ASSERTION(aRadio, "Visit() passed a null button!"); 17 aRadio->SetCheckedChangedInternal(mCheckedChanged); 18 return true; 19 } 20 Visit(HTMLInputElement * aRadio)21bool nsRadioGetCheckedChangedVisitor::Visit(HTMLInputElement* aRadio) { 22 if (aRadio == mExcludeElement) { 23 return true; 24 } 25 26 NS_ASSERTION(aRadio, "Visit() passed a null button!"); 27 *mCheckedChanged = aRadio->GetCheckedChanged(); 28 return false; 29 } 30 Visit(HTMLInputElement * aRadio)31bool nsRadioSetValueMissingState::Visit(HTMLInputElement* aRadio) { 32 if (aRadio == mExcludeElement) { 33 return true; 34 } 35 36 aRadio->SetValidityState( 37 nsIConstraintValidation::VALIDITY_STATE_VALUE_MISSING, mValidity); 38 aRadio->UpdateState(true); 39 return true; 40 } 41 Visit(HTMLInputElement * aRadio)42bool nsRadioUpdateStateVisitor::Visit(HTMLInputElement* aRadio) { 43 if (aRadio == mExcludeElement) { 44 return true; 45 } 46 47 aRadio->UpdateState(true); 48 return true; 49 } 50