Bug 1936278 - Prevent search mode chiclet from being dismissed when clicking in page...
[gecko.git] / dom / svg / DOMSVGAnimatedString.h
blob0fe7b330a019dccb42a29af16af5fbb8ac2156d7
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_DOMSVGANIMATEDSTRING_H_
8 #define DOM_SVG_DOMSVGANIMATEDSTRING_H_
10 #include "mozilla/SVGAnimatedClassOrString.h"
11 #include "mozilla/dom/SVGElement.h"
13 namespace mozilla::dom {
15 class DOMSVGAnimatedString final : public nsWrapperCache {
16 public:
17 NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS(DOMSVGAnimatedString)
18 NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(DOMSVGAnimatedString)
20 DOMSVGAnimatedString(SVGAnimatedClassOrString* aVal, SVGElement* aSVGElement)
21 : mVal(aVal), mSVGElement(aSVGElement) {}
23 JSObject* WrapObject(JSContext* aCx,
24 JS::Handle<JSObject*> aGivenProto) override;
26 // WebIDL
27 SVGElement* GetParentObject() const { return mSVGElement; }
29 void GetBaseVal(nsAString& aResult) {
30 mVal->GetBaseValue(aResult, mSVGElement);
32 void SetBaseVal(const nsAString& aValue) {
33 mVal->SetBaseValue(aValue, mSVGElement, true);
35 void GetAnimVal(nsAString& aResult) {
36 mSVGElement->FlushAnimations();
37 mVal->GetAnimValue(aResult, mSVGElement);
40 private:
41 ~DOMSVGAnimatedString() { mVal->RemoveTearoff(); }
43 SVGAnimatedClassOrString* mVal; // kept alive because it belongs to content
44 RefPtr<SVGElement> mSVGElement;
47 } // namespace mozilla::dom
49 #endif // DOM_SVG_DOMSVGANIMATEDSTRING_H_