Backed out changeset 2450366cf7ca (bug 1891629) for causing win msix mochitest failures
[gecko.git] / dom / html / HTMLProgressElement.h
blobe0de5362821a2402ac27bdffad9b5b2d100d34b7
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 mozilla_dom_HTMLProgressElement_h
8 #define mozilla_dom_HTMLProgressElement_h
10 #include "mozilla/Attributes.h"
11 #include "nsGenericHTMLElement.h"
12 #include "nsAttrValue.h"
13 #include "nsAttrValueInlines.h"
14 #include <algorithm>
16 namespace mozilla::dom {
18 class HTMLProgressElement final : public nsGenericHTMLElement {
19 public:
20 explicit HTMLProgressElement(
21 already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
23 nsresult Clone(dom::NodeInfo*, nsINode** aResult) const override;
25 bool ParseAttribute(int32_t aNamespaceID, nsAtom* aAttribute,
26 const nsAString& aValue,
27 nsIPrincipal* aMaybeScriptedPrincipal,
28 nsAttrValue& aResult) override;
29 void AfterSetAttr(int32_t aNameSpaceID, nsAtom* aName,
30 const nsAttrValue* aValue, const nsAttrValue* aOldValue,
31 nsIPrincipal* aSubjectPrincipal, bool aNotify) override;
33 // WebIDL
34 double Value() const;
35 void SetValue(double aValue, ErrorResult& aRv) {
36 SetDoubleAttr(nsGkAtoms::value, aValue, aRv);
38 double Max() const;
39 void SetMax(double aValue, ErrorResult& aRv) {
40 // https://html.spec.whatwg.org/multipage/form-elements.html#dom-progress-max
41 // The max IDL attribute must reflect the content attribute of the same
42 // name, limited to only positive numbers.
43 SetDoubleAttr<Reflection::OnlyPositive>(nsGkAtoms::max, aValue, aRv);
45 double Position() const;
47 NS_IMPL_FROMNODE_HTML_WITH_TAG(HTMLProgressElement, progress);
49 protected:
50 virtual ~HTMLProgressElement();
52 JSObject* WrapNode(JSContext*, JS::Handle<JSObject*> aGivenProto) override;
55 } // namespace mozilla::dom
57 #endif // mozilla_dom_HTMLProgressElement_h