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_HTMLSummaryElement_h
8 #define mozilla_dom_HTMLSummaryElement_h
10 #include "mozilla/Attributes.h"
11 #include "nsGenericHTMLElement.h"
15 class HTMLDetailsElement
;
17 // HTMLSummaryElement implements the <summary> tag, which is used as a summary
18 // or legend of the <details> tag. Please see the spec for more information.
19 // https://html.spec.whatwg.org/multipage/forms.html#the-details-element
21 class HTMLSummaryElement final
: public nsGenericHTMLElement
{
23 using NodeInfo
= mozilla::dom::NodeInfo
;
25 explicit HTMLSummaryElement(already_AddRefed
<NodeInfo
>&& aNodeInfo
)
26 : nsGenericHTMLElement(std::move(aNodeInfo
)) {}
28 NS_IMPL_FROMNODE_HTML_WITH_TAG(HTMLSummaryElement
, summary
)
30 nsresult
Clone(NodeInfo
*, nsINode
** aResult
) const override
;
32 nsresult
PostHandleEvent(EventChainPostVisitor
& aVisitor
) override
;
34 bool IsHTMLFocusable(bool aWithMouse
, bool* aIsFocusable
,
35 int32_t* aTabIndex
) override
;
37 int32_t TabIndexDefault() override
;
39 // Return true if this is the first summary element child of a details or the
40 // default summary element generated by DetailsFrame.
41 bool IsMainSummary() const;
43 // Return the details element which contains this summary. Otherwise return
44 // nullptr if there is no such details element.
45 HTMLDetailsElement
* GetDetails() const;
48 virtual ~HTMLSummaryElement();
50 JSObject
* WrapNode(JSContext
* aCx
,
51 JS::Handle
<JSObject
*> aGivenProto
) override
;
55 } // namespace mozilla
57 #endif /* mozilla_dom_HTMLSummaryElement_h */