Bug 1936278 - Prevent search mode chiclet from being dismissed when clicking in page...
[gecko.git] / dom / svg / SVGSwitchElement.h
blob68c22e8f71f6e1ec84816f9cd118a025a2c75bb7
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 DOM_SVG_SVGSWITCHELEMENT_H_
8 #define DOM_SVG_SVGSWITCHELEMENT_H_
10 #include "mozilla/dom/SVGGraphicsElement.h"
11 #include "nsCOMPtr.h"
13 nsresult NS_NewSVGSwitchElement(
14 nsIContent** aResult, already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
16 namespace mozilla {
17 class ErrorResult;
18 namespace dom {
20 using SVGSwitchElementBase = SVGGraphicsElement;
22 class SVGSwitchElement final : public SVGSwitchElementBase {
23 protected:
24 friend nsresult(::NS_NewSVGSwitchElement(
25 nsIContent** aResult,
26 already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo));
27 explicit SVGSwitchElement(
28 already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
29 ~SVGSwitchElement() = default;
30 JSObject* WrapNode(JSContext* aCx,
31 JS::Handle<JSObject*> aGivenProto) override;
33 public:
34 NS_IMPL_FROMNODE_WITH_TAG(SVGSwitchElement, kNameSpaceID_SVG, svgSwitch)
36 nsIContent* GetActiveChild() const { return mActiveChild; }
37 void MaybeInvalidate();
39 // interfaces:
41 NS_DECL_ISUPPORTS_INHERITED
42 NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(SVGSwitchElement,
43 SVGSwitchElementBase)
44 // nsINode
45 virtual void InsertChildBefore(nsIContent* aKid, nsIContent* aBeforeThis,
46 bool aNotify, ErrorResult& aRv) override;
47 void RemoveChildNode(nsIContent* aKid, bool aNotify) override;
49 // nsIContent
50 nsresult Clone(dom::NodeInfo*, nsINode** aResult) const override;
52 private:
53 // only this child will be displayed
54 nsCOMPtr<nsIContent> mActiveChild;
57 } // namespace dom
58 } // namespace mozilla
60 #endif // DOM_SVG_SVGSWITCHELEMENT_H_