/work/obj-fuzz/dist/include/mozilla/dom/SVGSwitchElement.h
Line | Count | Source (jump to first uncovered line) |
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_SVGSwitchElement_h |
8 | | #define mozilla_dom_SVGSwitchElement_h |
9 | | |
10 | | #include "mozilla/dom/SVGGraphicsElement.h" |
11 | | |
12 | | class nsSVGSwitchFrame; |
13 | | |
14 | | nsresult NS_NewSVGSwitchElement(nsIContent **aResult, |
15 | | already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo); |
16 | | |
17 | | namespace mozilla { |
18 | | namespace dom { |
19 | | |
20 | | typedef SVGGraphicsElement SVGSwitchElementBase; |
21 | | |
22 | | class SVGSwitchElement final : public SVGSwitchElementBase |
23 | | { |
24 | | friend class ::nsSVGSwitchFrame; |
25 | | protected: |
26 | | friend nsresult (::NS_NewSVGSwitchElement(nsIContent **aResult, |
27 | | already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)); |
28 | | explicit SVGSwitchElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo); |
29 | | ~SVGSwitchElement(); |
30 | | virtual JSObject* WrapNode(JSContext *aCx, JS::Handle<JSObject*> aGivenProto) override; |
31 | | |
32 | | public: |
33 | | nsIContent * GetActiveChild() const |
34 | 0 | { return mActiveChild; } |
35 | | void MaybeInvalidate(); |
36 | | |
37 | | // interfaces: |
38 | | |
39 | | NS_DECL_ISUPPORTS_INHERITED |
40 | | NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(SVGSwitchElement, |
41 | | SVGSwitchElementBase) |
42 | | // nsINode |
43 | | virtual nsresult InsertChildBefore(nsIContent* aKid, nsIContent* aBeforeThis, |
44 | | bool aNotify) override; |
45 | | virtual void RemoveChildNode(nsIContent* aKid, bool aNotify) override; |
46 | | |
47 | | // nsIContent |
48 | | NS_IMETHOD_(bool) IsAttributeMapped(const nsAtom* aAttribute) const override; |
49 | | |
50 | | virtual nsresult Clone(dom::NodeInfo*, nsINode** aResult) const override; |
51 | | private: |
52 | | void UpdateActiveChild() |
53 | 0 | { mActiveChild = FindActiveChild(); } |
54 | | nsIContent* FindActiveChild() const; |
55 | | |
56 | | // only this child will be displayed |
57 | | nsCOMPtr<nsIContent> mActiveChild; |
58 | | }; |
59 | | |
60 | | } // namespace dom |
61 | | } // namespace mozilla |
62 | | |
63 | | #endif // mozilla_dom_SVGSwitchElement_h |