Coverage Report

Created: 2018-09-25 14:53

/work/obj-fuzz/dist/include/mozilla/dom/HTMLLegendElement.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_HTMLLegendElement_h
8
#define mozilla_dom_HTMLLegendElement_h
9
10
#include "mozilla/Attributes.h"
11
#include "nsGenericHTMLElement.h"
12
#include "mozilla/dom/HTMLFormElement.h"
13
14
namespace mozilla {
15
namespace dom {
16
17
class HTMLLegendElement final : public nsGenericHTMLElement
18
{
19
public:
20
  explicit HTMLLegendElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
21
    : nsGenericHTMLElement(std::move(aNodeInfo))
22
0
  {
23
0
  }
24
25
  NS_IMPL_FROMNODE_HTML_WITH_TAG(HTMLLegendElement, legend)
26
27
  using nsGenericHTMLElement::Focus;
28
  virtual void Focus(ErrorResult& aError) override;
29
30
  virtual bool PerformAccesskey(bool aKeyCausesActivation,
31
                                bool aIsTrustedEvent) override;
32
33
  // nsIContent
34
  virtual nsresult BindToTree(nsIDocument* aDocument,
35
                              nsIContent* aParent,
36
                              nsIContent* aBindingParent) override;
37
  virtual void UnbindFromTree(bool aDeep = true,
38
                              bool aNullParent = true) override;
39
  virtual bool ParseAttribute(int32_t aNamespaceID,
40
                                nsAtom* aAttribute,
41
                                const nsAString& aValue,
42
                                nsIPrincipal* aMaybeScriptedPrincipal,
43
                                nsAttrValue& aResult) override;
44
  virtual nsChangeHint GetAttributeChangeHint(const nsAtom* aAttribute,
45
                                              int32_t aModType) const override;
46
47
  virtual nsresult Clone(dom::NodeInfo*, nsINode** aResult) const override;
48
49
  Element* GetFormElement() const
50
0
  {
51
0
    nsCOMPtr<nsIFormControl> fieldsetControl = do_QueryInterface(GetFieldSet());
52
0
53
0
    return fieldsetControl ? fieldsetControl->GetFormElement() : nullptr;
54
0
  }
55
56
  /**
57
   * WebIDL Interface
58
   */
59
60
  already_AddRefed<HTMLFormElement> GetForm();
61
62
  void GetAlign(DOMString& aAlign)
63
0
  {
64
0
    GetHTMLAttr(nsGkAtoms::align, aAlign);
65
0
  }
66
67
  void SetAlign(const nsAString& aAlign, ErrorResult& aError)
68
0
  {
69
0
    SetHTMLAttr(nsGkAtoms::align, aAlign, aError);
70
0
  }
71
72
  nsINode* GetScopeChainParent() const override
73
0
  {
74
0
    Element* form = GetFormElement();
75
0
    return form ? form : nsGenericHTMLElement::GetScopeChainParent();
76
0
  }
77
78
protected:
79
  virtual ~HTMLLegendElement();
80
81
  virtual JSObject* WrapNode(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
82
83
  /**
84
   * Get the fieldset content element that contains this legend.
85
   * Returns null if there is no fieldset containing this legend.
86
   */
87
  nsIContent* GetFieldSet() const;
88
};
89
90
} // namespace dom
91
} // namespace mozilla
92
93
#endif /* mozilla_dom_HTMLLegendElement_h */