Coverage Report

Created: 2018-09-25 14:53

/src/mozilla-central/dom/html/nsRadioVisitor.cpp
Line
Count
Source (jump to first uncovered line)
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
13
NS_IMPL_ISUPPORTS(nsRadioVisitor, nsIRadioVisitor)
14
15
bool
16
nsRadioSetCheckedChangedVisitor::Visit(nsIFormControl* aRadio)
17
0
{
18
0
  RefPtr<HTMLInputElement> radio =
19
0
    static_cast<HTMLInputElement*>(aRadio);
20
0
  NS_ASSERTION(radio, "Visit() passed a null button!");
21
0
22
0
  radio->SetCheckedChangedInternal(mCheckedChanged);
23
0
  return true;
24
0
}
25
26
bool
27
nsRadioGetCheckedChangedVisitor::Visit(nsIFormControl* aRadio)
28
0
{
29
0
  if (aRadio == mExcludeElement) {
30
0
    return true;
31
0
  }
32
0
33
0
  RefPtr<HTMLInputElement> radio =
34
0
    static_cast<HTMLInputElement*>(aRadio);
35
0
  NS_ASSERTION(radio, "Visit() passed a null button!");
36
0
37
0
  *mCheckedChanged = radio->GetCheckedChanged();
38
0
  return false;
39
0
}
40
41
bool
42
nsRadioSetValueMissingState::Visit(nsIFormControl* aRadio)
43
0
{
44
0
  if (aRadio == mExcludeElement) {
45
0
    return true;
46
0
  }
47
0
48
0
  HTMLInputElement* input = static_cast<HTMLInputElement*>(aRadio);
49
0
50
0
  input->SetValidityState(nsIConstraintValidation::VALIDITY_STATE_VALUE_MISSING,
51
0
                          mValidity);
52
0
53
0
  input->UpdateState(true);
54
0
55
0
  return true;
56
0
}
57
58
bool
59
nsRadioUpdateStateVisitor::Visit(nsIFormControl* aRadio)
60
0
{
61
0
  if (aRadio == mExcludeElement) {
62
0
    return true;
63
0
  }
64
0
65
0
  HTMLInputElement* input = static_cast<HTMLInputElement*>(aRadio);
66
0
  input->UpdateState(true);
67
0
68
0
  return true;
69
0
}