mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 13:21:05 +00:00
Bug 830181 - Convert SVGSymbolElement to WebIDL r=bz
This commit is contained in:
parent
df3ff4c9ff
commit
8ff56e186f
@ -4,6 +4,7 @@
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "mozilla/dom/SVGSymbolElement.h"
|
||||
#include "mozilla/dom/SVGSymbolElementBinding.h"
|
||||
|
||||
NS_IMPL_NS_NEW_NAMESPACED_SVG_ELEMENT(Symbol)
|
||||
|
||||
@ -12,6 +13,12 @@ DOMCI_NODE_DATA(SVGSymbolElement, mozilla::dom::SVGSymbolElement)
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
JSObject*
|
||||
SVGSymbolElement::WrapNode(JSContext *aCx, JSObject *aScope, bool *aTriedToWrap)
|
||||
{
|
||||
return SVGSymbolElementBinding::Wrap(aCx, aScope, this, aTriedToWrap);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// nsISupports methods
|
||||
|
||||
@ -31,6 +38,7 @@ NS_INTERFACE_MAP_END_INHERITING(SVGSymbolElementBase)
|
||||
SVGSymbolElement::SVGSymbolElement(already_AddRefed<nsINodeInfo> aNodeInfo)
|
||||
: SVGSymbolElementBase(aNodeInfo)
|
||||
{
|
||||
SetIsDOMBinding();
|
||||
}
|
||||
|
||||
|
||||
@ -45,18 +53,33 @@ NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGSymbolElement)
|
||||
/* readonly attribute nsIDOMSVGAnimatedRect viewBox; */
|
||||
NS_IMETHODIMP SVGSymbolElement::GetViewBox(nsIDOMSVGAnimatedRect * *aViewBox)
|
||||
{
|
||||
return mViewBox.ToDOMAnimatedRect(aViewBox, this);
|
||||
*aViewBox = ViewBox().get();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
already_AddRefed<nsIDOMSVGAnimatedRect>
|
||||
SVGSymbolElement::ViewBox()
|
||||
{
|
||||
nsCOMPtr<nsIDOMSVGAnimatedRect> rect;
|
||||
mViewBox.ToDOMAnimatedRect(getter_AddRefs(rect), this);
|
||||
return rect.forget();
|
||||
}
|
||||
|
||||
/* readonly attribute SVGPreserveAspectRatio preserveAspectRatio; */
|
||||
NS_IMETHODIMP
|
||||
SVGSymbolElement::GetPreserveAspectRatio(nsISupports
|
||||
**aPreserveAspectRatio)
|
||||
{
|
||||
*aPreserveAspectRatio = PreserveAspectRatio().get();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
already_AddRefed<DOMSVGAnimatedPreserveAspectRatio>
|
||||
SVGSymbolElement::PreserveAspectRatio()
|
||||
{
|
||||
nsRefPtr<DOMSVGAnimatedPreserveAspectRatio> ratio;
|
||||
mPreserveAspectRatio.ToDOMAnimatedPreserveAspectRatio(getter_AddRefs(ratio), this);
|
||||
ratio.forget(aPreserveAspectRatio);
|
||||
return NS_OK;
|
||||
return ratio.forget();
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -31,6 +31,7 @@ protected:
|
||||
friend nsresult (::NS_NewSVGSymbolElement(nsIContent **aResult,
|
||||
already_AddRefed<nsINodeInfo> aNodeInfo));
|
||||
SVGSymbolElement(already_AddRefed<nsINodeInfo> aNodeInfo);
|
||||
virtual JSObject* WrapNode(JSContext *cx, JSObject *scope, bool *triedToWrap) MOZ_OVERRIDE;
|
||||
|
||||
public:
|
||||
// interfaces:
|
||||
@ -52,6 +53,11 @@ public:
|
||||
virtual nsXPCClassInfo* GetClassInfo();
|
||||
|
||||
virtual nsIDOMNode* AsDOMNode() { return this; }
|
||||
|
||||
// WebIDL
|
||||
already_AddRefed<nsIDOMSVGAnimatedRect> ViewBox();
|
||||
already_AddRefed<DOMSVGAnimatedPreserveAspectRatio> PreserveAspectRatio();
|
||||
|
||||
protected:
|
||||
virtual nsSVGViewBox *GetViewBox();
|
||||
virtual SVGAnimatedPreserveAspectRatio *GetPreserveAspectRatio();
|
||||
|
@ -14,7 +14,9 @@ interface SVGAnimatedRect;
|
||||
|
||||
[NoInterfaceObject]
|
||||
interface SVGFitToViewBox {
|
||||
[Constant]
|
||||
readonly attribute SVGAnimatedRect viewBox;
|
||||
[Constant]
|
||||
readonly attribute SVGAnimatedPreserveAspectRatio preserveAspectRatio;
|
||||
};
|
||||
|
||||
|
17
dom/webidl/SVGSymbolElement.webidl
Normal file
17
dom/webidl/SVGSymbolElement.webidl
Normal file
@ -0,0 +1,17 @@
|
||||
/* -*- 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/struct.html#InterfaceSVGSymbolElement
|
||||
*
|
||||
* Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C
|
||||
* liability, trademark and document use rules apply.
|
||||
*/
|
||||
|
||||
interface SVGSymbolElement : SVGElement {
|
||||
};
|
||||
|
||||
SVGSymbolElement implements SVGFitToViewBox;
|
||||
SVGSymbolElement implements SVGTests;
|
@ -148,6 +148,7 @@ webidl_files = \
|
||||
SVGStyleElement.webidl \
|
||||
SVGSVGElement.webidl \
|
||||
SVGSwitchElement.webidl \
|
||||
SVGSymbolElement.webidl \
|
||||
SVGTests.webidl \
|
||||
SVGTextContentElement.webidl \
|
||||
SVGTextElement.webidl \
|
||||
|
Loading…
Reference in New Issue
Block a user