/work/obj-fuzz/dist/include/mozilla/dom/HTMLOutputElement.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_HTMLOutputElement_h |
8 | | #define mozilla_dom_HTMLOutputElement_h |
9 | | |
10 | | #include "mozilla/Attributes.h" |
11 | | #include "nsGenericHTMLElement.h" |
12 | | #include "nsStubMutationObserver.h" |
13 | | #include "nsIConstraintValidation.h" |
14 | | |
15 | | namespace mozilla { |
16 | | namespace dom { |
17 | | |
18 | | class HTMLFormSubmission; |
19 | | |
20 | | class HTMLOutputElement final : public nsGenericHTMLFormElement, |
21 | | public nsStubMutationObserver, |
22 | | public nsIConstraintValidation |
23 | | { |
24 | | public: |
25 | | using nsIConstraintValidation::GetValidationMessage; |
26 | | |
27 | | explicit HTMLOutputElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo, |
28 | | FromParser aFromParser = NOT_FROM_PARSER); |
29 | | |
30 | | // nsISupports |
31 | | NS_DECL_ISUPPORTS_INHERITED |
32 | | |
33 | | // nsIFormControl |
34 | | NS_IMETHOD Reset() override; |
35 | | NS_IMETHOD SubmitNamesValues(HTMLFormSubmission* aFormSubmission) override; |
36 | | |
37 | | nsresult Clone(dom::NodeInfo*, nsINode** aResult) const override; |
38 | | |
39 | | virtual bool ParseAttribute(int32_t aNamespaceID, nsAtom* aAttribute, |
40 | | const nsAString& aValue, |
41 | | nsIPrincipal* aMaybeScriptedPrincipal, |
42 | | nsAttrValue& aResult) override; |
43 | | |
44 | | virtual void DoneAddingChildren(bool aHaveNotified) override; |
45 | | |
46 | | EventStates IntrinsicState() const override; |
47 | | |
48 | | virtual nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent, |
49 | | nsIContent* aBindingParent) override; |
50 | | |
51 | | // This function is called when a callback function from nsIMutationObserver |
52 | | // has to be used to update the defaultValue attribute. |
53 | | void DescendantsChanged(); |
54 | | |
55 | | // nsIMutationObserver |
56 | | NS_DECL_NSIMUTATIONOBSERVER_CHARACTERDATACHANGED |
57 | | NS_DECL_NSIMUTATIONOBSERVER_CONTENTAPPENDED |
58 | | NS_DECL_NSIMUTATIONOBSERVER_CONTENTINSERTED |
59 | | NS_DECL_NSIMUTATIONOBSERVER_CONTENTREMOVED |
60 | | |
61 | | NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(HTMLOutputElement, |
62 | | nsGenericHTMLFormElement) |
63 | | |
64 | | virtual JSObject* WrapNode(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override; |
65 | | |
66 | | // WebIDL |
67 | | nsDOMTokenList* HtmlFor(); |
68 | | // nsGenericHTMLFormElement::GetForm is fine. |
69 | | void GetName(nsAString& aName) |
70 | 0 | { |
71 | 0 | GetHTMLAttr(nsGkAtoms::name, aName); |
72 | 0 | } |
73 | | |
74 | | void SetName(const nsAString& aName, ErrorResult& aRv) |
75 | 0 | { |
76 | 0 | SetHTMLAttr(nsGkAtoms::name, aName, aRv); |
77 | 0 | } |
78 | | |
79 | | void GetType(nsAString& aType) |
80 | 0 | { |
81 | 0 | aType.AssignLiteral("output"); |
82 | 0 | } |
83 | | |
84 | | void GetDefaultValue(nsAString& aDefaultValue) |
85 | 0 | { |
86 | 0 | aDefaultValue = mDefaultValue; |
87 | 0 | } |
88 | | |
89 | | void SetDefaultValue(const nsAString& aDefaultValue, ErrorResult& aRv); |
90 | | |
91 | | void GetValue(nsAString& aValue); |
92 | | void SetValue(const nsAString& aValue, ErrorResult& aRv); |
93 | | |
94 | | // nsIConstraintValidation::WillValidate is fine. |
95 | | // nsIConstraintValidation::Validity() is fine. |
96 | | // nsIConstraintValidation::GetValidationMessage() is fine. |
97 | | // nsIConstraintValidation::CheckValidity() is fine. |
98 | | void SetCustomValidity(const nsAString& aError); |
99 | | |
100 | | protected: |
101 | | virtual ~HTMLOutputElement(); |
102 | | |
103 | | enum ValueModeFlag { |
104 | | eModeDefault, |
105 | | eModeValue |
106 | | }; |
107 | | |
108 | | ValueModeFlag mValueModeFlag; |
109 | | bool mIsDoneAddingChildren; |
110 | | nsString mDefaultValue; |
111 | | RefPtr<nsDOMTokenList> mTokenList; |
112 | | }; |
113 | | |
114 | | } // namespace dom |
115 | | } // namespace mozilla |
116 | | |
117 | | #endif // mozilla_dom_HTMLOutputElement_h |