Line data Source code
1 : /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 : /* This Source Code Form is subject to the terms of the Mozilla Public
3 : * License, v. 2.0. If a copy of the MPL was not distributed with this
4 : * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 :
6 : #ifndef mozilla_dom_HTMLSummaryElement_h
7 : #define mozilla_dom_HTMLSummaryElement_h
8 :
9 : #include "mozilla/Attributes.h"
10 : #include "nsGenericHTMLElement.h"
11 :
12 : namespace mozilla {
13 : namespace dom {
14 : class HTMLDetailsElement;
15 :
16 : // HTMLSummaryElement implements the <summary> tag, which is used as a summary
17 : // or legend of the <details> tag. Please see the spec for more information.
18 : // https://html.spec.whatwg.org/multipage/forms.html#the-details-element
19 : //
20 : class HTMLSummaryElement final : public nsGenericHTMLElement
21 : {
22 : public:
23 : using NodeInfo = mozilla::dom::NodeInfo;
24 :
25 0 : explicit HTMLSummaryElement(already_AddRefed<NodeInfo>& aNodeInfo)
26 0 : : nsGenericHTMLElement(aNodeInfo)
27 : {
28 0 : }
29 :
30 0 : NS_IMPL_FROMCONTENT_HTML_WITH_TAG(HTMLSummaryElement, summary)
31 :
32 : nsresult Clone(NodeInfo* aNodeInfo, nsINode** aResult,
33 : bool aPreallocateChildren) const override;
34 :
35 : nsresult PostHandleEvent(EventChainPostVisitor& aVisitor) override;
36 :
37 : bool IsHTMLFocusable(bool aWithMouse, bool* aIsFocusable,
38 : int32_t* aTabIndex) override;
39 :
40 : int32_t TabIndexDefault() override;
41 :
42 : // Return true if this is the first summary element child of a details or the
43 : // default summary element generated by DetailsFrame.
44 : bool IsMainSummary() const;
45 :
46 : // Return the details element which contains this summary. Otherwise return
47 : // nullptr if there is no such details element.
48 : HTMLDetailsElement* GetDetails() const;
49 :
50 : protected:
51 : virtual ~HTMLSummaryElement();
52 :
53 : JSObject* WrapNode(JSContext* aCx,
54 : JS::Handle<JSObject*> aGivenProto) override;
55 : };
56 :
57 : } // namespace dom
58 : } // namespace mozilla
59 :
60 : #endif /* mozilla_dom_HTMLSummaryElement_h */
|