Bug 831669 - Convert SVGClipPathElement to WebIDL r=bz

This commit is contained in:
David Zbarsky 2013-01-18 14:53:08 -05:00
parent 2f19359c49
commit 91edcdf577
4 changed files with 44 additions and 1 deletions

View File

@ -6,6 +6,7 @@
#include "mozilla/Util.h"
#include "mozilla/dom/SVGClipPathElement.h"
#include "mozilla/dom/SVGClipPathElementBinding.h"
#include "nsGkAtoms.h"
NS_IMPL_NS_NEW_NAMESPACED_SVG_ELEMENT(ClipPath)
@ -15,6 +16,12 @@ DOMCI_NODE_DATA(SVGClipPathElement, mozilla::dom::SVGClipPathElement)
namespace mozilla {
namespace dom {
JSObject*
SVGClipPathElement::WrapNode(JSContext *aCx, JSObject *aScope, bool *aTriedToWrap)
{
return SVGClipPathElementBinding::Wrap(aCx, aScope, this, aTriedToWrap);
}
nsSVGElement::EnumInfo SVGClipPathElement::sEnumInfo[1] =
{
{ &nsGkAtoms::clipPathUnits,
@ -43,12 +50,22 @@ NS_INTERFACE_MAP_END_INHERITING(SVGClipPathElementBase)
SVGClipPathElement::SVGClipPathElement(already_AddRefed<nsINodeInfo> aNodeInfo)
: SVGClipPathElementBase(aNodeInfo)
{
SetIsDOMBinding();
}
/* readonly attribute nsIDOMSVGAnimatedEnumeration clipPathUnits; */
NS_IMETHODIMP SVGClipPathElement::GetClipPathUnits(nsIDOMSVGAnimatedEnumeration * *aClipPathUnits)
{
return mEnumAttributes[CLIPPATHUNITS].ToDOMAnimatedEnum(aClipPathUnits, this);
*aClipPathUnits = ClipPathUnits().get();
return NS_OK;
}
already_AddRefed<nsIDOMSVGAnimatedEnumeration>
SVGClipPathElement::ClipPathUnits()
{
nsCOMPtr<nsIDOMSVGAnimatedEnumeration> unit;
mEnumAttributes[CLIPPATHUNITS].ToDOMAnimatedEnum(getter_AddRefs(unit), this);
return unit.forget();
}
nsSVGElement::EnumAttributesInfo

View File

@ -31,6 +31,7 @@ protected:
friend nsresult (::NS_NewSVGClipPathElement(nsIContent **aResult,
already_AddRefed<nsINodeInfo> aNodeInfo));
SVGClipPathElement(already_AddRefed<nsINodeInfo> aNodeInfo);
virtual JSObject* WrapNode(JSContext *cx, JSObject *scope, bool *triedToWrap) MOZ_OVERRIDE;
public:
// interfaces:
@ -48,6 +49,10 @@ public:
virtual nsXPCClassInfo* GetClassInfo();
virtual nsIDOMNode* AsDOMNode() { return this; }
// WebIDL
already_AddRefed<nsIDOMSVGAnimatedEnumeration> ClipPathUnits();
protected:
// nsIDOMSVGClipPathElement values

View File

@ -0,0 +1,20 @@
/* -*- 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 SVGAnimatedEnumeration;
interface SVGClipPathElement : SVGTransformableElement {
readonly attribute SVGAnimatedEnumeration clipPathUnits;
};
SVGClipPathElement implements SVGUnitTypes;

View File

@ -114,6 +114,7 @@ webidl_files = \
SVGAnimateTransformElement.webidl \
SVGAnimationElement.webidl \
SVGCircleElement.webidl \
SVGClipPathElement.webidl \
SVGDefsElement.webidl \
SVGDescElement.webidl \
SVGElement.webidl \