Merge mozilla-central to autoland on a CLOSED TREE
[gecko.git] / dom / svg / SVGAnimatedClassOrString.cpp
blob25a89f15ae429ace47b12c1a22d916e58b797127
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 #include "SVGAnimatedClassOrString.h"
9 #include "DOMSVGAnimatedString.h"
10 #include "SVGAttrTearoffTable.h"
12 namespace mozilla {
14 static SVGAttrTearoffTable<SVGAnimatedClassOrString, dom::DOMSVGAnimatedString>
15 sSVGAnimatedClassOrStringTearoffTable;
17 already_AddRefed<dom::DOMSVGAnimatedString>
18 SVGAnimatedClassOrString::ToDOMAnimatedString(SVGElement* aSVGElement) {
19 RefPtr<dom::DOMSVGAnimatedString> domAnimatedString =
20 sSVGAnimatedClassOrStringTearoffTable.GetTearoff(this);
21 if (!domAnimatedString) {
22 domAnimatedString = new dom::DOMSVGAnimatedString(this, aSVGElement);
23 sSVGAnimatedClassOrStringTearoffTable.AddTearoff(this, domAnimatedString);
26 return domAnimatedString.forget();
29 void SVGAnimatedClassOrString::RemoveTearoff() {
30 sSVGAnimatedClassOrStringTearoffTable.RemoveTearoff(this);
33 } // namespace mozilla