mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-01-27 07:34:20 +00:00
Bug 816778 Part 7: Convert SVGAnimatedNumberList to WebIDL r=bz
This commit is contained in:
parent
a7787e2a78
commit
6e8d4191c7
@ -9,6 +9,7 @@
|
||||
#include "nsSVGElement.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsSVGAttrTearoffTable.h"
|
||||
#include "mozilla/dom/SVGAnimatedNumberListBinding.h"
|
||||
|
||||
// See the architecture comment in this file's header.
|
||||
|
||||
@ -17,7 +18,21 @@ namespace mozilla {
|
||||
static nsSVGAttrTearoffTable<SVGAnimatedNumberList, DOMSVGAnimatedNumberList>
|
||||
sSVGAnimatedNumberListTearoffTable;
|
||||
|
||||
NS_SVG_VAL_IMPL_CYCLE_COLLECTION(DOMSVGAnimatedNumberList, mElement)
|
||||
NS_IMPL_CYCLE_COLLECTION_CLASS(DOMSVGAnimatedNumberList)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(DOMSVGAnimatedNumberList)
|
||||
// No unlinking mElement, we'd need to null out the value pointer (the object it
|
||||
// points to is held by the element) and null-check it everywhere.
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_PRESERVED_WRAPPER
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(DOMSVGAnimatedNumberList)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mElement)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_SCRIPT_OBJECTS
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN(DOMSVGAnimatedNumberList)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRACE_PRESERVED_WRAPPER
|
||||
NS_IMPL_CYCLE_COLLECTION_TRACE_END
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTING_ADDREF(DOMSVGAnimatedNumberList)
|
||||
NS_IMPL_CYCLE_COLLECTING_RELEASE(DOMSVGAnimatedNumberList)
|
||||
@ -27,28 +42,51 @@ DOMCI_DATA(SVGAnimatedNumberList, mozilla::DOMSVGAnimatedNumberList)
|
||||
namespace mozilla {
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(DOMSVGAnimatedNumberList)
|
||||
NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMSVGAnimatedNumberList)
|
||||
NS_INTERFACE_MAP_ENTRY(nsISupports)
|
||||
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(SVGAnimatedNumberList)
|
||||
NS_INTERFACE_MAP_END
|
||||
|
||||
NS_IMETHODIMP
|
||||
DOMSVGAnimatedNumberList::GetBaseVal(nsIDOMSVGNumberList **_retval)
|
||||
JSObject*
|
||||
DOMSVGAnimatedNumberList::WrapObject(JSContext* aCx, JSObject* aScope, bool* aTriedToWrap)
|
||||
{
|
||||
return mozilla::dom::SVGAnimatedNumberListBinding::Wrap(aCx, aScope, this, aTriedToWrap);
|
||||
}
|
||||
|
||||
already_AddRefed<DOMSVGNumberList>
|
||||
DOMSVGAnimatedNumberList::BaseVal()
|
||||
{
|
||||
if (!mBaseVal) {
|
||||
mBaseVal = new DOMSVGNumberList(this, InternalAList().GetBaseValue());
|
||||
}
|
||||
NS_ADDREF(*_retval = mBaseVal);
|
||||
nsRefPtr<DOMSVGNumberList> baseVal = mBaseVal;
|
||||
return baseVal.forget();
|
||||
}
|
||||
|
||||
/* readonly attribute nsIDOMSVGNumberList baseVal; */
|
||||
NS_IMETHODIMP
|
||||
DOMSVGAnimatedNumberList::GetBaseVal(nsIDOMSVGNumberList** aBaseVal)
|
||||
{
|
||||
*aBaseVal = BaseVal().get();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
DOMSVGAnimatedNumberList::GetAnimVal(nsIDOMSVGNumberList **_retval)
|
||||
already_AddRefed<DOMSVGNumberList>
|
||||
DOMSVGAnimatedNumberList::AnimVal()
|
||||
{
|
||||
if (!mAnimVal) {
|
||||
mAnimVal = new DOMSVGNumberList(this, InternalAList().GetAnimValue());
|
||||
}
|
||||
NS_ADDREF(*_retval = mAnimVal);
|
||||
nsRefPtr<DOMSVGNumberList> animVal = mAnimVal;
|
||||
return animVal.forget();
|
||||
}
|
||||
|
||||
/* readonly attribute nsIDOMSVGNumberList animVal; */
|
||||
NS_IMETHODIMP
|
||||
DOMSVGAnimatedNumberList::GetAnimVal(nsIDOMSVGNumberList** aAnimVal)
|
||||
{
|
||||
*aAnimVal = AnimVal().get();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -11,6 +11,7 @@
|
||||
#include "nsCycleCollectionParticipant.h"
|
||||
#include "nsIDOMSVGAnimatedNumberList.h"
|
||||
#include "nsSVGElement.h"
|
||||
#include "nsWrapperCache.h"
|
||||
#include "mozilla/Attributes.h"
|
||||
|
||||
namespace mozilla {
|
||||
@ -34,13 +35,14 @@ class SVGNumberList;
|
||||
* out our pointers to them when they die (making our pointers to them true
|
||||
* weak refs).
|
||||
*/
|
||||
class DOMSVGAnimatedNumberList MOZ_FINAL : public nsIDOMSVGAnimatedNumberList
|
||||
class DOMSVGAnimatedNumberList MOZ_FINAL : public nsIDOMSVGAnimatedNumberList,
|
||||
public nsWrapperCache
|
||||
{
|
||||
friend class DOMSVGNumberList;
|
||||
|
||||
public:
|
||||
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS(DOMSVGAnimatedNumberList)
|
||||
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(DOMSVGAnimatedNumberList)
|
||||
NS_DECL_NSIDOMSVGANIMATEDNUMBERLIST
|
||||
|
||||
/**
|
||||
@ -88,6 +90,13 @@ public:
|
||||
*/
|
||||
bool IsAnimating() const;
|
||||
|
||||
// WebIDL
|
||||
nsSVGElement* GetParentObject() const { return mElement; }
|
||||
virtual JSObject* WrapObject(JSContext* aCx, JSObject* aScope, bool* aTriedToWrap);
|
||||
// These aren't weak refs because mBaseVal and mAnimVal are weak
|
||||
already_AddRefed<DOMSVGNumberList> BaseVal();
|
||||
already_AddRefed<DOMSVGNumberList> AnimVal();
|
||||
|
||||
private:
|
||||
|
||||
/**
|
||||
|
@ -441,6 +441,11 @@ DOMInterfaces = {
|
||||
'prefable': True,
|
||||
},
|
||||
|
||||
'SVGAnimatedNumberList': {
|
||||
'nativeType': 'mozilla::DOMSVGAnimatedNumberList',
|
||||
'headerFile': 'DOMSVGAnimatedNumberList.h'
|
||||
},
|
||||
|
||||
'SVGAnimatedPreserveAspectRatio': {
|
||||
'nativeType': 'mozilla::dom::DOMSVGAnimatedPreserveAspectRatio',
|
||||
'headerFile': 'SVGAnimatedPreserveAspectRatio.h'
|
||||
|
19
dom/webidl/SVGAnimatedNumberList.webidl
Normal file
19
dom/webidl/SVGAnimatedNumberList.webidl
Normal file
@ -0,0 +1,19 @@
|
||||
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
* You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*
|
||||
* The origin of this IDL file is
|
||||
* http://www.w3.org/TR/SVG2/
|
||||
*
|
||||
* Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C
|
||||
* liability, trademark and document use rules apply.
|
||||
*/
|
||||
|
||||
interface SVGAnimatedNumberList {
|
||||
[Constant]
|
||||
readonly attribute SVGNumberList baseVal;
|
||||
[Constant]
|
||||
readonly attribute SVGNumberList animVal;
|
||||
};
|
||||
|
@ -68,6 +68,7 @@ webidl_files = \
|
||||
PerformanceTiming.webidl \
|
||||
RGBColor.webidl \
|
||||
Screen.webidl \
|
||||
SVGAnimatedNumberList.webidl \
|
||||
SVGAnimatedPreserveAspectRatio.webidl \
|
||||
SVGAnimatedTransformList.webidl \
|
||||
SVGLengthList.webidl \
|
||||
|
Loading…
x
Reference in New Issue
Block a user