Bug 1700051: part 46) Const-qualify `mozInlineSpellStatus::mAnchorRange`. r=smaug
[gecko.git] / dom / svg / SVGSwitchElement.h
blob04e4dec8a33f9c5d5efc8b4b402a5828cc0ab772
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 namespace dom {
19 using SVGSwitchElementBase = SVGGraphicsElement;
21 class SVGSwitchElement final : public SVGSwitchElementBase {
22 protected:
23 friend nsresult(::NS_NewSVGSwitchElement(
24 nsIContent** aResult,
25 already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo));
26 explicit SVGSwitchElement(
27 already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
28 ~SVGSwitchElement() = default;
29 virtual JSObject* WrapNode(JSContext* aCx,
30 JS::Handle<JSObject*> aGivenProto) override;
32 public:
33 nsIContent* GetActiveChild() const { return mActiveChild; }
34 void MaybeInvalidate();
36 // interfaces:
38 NS_DECL_ISUPPORTS_INHERITED
39 NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(SVGSwitchElement,
40 SVGSwitchElementBase)
41 // nsINode
42 virtual nsresult InsertChildBefore(nsIContent* aKid, nsIContent* aBeforeThis,
43 bool aNotify) override;
44 virtual void RemoveChildNode(nsIContent* aKid, bool aNotify) override;
46 // nsIContent
47 NS_IMETHOD_(bool) IsAttributeMapped(const nsAtom* aAttribute) const override;
49 virtual nsresult Clone(dom::NodeInfo*, nsINode** aResult) const override;
51 private:
52 void UpdateActiveChild() { mActiveChild = FindActiveChild(); }
53 nsIContent* FindActiveChild() const;
55 // only this child will be displayed
56 nsCOMPtr<nsIContent> mActiveChild;
59 } // namespace dom
60 } // namespace mozilla
62 #endif // DOM_SVG_SVGSWITCHELEMENT_H_