Coverage Report

Created: 2018-09-25 14:53

/work/obj-fuzz/dist/include/mozilla/dom/HTMLDetailsElement.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_HTMLDetailsElement_h
8
#define mozilla_dom_HTMLDetailsElement_h
9
10
#include "mozilla/AsyncEventDispatcher.h"
11
#include "mozilla/Attributes.h"
12
#include "nsGenericHTMLElement.h"
13
14
namespace mozilla {
15
namespace dom {
16
17
// HTMLDetailsElement implements the <details> tag, which is used as a
18
// disclosure widget from which the user can obtain additional information or
19
// controls. Please see the spec for more information.
20
// https://html.spec.whatwg.org/multipage/forms.html#the-details-element
21
//
22
class HTMLDetailsElement final : public nsGenericHTMLElement
23
{
24
public:
25
  using NodeInfo = mozilla::dom::NodeInfo;
26
27
  explicit HTMLDetailsElement(already_AddRefed<NodeInfo>&& aNodeInfo)
28
    : nsGenericHTMLElement(std::move(aNodeInfo))
29
0
  {
30
0
  }
31
32
  NS_IMPL_FROMNODE_HTML_WITH_TAG(HTMLDetailsElement, details)
33
34
  nsIContent* GetFirstSummary() const;
35
36
  nsresult Clone(NodeInfo* aNodeInfo, nsINode** aResult) const override;
37
38
  nsChangeHint GetAttributeChangeHint(const nsAtom* aAttribute,
39
                                      int32_t aModType) const override;
40
41
  nsresult BeforeSetAttr(int32_t aNameSpaceID, nsAtom* aName,
42
                         const nsAttrValueOrString* aValue,
43
                         bool aNotify) override;
44
45
  // HTMLDetailsElement WebIDL
46
0
  bool Open() const { return GetBoolAttr(nsGkAtoms::open); }
47
48
  void SetOpen(bool aOpen, ErrorResult& aError)
49
0
  {
50
0
    SetHTMLBoolAttr(nsGkAtoms::open, aOpen, aError);
51
0
  }
52
53
  void ToggleOpen()
54
0
  {
55
0
    ErrorResult rv;
56
0
    SetOpen(!Open(), rv);
57
0
    rv.SuppressException();
58
0
  }
59
60
  virtual void AsyncEventRunning(AsyncEventDispatcher* aEvent) override;
61
62
protected:
63
  virtual ~HTMLDetailsElement();
64
65
  JSObject* WrapNode(JSContext* aCx,
66
                     JS::Handle<JSObject*> aGivenProto) override;
67
68
  RefPtr<AsyncEventDispatcher> mToggleEventDispatcher;
69
};
70
71
} // namespace dom
72
} // namespace mozilla
73
74
#endif /* mozilla_dom_HTMLDetailsElement_h */