Coverage Report

Created: 2018-09-25 14:53

/work/obj-fuzz/dist/include/mozilla/dom/HTMLMeterElement.h
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
#ifndef mozilla_dom_HTMLMeterElement_h
8
#define mozilla_dom_HTMLMeterElement_h
9
10
#include "mozilla/Attributes.h"
11
#include "nsGenericHTMLElement.h"
12
#include "nsAttrValue.h"
13
#include "nsAttrValueInlines.h"
14
#include "nsAlgorithm.h"
15
#include <algorithm>
16
17
namespace mozilla {
18
namespace dom {
19
20
class HTMLMeterElement final : public nsGenericHTMLElement
21
{
22
public:
23
  explicit HTMLMeterElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
24
25
  virtual EventStates IntrinsicState() const override;
26
27
  nsresult Clone(dom::NodeInfo*, nsINode** aResult) const override;
28
29
  virtual bool ParseAttribute(int32_t aNamespaceID, nsAtom* aAttribute,
30
                              const nsAString& aValue,
31
                              nsIPrincipal* aMaybeScriptedPrincipal,
32
                              nsAttrValue& aResult) override;
33
34
  // WebIDL
35
36
  /* @return the value */
37
  double Value() const;
38
  void SetValue(double aValue, ErrorResult& aRv)
39
0
  {
40
0
    SetDoubleAttr(nsGkAtoms::value, aValue, aRv);
41
0
  }
42
43
  /* @return the minimum value */
44
  double Min() const;
45
  void SetMin(double aValue, ErrorResult& aRv)
46
0
  {
47
0
    SetDoubleAttr(nsGkAtoms::min, aValue, aRv);
48
0
  }
49
50
  /* @return the maximum value */
51
  double Max() const;
52
  void SetMax(double aValue, ErrorResult& aRv)
53
0
  {
54
0
    SetDoubleAttr(nsGkAtoms::max, aValue, aRv);
55
0
  }
56
57
  /* @return the low value */
58
  double Low() const;
59
  void SetLow(double aValue, ErrorResult& aRv)
60
0
  {
61
0
    SetDoubleAttr(nsGkAtoms::low, aValue, aRv);
62
0
  }
63
64
  /* @return the high value */
65
  double High() const;
66
  void SetHigh(double aValue, ErrorResult& aRv)
67
0
  {
68
0
    SetDoubleAttr(nsGkAtoms::high, aValue, aRv);
69
0
  }
70
71
  /* @return the optimum value */
72
  double Optimum() const;
73
  void SetOptimum(double aValue, ErrorResult& aRv)
74
0
  {
75
0
    SetDoubleAttr(nsGkAtoms::optimum, aValue, aRv);
76
0
  }
77
78
protected:
79
  virtual ~HTMLMeterElement();
80
81
  virtual JSObject* WrapNode(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
82
83
private:
84
85
  static const double kDefaultValue;
86
  static const double kDefaultMin;
87
  static const double kDefaultMax;
88
89
  /**
90
   * Returns the optimum state of the element.
91
   * NS_EVENT_STATE_OPTIMUM if the actual value is in the optimum region.
92
   * NS_EVENT_STATE_SUB_OPTIMUM if the actual value is in the sub-optimal region.
93
   * NS_EVENT_STATE_SUB_SUB_OPTIMUM if the actual value is in the sub-sub-optimal region.
94
   *
95
   * @return the optimum state of the element.
96
   */
97
  EventStates GetOptimumState() const;
98
};
99
100
} // namespace dom
101
} // namespace mozilla
102
103
#endif // mozilla_dom_HTMLMeterElement_h