Bug 824229 Part 4: Implement SVGTransformableElement r=longsonr

This commit is contained in:
David Zbarsky 2013-01-03 01:17:02 -05:00
parent 6a7c84d12d
commit 2a4c6d8cd0
6 changed files with 115 additions and 2 deletions

View File

@ -134,6 +134,7 @@ CPPSRCS = \
SVGScriptElement.cpp \
SVGStopElement.cpp \
SVGStyleElement.cpp \
SVGTransformableElement.cpp \
SVGTransformListSMILType.cpp \
SVGViewBoxSMILType.cpp \
$(NULL)
@ -163,6 +164,7 @@ EXPORTS_mozilla/dom = \
SVGStopElement.h \
SVGStyleElement.h \
SVGTitleElement.h \
SVGTransformableElement.h \
$(NULL)
include $(topsrcdir)/config/rules.mk

View File

@ -0,0 +1,46 @@
/* -*- Mode: C++; 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/. */
#include "SVGTransformableElement.h"
#include "DOMSVGAnimatedTransformList.h"
namespace mozilla {
namespace dom {
//----------------------------------------------------------------------
// nsISupports methods
NS_IMPL_ADDREF_INHERITED(SVGTransformableElement, SVGLocatableElement)
NS_IMPL_RELEASE_INHERITED(SVGTransformableElement, SVGLocatableElement)
NS_INTERFACE_MAP_BEGIN(SVGTransformableElement)
NS_INTERFACE_MAP_ENTRY(nsIDOMSVGTransformable)
NS_INTERFACE_MAP_END_INHERITING(SVGLocatableElement)
//----------------------------------------------------------------------
// nsIDOMSVGTransformable methods
/* readonly attribute nsISupports transform; */
NS_IMETHODIMP
SVGTransformableElement::GetTransform(nsISupports **aTransform)
{
*aTransform = Transform().get();
return NS_OK;
}
already_AddRefed<DOMSVGAnimatedTransformList>
SVGTransformableElement::Transform()
{
// We're creating a DOM wrapper, so we must tell GetAnimatedTransformList
// to allocate the SVGAnimatedTransformList if it hasn't already done so:
return DOMSVGAnimatedTransformList::GetDOMWrapper(
GetAnimatedTransformList(DO_ALLOCATE), this).get();
}
} // namespace dom
} // namespace mozilla

View File

@ -0,0 +1,43 @@
/* -*- Mode: C++; 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/. */
#ifndef SVGTransformableElement_h
#define SVGTransformableElement_h
#include "SVGLocatableElement.h"
#include "nsIDOMSVGTransformable.h"
#define MOZILLA_SVGTRANSFORMABLEELEMENT_IID \
{ 0x77888cba, 0x0b43, 0x4654, \
{0x96, 0x3c, 0xf5, 0x50, 0xfc, 0xb5, 0x5e, 0x32}}
namespace mozilla {
class DOMSVGAnimatedTransformList;
namespace dom {
class SVGTransformableElement : public SVGLocatableElement,
public nsIDOMSVGTransformable
{
public:
SVGTransformableElement(already_AddRefed<nsINodeInfo> aNodeInfo)
: SVGLocatableElement(aNodeInfo) {}
virtual ~SVGTransformableElement() {}
NS_DECLARE_STATIC_IID_ACCESSOR(MOZILLA_SVGTRANSFORMABLEELEMENT_IID)
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_NSIDOMSVGTRANSFORMABLE
// WebIDL
already_AddRefed<DOMSVGAnimatedTransformList> Transform();
};
NS_DEFINE_STATIC_IID_ACCESSOR(SVGTransformableElement,
MOZILLA_SVGTRANSFORMABLEELEMENT_IID)
} // namespace dom
} // namespace mozilla
#endif // SVGTransformableElement_h

View File

@ -610,8 +610,8 @@ DOMInterfaces = {
},
'SVGLocatableElement': {
'hasXPConnectImpls': True
'concrete': False,
'hasXPConnectImpls': True,
'concrete': False
},
'SVGLengthList': {
@ -763,6 +763,11 @@ DOMInterfaces = {
'headerFile': 'DOMSVGTransform.h'
},
'SVGTransformableElement': {
'hasXPConnectImpls': True,
'concrete': False
},
'SVGTransformList': {
'nativeType': 'mozilla::DOMSVGTransformList',
'headerFile': 'DOMSVGTransformList.h',

View File

@ -0,0 +1,16 @@
/* -*- 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 SVGTransformableElement : SVGLocatableElement {
readonly attribute SVGAnimatedTransformList transform;
};

View File

@ -121,6 +121,7 @@ webidl_files = \
SVGStyleElement.webidl \
SVGTitleElement.webidl \
SVGTransform.webidl \
SVGTransformableElement.webidl \
SVGTransformList.webidl \
SVGURIReference.webidl \
Text.webidl \