/work/obj-fuzz/dist/include/mozilla/dom/HTMLLabelElement.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 | | /** |
8 | | * Declaration of HTML <label> elements. |
9 | | */ |
10 | | #ifndef HTMLLabelElement_h |
11 | | #define HTMLLabelElement_h |
12 | | |
13 | | #include "mozilla/Attributes.h" |
14 | | #include "nsGenericHTMLElement.h" |
15 | | |
16 | | namespace mozilla { |
17 | | class EventChainPostVisitor; |
18 | | namespace dom { |
19 | | |
20 | | class HTMLLabelElement final : public nsGenericHTMLElement |
21 | | { |
22 | | public: |
23 | | explicit HTMLLabelElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo) |
24 | | : nsGenericHTMLElement(std::move(aNodeInfo)), |
25 | | mHandlingEvent(false) |
26 | | { |
27 | | } |
28 | | |
29 | | NS_IMPL_FROMNODE_HTML_WITH_TAG(HTMLLabelElement, label) |
30 | | |
31 | | // nsISupports |
32 | | NS_INLINE_DECL_REFCOUNTING_INHERITED(HTMLLabelElement, nsGenericHTMLElement) |
33 | | |
34 | | // Element |
35 | | virtual bool IsInteractiveHTMLContent(bool aIgnoreTabindex) const override |
36 | | { |
37 | | return true; |
38 | | } |
39 | | |
40 | | HTMLFormElement* GetForm() const; |
41 | | void GetHtmlFor(nsString& aHtmlFor) |
42 | 0 | { |
43 | 0 | GetHTMLAttr(nsGkAtoms::_for, aHtmlFor); |
44 | 0 | } |
45 | | void SetHtmlFor(const nsAString& aHtmlFor) |
46 | 0 | { |
47 | 0 | SetHTMLAttr(nsGkAtoms::_for, aHtmlFor); |
48 | 0 | } |
49 | | nsGenericHTMLElement* GetControl() const |
50 | 0 | { |
51 | 0 | return GetLabeledElement(); |
52 | 0 | } |
53 | | |
54 | | using nsGenericHTMLElement::Focus; |
55 | | virtual void Focus(mozilla::ErrorResult& aError) override; |
56 | | |
57 | | // nsIContent |
58 | | virtual nsresult PostHandleEvent( |
59 | | EventChainPostVisitor& aVisitor) override; |
60 | | virtual bool PerformAccesskey(bool aKeyCausesActivation, |
61 | | bool aIsTrustedEvent) override; |
62 | | virtual nsresult Clone(dom::NodeInfo*, nsINode** aResult) const override; |
63 | | |
64 | | nsGenericHTMLElement* GetLabeledElement() const; |
65 | | protected: |
66 | | virtual ~HTMLLabelElement(); |
67 | | |
68 | | virtual JSObject* WrapNode(JSContext *aCx, JS::Handle<JSObject*> aGivenProto) override; |
69 | | |
70 | | nsGenericHTMLElement* GetFirstLabelableDescendant() const; |
71 | | |
72 | | // XXX It would be nice if we could use an event flag instead. |
73 | | bool mHandlingEvent; |
74 | | }; |
75 | | |
76 | | } // namespace dom |
77 | | } // namespace mozilla |
78 | | |
79 | | #endif /* HTMLLabelElement_h */ |