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/. */
7 #ifndef mozilla_dom_HTMLDetailsElement_h
8 #define mozilla_dom_HTMLDetailsElement_h
10 #include "mozilla/AsyncEventDispatcher.h"
11 #include "mozilla/Attributes.h"
12 #include "nsGenericHTMLElement.h"
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
22 class HTMLDetailsElement final
: public nsGenericHTMLElement
{
24 using NodeInfo
= mozilla::dom::NodeInfo
;
26 explicit HTMLDetailsElement(already_AddRefed
<NodeInfo
>&& aNodeInfo
)
27 : nsGenericHTMLElement(std::move(aNodeInfo
)) {}
29 NS_IMPL_FROMNODE_HTML_WITH_TAG(HTMLDetailsElement
, details
)
31 nsIContent
* GetFirstSummary() const;
33 nsresult
Clone(NodeInfo
* aNodeInfo
, nsINode
** aResult
) const override
;
36 nsChangeHint
GetAttributeChangeHint(const nsAtom
* aAttribute
,
37 int32_t aModType
) const override
;
39 nsresult
BeforeSetAttr(int32_t aNameSpaceID
, nsAtom
* aName
,
40 const nsAttrValueOrString
* aValue
,
41 bool aNotify
) override
;
43 bool IsInteractiveHTMLContent(bool aIgnoreTabindex
) const override
{
47 // HTMLDetailsElement WebIDL
48 bool Open() const { return GetBoolAttr(nsGkAtoms::open
); }
50 void SetOpen(bool aOpen
, ErrorResult
& aError
) {
51 SetHTMLBoolAttr(nsGkAtoms::open
, aOpen
, aError
);
57 rv
.SuppressException();
60 virtual void AsyncEventRunning(AsyncEventDispatcher
* aEvent
) override
;
63 virtual ~HTMLDetailsElement();
65 JSObject
* WrapNode(JSContext
* aCx
,
66 JS::Handle
<JSObject
*> aGivenProto
) override
;
68 RefPtr
<AsyncEventDispatcher
> mToggleEventDispatcher
;
72 } // namespace mozilla
74 #endif /* mozilla_dom_HTMLDetailsElement_h */