Bug 1880216 - Migrate Fenix docs into Sphinx. r=owlish,geckoview-reviewers,android...
[gecko.git] / dom / html / HTMLSummaryElement.h
blobb70e8eebbb16bb0073e85b83fca99ff0f747bc9a
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"
13 namespace mozilla::dom {
14 class HTMLDetailsElement;
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
20 class HTMLSummaryElement final : public nsGenericHTMLElement {
21 public:
22 using NodeInfo = mozilla::dom::NodeInfo;
24 explicit HTMLSummaryElement(already_AddRefed<NodeInfo>&& aNodeInfo)
25 : nsGenericHTMLElement(std::move(aNodeInfo)) {}
27 NS_IMPL_FROMNODE_HTML_WITH_TAG(HTMLSummaryElement, summary)
29 nsresult Clone(NodeInfo*, nsINode** aResult) const override;
31 nsresult PostHandleEvent(EventChainPostVisitor& aVisitor) override;
33 bool IsHTMLFocusable(bool aWithMouse, bool* aIsFocusable,
34 int32_t* aTabIndex) override;
36 int32_t TabIndexDefault() override;
38 // Return true if this is the first summary element child of a details or the
39 // default summary element.
40 bool IsMainSummary() const;
42 // Return the details element which contains this summary. Otherwise return
43 // nullptr if there is no such details element.
44 HTMLDetailsElement* GetDetails() const;
46 protected:
47 virtual ~HTMLSummaryElement();
49 JSObject* WrapNode(JSContext* aCx,
50 JS::Handle<JSObject*> aGivenProto) override;
53 } // namespace mozilla::dom
55 #endif /* mozilla_dom_HTMLSummaryElement_h */