tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

HTMLSummaryElement.h (1863B)


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