HTMLProgressElement.h (1997B)
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 "nsAttrValue.h" 11 #include "nsAttrValueInlines.h" 12 #include "nsGenericHTMLElement.h" 13 14 namespace mozilla::dom { 15 16 class HTMLProgressElement final : public nsGenericHTMLElement { 17 public: 18 explicit HTMLProgressElement( 19 already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo); 20 21 nsresult Clone(dom::NodeInfo*, nsINode** aResult) const override; 22 23 bool ParseAttribute(int32_t aNamespaceID, nsAtom* aAttribute, 24 const nsAString& aValue, 25 nsIPrincipal* aMaybeScriptedPrincipal, 26 nsAttrValue& aResult) override; 27 void AfterSetAttr(int32_t aNameSpaceID, nsAtom* aName, 28 const nsAttrValue* aValue, const nsAttrValue* aOldValue, 29 nsIPrincipal* aSubjectPrincipal, bool aNotify) override; 30 31 // WebIDL 32 double Value() const; 33 void SetValue(double aValue, ErrorResult& aRv) { 34 SetDoubleAttr(nsGkAtoms::value, aValue, aRv); 35 } 36 double Max() const; 37 void SetMax(double aValue, ErrorResult& aRv) { 38 // https://html.spec.whatwg.org/multipage/form-elements.html#dom-progress-max 39 // The max IDL attribute must reflect the content attribute of the same 40 // name, limited to only positive numbers. 41 SetDoubleAttr<Reflection::OnlyPositive>(nsGkAtoms::max, aValue, aRv); 42 } 43 double Position() const; 44 45 NS_IMPL_FROMNODE_HTML_WITH_TAG(HTMLProgressElement, progress); 46 47 protected: 48 virtual ~HTMLProgressElement(); 49 50 JSObject* WrapNode(JSContext*, JS::Handle<JSObject*> aGivenProto) override; 51 }; 52 53 } // namespace mozilla::dom 54 55 #endif // mozilla_dom_HTMLProgressElement_h