Line data Source code
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_HTMLProgressElement_h
8 : #define mozilla_dom_HTMLProgressElement_h
9 :
10 : #include "mozilla/Attributes.h"
11 : #include "nsGenericHTMLElement.h"
12 : #include "nsAttrValue.h"
13 : #include "nsAttrValueInlines.h"
14 : #include <algorithm>
15 :
16 : namespace mozilla {
17 : namespace dom {
18 :
19 : class HTMLProgressElement final : public nsGenericHTMLElement
20 : {
21 : public:
22 : explicit HTMLProgressElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo);
23 :
24 : EventStates IntrinsicState() const override;
25 :
26 : nsresult Clone(mozilla::dom::NodeInfo* aNodeInfo, nsINode** aResult,
27 : bool aPreallocateChildren) const override;
28 :
29 : bool ParseAttribute(int32_t aNamespaceID, nsIAtom* aAttribute,
30 : const nsAString& aValue, nsAttrValue& aResult) override;
31 :
32 : // WebIDL
33 : double Value() const;
34 0 : void SetValue(double aValue, ErrorResult& aRv)
35 : {
36 0 : SetDoubleAttr(nsGkAtoms::value, aValue, aRv);
37 0 : }
38 : double Max() const;
39 0 : void SetMax(double aValue, ErrorResult& aRv)
40 : {
41 0 : SetDoubleAttr(nsGkAtoms::max, aValue, aRv);
42 0 : }
43 : double Position() const;
44 :
45 : protected:
46 : virtual ~HTMLProgressElement();
47 :
48 : virtual JSObject* WrapNode(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
49 :
50 : protected:
51 : /**
52 : * Returns whethem the progress element is in the indeterminate state.
53 : * A progress element is in the indeterminate state if its value is ommited
54 : * or is not a floating point number..
55 : *
56 : * @return whether the progress element is in the indeterminate state.
57 : */
58 : bool IsIndeterminate() const;
59 :
60 : static const double kIndeterminatePosition;
61 : static const double kDefaultValue;
62 : static const double kDefaultMax;
63 : };
64 :
65 : } // namespace dom
66 : } // namespace mozilla
67 :
68 : #endif // mozilla_dom_HTMLProgressElement_h
|