mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 825147: Convert SVGPolygonElement and SVGPolylineElement to WebIDL r=bz
--HG-- rename : content/svg/content/src/nsSVGPolygonElement.cpp => content/svg/content/src/SVGPolygonElement.cpp rename : content/svg/content/src/nsSVGPolygonElement.cpp => content/svg/content/src/SVGPolygonElement.h rename : content/svg/content/src/nsSVGPolylineElement.cpp => content/svg/content/src/SVGPolylineElement.cpp rename : content/svg/content/src/nsSVGPolylineElement.cpp => content/svg/content/src/SVGPolylineElement.h
This commit is contained in:
parent
1832141c50
commit
cf966f28d5
@ -45,8 +45,8 @@ function testVariablesFiltering()
|
||||
"There should be 0 variables displayed in the test scope");
|
||||
is(loadScope.querySelectorAll(".variable:not([non-match])").length, 1,
|
||||
"There should be 1 variable displayed in the load scope");
|
||||
is(globalScope.querySelectorAll(".variable:not([non-match])").length, 5,
|
||||
"There should be 5 variables displayed in the global scope");
|
||||
is(globalScope.querySelectorAll(".variable:not([non-match])").length, 6,
|
||||
"There should be 6 variables displayed in the global scope");
|
||||
|
||||
is(innerScope.querySelectorAll(".property:not([non-match])").length, 0,
|
||||
"There should be 0 properties displayed in the inner scope");
|
||||
|
@ -65,8 +65,6 @@ CPPSRCS = \
|
||||
nsSVGPathGeometryElement.cpp \
|
||||
nsSVGPatternElement.cpp \
|
||||
nsSVGPolyElement.cpp \
|
||||
nsSVGPolygonElement.cpp \
|
||||
nsSVGPolylineElement.cpp \
|
||||
nsSVGString.cpp \
|
||||
nsSVGRect.cpp \
|
||||
nsSVGRectElement.cpp \
|
||||
@ -130,6 +128,8 @@ CPPSRCS = \
|
||||
SVGOrientSMILType.cpp \
|
||||
SVGPathSegListSMILType.cpp \
|
||||
SVGPointListSMILType.cpp \
|
||||
SVGPolygonElement.cpp \
|
||||
SVGPolylineElement.cpp \
|
||||
SVGScriptElement.cpp \
|
||||
SVGStopElement.cpp \
|
||||
SVGSwitchElement.cpp \
|
||||
@ -165,6 +165,8 @@ EXPORTS_mozilla/dom = \
|
||||
SVGLocatableElement.h \
|
||||
SVGMetadataElement.h \
|
||||
SVGMPathElement.h \
|
||||
SVGPolygonElement.h \
|
||||
SVGPolylineElement.h \
|
||||
SVGScriptElement.h \
|
||||
SVGStopElement.h \
|
||||
SVGStyleElement.h \
|
||||
|
82
content/svg/content/src/SVGPolygonElement.cpp
Normal file
82
content/svg/content/src/SVGPolygonElement.cpp
Normal file
@ -0,0 +1,82 @@
|
||||
/* -*- 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 "mozilla/dom/SVGPolygonElement.h"
|
||||
#include "mozilla/dom/SVGPolygonElementBinding.h"
|
||||
#include "gfxContext.h"
|
||||
#include "SVGContentUtils.h"
|
||||
|
||||
DOMCI_NODE_DATA(SVGPolygonElement, mozilla::dom::SVGPolygonElement)
|
||||
|
||||
NS_IMPL_NS_NEW_NAMESPACED_SVG_ELEMENT(Polygon)
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
JSObject*
|
||||
SVGPolygonElement::WrapNode(JSContext *aCx, JSObject *aScope, bool *aTriedToWrap)
|
||||
{
|
||||
return SVGPolygonElementBinding::Wrap(aCx, aScope, this, aTriedToWrap);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// nsISupports methods
|
||||
|
||||
NS_IMPL_ADDREF_INHERITED(SVGPolygonElement,SVGPolygonElementBase)
|
||||
NS_IMPL_RELEASE_INHERITED(SVGPolygonElement,SVGPolygonElementBase)
|
||||
|
||||
NS_INTERFACE_TABLE_HEAD(SVGPolygonElement)
|
||||
NS_NODE_INTERFACE_TABLE4(SVGPolygonElement, nsIDOMNode, nsIDOMElement,
|
||||
nsIDOMSVGElement,
|
||||
nsIDOMSVGPolygonElement)
|
||||
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(SVGPolygonElement)
|
||||
NS_INTERFACE_MAP_END_INHERITING(SVGPolygonElementBase)
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Implementation
|
||||
|
||||
SVGPolygonElement::SVGPolygonElement(already_AddRefed<nsINodeInfo> aNodeInfo)
|
||||
: SVGPolygonElementBase(aNodeInfo)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// nsIDOMNode methods
|
||||
|
||||
NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGPolygonElement)
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// nsSVGPathGeometryElement methods
|
||||
|
||||
void
|
||||
SVGPolygonElement::GetMarkPoints(nsTArray<nsSVGMark> *aMarks)
|
||||
{
|
||||
nsSVGPolyElement::GetMarkPoints(aMarks);
|
||||
if (aMarks->Length() > 0) {
|
||||
nsSVGMark *endMark = &aMarks->ElementAt(aMarks->Length()-1);
|
||||
nsSVGMark *startMark = &aMarks->ElementAt(0);
|
||||
float angle = atan2(startMark->y - endMark->y, startMark->x - endMark->x);
|
||||
|
||||
endMark->angle = SVGContentUtils::AngleBisect(angle, endMark->angle);
|
||||
startMark->angle = SVGContentUtils::AngleBisect(angle, startMark->angle);
|
||||
// for a polygon (as opposed to a polyline) there's an implicit extra point
|
||||
// co-located with the start point that nsSVGPolyElement::GetMarkPoints
|
||||
// doesn't return
|
||||
aMarks->AppendElement(nsSVGMark(startMark->x, startMark->y, startMark->angle));
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
SVGPolygonElement::ConstructPath(gfxContext *aCtx)
|
||||
{
|
||||
SVGPolygonElementBase::ConstructPath(aCtx);
|
||||
// the difference between a polyline and a polygon is that the
|
||||
// polygon is closed:
|
||||
aCtx->ClosePath();
|
||||
}
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
54
content/svg/content/src/SVGPolygonElement.h
Normal file
54
content/svg/content/src/SVGPolygonElement.h
Normal file
@ -0,0 +1,54 @@
|
||||
/* -*- 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 mozilla_dom_SVGPolygonElement_h
|
||||
#define mozilla_dom_SVGPolygonElement_h
|
||||
|
||||
#include "nsSVGPolyElement.h"
|
||||
#include "nsIDOMSVGPolygonElement.h"
|
||||
|
||||
nsresult NS_NewSVGPolygonElement(nsIContent **aResult,
|
||||
already_AddRefed<nsINodeInfo> aNodeInfo);
|
||||
|
||||
typedef nsSVGPolyElement SVGPolygonElementBase;
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
class SVGPolygonElement MOZ_FINAL : public SVGPolygonElementBase,
|
||||
public nsIDOMSVGPolygonElement
|
||||
{
|
||||
protected:
|
||||
SVGPolygonElement(already_AddRefed<nsINodeInfo> aNodeInfo);
|
||||
virtual JSObject* WrapNode(JSContext *cx, JSObject *scope, bool *triedToWrap) MOZ_OVERRIDE;
|
||||
friend nsresult (::NS_NewSVGPolygonElement(nsIContent **aResult,
|
||||
already_AddRefed<nsINodeInfo> aNodeInfo));
|
||||
|
||||
public:
|
||||
// interfaces:
|
||||
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
NS_DECL_NSIDOMSVGPOLYGONELEMENT
|
||||
|
||||
// xxx I wish we could use virtual inheritance
|
||||
NS_FORWARD_NSIDOMNODE_TO_NSINODE
|
||||
NS_FORWARD_NSIDOMELEMENT_TO_GENERIC
|
||||
NS_FORWARD_NSIDOMSVGELEMENT(SVGPolygonElementBase::)
|
||||
|
||||
// nsSVGPathGeometryElement methods:
|
||||
virtual void GetMarkPoints(nsTArray<nsSVGMark> *aMarks);
|
||||
virtual void ConstructPath(gfxContext *aCtx);
|
||||
|
||||
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
|
||||
|
||||
virtual nsXPCClassInfo* GetClassInfo();
|
||||
|
||||
virtual nsIDOMNode* AsDOMNode() { return this; }
|
||||
};
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
||||
#endif // mozilla_dom_SVGPolygonElement_h
|
50
content/svg/content/src/SVGPolylineElement.cpp
Normal file
50
content/svg/content/src/SVGPolylineElement.cpp
Normal file
@ -0,0 +1,50 @@
|
||||
/* -*- 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 "mozilla/dom/SVGPolylineElement.h"
|
||||
#include "mozilla/dom/SVGPolylineElementBinding.h"
|
||||
|
||||
DOMCI_NODE_DATA(SVGPolylineElement, mozilla::dom::SVGPolylineElement)
|
||||
|
||||
NS_IMPL_NS_NEW_NAMESPACED_SVG_ELEMENT(Polyline)
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
JSObject*
|
||||
SVGPolylineElement::WrapNode(JSContext *aCx, JSObject *aScope, bool *aTriedToWrap)
|
||||
{
|
||||
return SVGPolylineElementBinding::Wrap(aCx, aScope, this, aTriedToWrap);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// nsISupports methods
|
||||
|
||||
NS_IMPL_ADDREF_INHERITED(SVGPolylineElement,SVGPolylineElementBase)
|
||||
NS_IMPL_RELEASE_INHERITED(SVGPolylineElement,SVGPolylineElementBase)
|
||||
|
||||
NS_INTERFACE_TABLE_HEAD(SVGPolylineElement)
|
||||
NS_NODE_INTERFACE_TABLE4(SVGPolylineElement, nsIDOMNode, nsIDOMElement,
|
||||
nsIDOMSVGElement,
|
||||
nsIDOMSVGPolylineElement)
|
||||
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(SVGPolylineElement)
|
||||
NS_INTERFACE_MAP_END_INHERITING(SVGPolylineElementBase)
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Implementation
|
||||
|
||||
SVGPolylineElement::SVGPolylineElement(already_AddRefed<nsINodeInfo> aNodeInfo)
|
||||
: SVGPolylineElementBase(aNodeInfo)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// nsIDOMNode methods
|
||||
|
||||
NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGPolylineElement)
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
49
content/svg/content/src/SVGPolylineElement.h
Normal file
49
content/svg/content/src/SVGPolylineElement.h
Normal file
@ -0,0 +1,49 @@
|
||||
/* -*- 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 mozilla_dom_SVGPolylineElement_h
|
||||
#define mozilla_dom_SVGPolylineElement_h
|
||||
|
||||
#include "nsSVGPolyElement.h"
|
||||
#include "nsIDOMSVGPolylineElement.h"
|
||||
|
||||
nsresult NS_NewSVGPolylineElement(nsIContent **aResult,
|
||||
already_AddRefed<nsINodeInfo> aNodeInfo);
|
||||
|
||||
typedef nsSVGPolyElement SVGPolylineElementBase;
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
class SVGPolylineElement MOZ_FINAL : public SVGPolylineElementBase,
|
||||
public nsIDOMSVGPolylineElement
|
||||
{
|
||||
protected:
|
||||
SVGPolylineElement(already_AddRefed<nsINodeInfo> aNodeInfo);
|
||||
virtual JSObject* WrapNode(JSContext *cx, JSObject *scope, bool *triedToWrap) MOZ_OVERRIDE;
|
||||
friend nsresult (::NS_NewSVGPolylineElement(nsIContent **aResult,
|
||||
already_AddRefed<nsINodeInfo> aNodeInfo));
|
||||
|
||||
public:
|
||||
// interfaces:
|
||||
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
NS_DECL_NSIDOMSVGPOLYLINEELEMENT
|
||||
|
||||
// xxx I wish we could use virtual inheritance
|
||||
NS_FORWARD_NSIDOMNODE_TO_NSINODE
|
||||
NS_FORWARD_NSIDOMELEMENT_TO_GENERIC
|
||||
NS_FORWARD_NSIDOMSVGELEMENT(SVGPolylineElementBase::)
|
||||
|
||||
// nsIContent interface
|
||||
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
|
||||
virtual nsXPCClassInfo* GetClassInfo();
|
||||
virtual nsIDOMNode* AsDOMNode() { return this; }
|
||||
};
|
||||
|
||||
} // namespace mozilla
|
||||
} // namespace dom
|
||||
|
||||
#endif // mozilla_dom_SVGPolylineElement_h
|
@ -28,30 +28,45 @@ NS_INTERFACE_MAP_END_INHERITING(nsSVGPolyElementBase)
|
||||
nsSVGPolyElement::nsSVGPolyElement(already_AddRefed<nsINodeInfo> aNodeInfo)
|
||||
: nsSVGPolyElementBase(aNodeInfo)
|
||||
{
|
||||
|
||||
SetIsDOMBinding();
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// nsIDOMSGAnimatedPoints methods:
|
||||
|
||||
/* readonly attribute DOMSVGPointList points; */
|
||||
NS_IMETHODIMP
|
||||
NS_IMETHODIMP
|
||||
nsSVGPolyElement::GetPoints(nsISupports * *aPoints)
|
||||
{
|
||||
void *key = mPoints.GetBaseValKey();
|
||||
*aPoints = DOMSVGPointList::GetDOMWrapper(key, this, false).get();
|
||||
*aPoints = Points().get();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
already_AddRefed<DOMSVGPointList>
|
||||
nsSVGPolyElement::Points()
|
||||
{
|
||||
void *key = mPoints.GetBaseValKey();
|
||||
nsRefPtr<DOMSVGPointList> points = DOMSVGPointList::GetDOMWrapper(key, this, false);
|
||||
return points.forget();
|
||||
}
|
||||
|
||||
/* readonly attribute DOMSVGPointList animatedPoints; */
|
||||
NS_IMETHODIMP
|
||||
NS_IMETHODIMP
|
||||
nsSVGPolyElement::GetAnimatedPoints(nsISupports * *aAnimatedPoints)
|
||||
{
|
||||
void *key = mPoints.GetAnimValKey();
|
||||
*aAnimatedPoints = DOMSVGPointList::GetDOMWrapper(key, this, true).get();
|
||||
*aAnimatedPoints = AnimatedPoints().get();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
already_AddRefed<DOMSVGPointList>
|
||||
nsSVGPolyElement::AnimatedPoints()
|
||||
{
|
||||
void *key = mPoints.GetAnimValKey();
|
||||
nsRefPtr<DOMSVGPointList> points = DOMSVGPointList::GetDOMWrapper(key, this, true);
|
||||
return points.forget();
|
||||
}
|
||||
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// nsIContent methods
|
||||
|
||||
|
@ -14,6 +14,10 @@ typedef nsSVGPathGeometryElement nsSVGPolyElementBase;
|
||||
|
||||
class gfxContext;
|
||||
|
||||
namespace mozilla {
|
||||
class DOMSVGPointList;
|
||||
}
|
||||
|
||||
class nsSVGPolyElement : public nsSVGPolyElementBase,
|
||||
public nsIDOMSVGAnimatedPoints
|
||||
{
|
||||
@ -42,6 +46,10 @@ public:
|
||||
virtual void GetMarkPoints(nsTArray<nsSVGMark> *aMarks);
|
||||
virtual void ConstructPath(gfxContext *aCtx);
|
||||
|
||||
// WebIDL
|
||||
already_AddRefed<mozilla::DOMSVGPointList> Points();
|
||||
already_AddRefed<mozilla::DOMSVGPointList> AnimatedPoints();
|
||||
|
||||
protected:
|
||||
SVGAnimatedPointList mPoints;
|
||||
};
|
||||
|
@ -1,104 +0,0 @@
|
||||
/* -*- 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 "nsSVGPolyElement.h"
|
||||
#include "nsIDOMSVGPolygonElement.h"
|
||||
#include "gfxContext.h"
|
||||
#include "SVGContentUtils.h"
|
||||
|
||||
typedef nsSVGPolyElement nsSVGPolygonElementBase;
|
||||
|
||||
class nsSVGPolygonElement : public nsSVGPolygonElementBase,
|
||||
public nsIDOMSVGPolygonElement
|
||||
{
|
||||
protected:
|
||||
friend nsresult NS_NewSVGPolygonElement(nsIContent **aResult,
|
||||
already_AddRefed<nsINodeInfo> aNodeInfo);
|
||||
nsSVGPolygonElement(already_AddRefed<nsINodeInfo> aNodeInfo);
|
||||
|
||||
public:
|
||||
// interfaces:
|
||||
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
NS_DECL_NSIDOMSVGPOLYGONELEMENT
|
||||
|
||||
// xxx I wish we could use virtual inheritance
|
||||
NS_FORWARD_NSIDOMNODE_TO_NSINODE
|
||||
NS_FORWARD_NSIDOMELEMENT_TO_GENERIC
|
||||
NS_FORWARD_NSIDOMSVGELEMENT(nsSVGPolygonElementBase::)
|
||||
|
||||
// nsSVGPathGeometryElement methods:
|
||||
virtual void GetMarkPoints(nsTArray<nsSVGMark> *aMarks);
|
||||
virtual void ConstructPath(gfxContext *aCtx);
|
||||
|
||||
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
|
||||
|
||||
virtual nsXPCClassInfo* GetClassInfo();
|
||||
|
||||
virtual nsIDOMNode* AsDOMNode() { return this; }
|
||||
};
|
||||
|
||||
NS_IMPL_NS_NEW_SVG_ELEMENT(Polygon)
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// nsISupports methods
|
||||
|
||||
NS_IMPL_ADDREF_INHERITED(nsSVGPolygonElement,nsSVGPolygonElementBase)
|
||||
NS_IMPL_RELEASE_INHERITED(nsSVGPolygonElement,nsSVGPolygonElementBase)
|
||||
|
||||
DOMCI_NODE_DATA(SVGPolygonElement, nsSVGPolygonElement)
|
||||
|
||||
NS_INTERFACE_TABLE_HEAD(nsSVGPolygonElement)
|
||||
NS_NODE_INTERFACE_TABLE4(nsSVGPolygonElement, nsIDOMNode, nsIDOMElement,
|
||||
nsIDOMSVGElement,
|
||||
nsIDOMSVGPolygonElement)
|
||||
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(SVGPolygonElement)
|
||||
NS_INTERFACE_MAP_END_INHERITING(nsSVGPolygonElementBase)
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Implementation
|
||||
|
||||
nsSVGPolygonElement::nsSVGPolygonElement(already_AddRefed<nsINodeInfo> aNodeInfo)
|
||||
: nsSVGPolygonElementBase(aNodeInfo)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// nsIDOMNode methods
|
||||
|
||||
NS_IMPL_ELEMENT_CLONE_WITH_INIT(nsSVGPolygonElement)
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// nsSVGPathGeometryElement methods
|
||||
|
||||
void
|
||||
nsSVGPolygonElement::GetMarkPoints(nsTArray<nsSVGMark> *aMarks)
|
||||
{
|
||||
nsSVGPolyElement::GetMarkPoints(aMarks);
|
||||
if (aMarks->Length() > 0) {
|
||||
nsSVGMark *endMark = &aMarks->ElementAt(aMarks->Length()-1);
|
||||
nsSVGMark *startMark = &aMarks->ElementAt(0);
|
||||
float angle = atan2(startMark->y - endMark->y, startMark->x - endMark->x);
|
||||
|
||||
endMark->angle = SVGContentUtils::AngleBisect(angle, endMark->angle);
|
||||
startMark->angle = SVGContentUtils::AngleBisect(angle, startMark->angle);
|
||||
// for a polygon (as opposed to a polyline) there's an implicit extra point
|
||||
// co-located with the start point that nsSVGPolyElement::GetMarkPoints
|
||||
// doesn't return
|
||||
aMarks->AppendElement(nsSVGMark(startMark->x, startMark->y, startMark->angle));
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
nsSVGPolygonElement::ConstructPath(gfxContext *aCtx)
|
||||
{
|
||||
nsSVGPolygonElementBase::ConstructPath(aCtx);
|
||||
// the difference between a polyline and a polygon is that the
|
||||
// polygon is closed:
|
||||
aCtx->ClosePath();
|
||||
}
|
||||
|
||||
|
@ -1,65 +0,0 @@
|
||||
/* -*- 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 "nsSVGPolyElement.h"
|
||||
#include "nsIDOMSVGPolylineElement.h"
|
||||
|
||||
typedef nsSVGPolyElement nsSVGPolylineElementBase;
|
||||
|
||||
class nsSVGPolylineElement : public nsSVGPolylineElementBase,
|
||||
public nsIDOMSVGPolylineElement
|
||||
{
|
||||
protected:
|
||||
friend nsresult NS_NewSVGPolylineElement(nsIContent **aResult,
|
||||
already_AddRefed<nsINodeInfo> aNodeInfo);
|
||||
nsSVGPolylineElement(already_AddRefed<nsINodeInfo> aNodeInfo);
|
||||
|
||||
public:
|
||||
// interfaces:
|
||||
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
NS_DECL_NSIDOMSVGPOLYLINEELEMENT
|
||||
|
||||
// xxx I wish we could use virtual inheritance
|
||||
NS_FORWARD_NSIDOMNODE_TO_NSINODE
|
||||
NS_FORWARD_NSIDOMELEMENT_TO_GENERIC
|
||||
NS_FORWARD_NSIDOMSVGELEMENT(nsSVGPolylineElementBase::)
|
||||
|
||||
// nsIContent interface
|
||||
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
|
||||
virtual nsXPCClassInfo* GetClassInfo();
|
||||
virtual nsIDOMNode* AsDOMNode() { return this; }
|
||||
};
|
||||
|
||||
NS_IMPL_NS_NEW_SVG_ELEMENT(Polyline)
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// nsISupports methods
|
||||
|
||||
NS_IMPL_ADDREF_INHERITED(nsSVGPolylineElement,nsSVGPolylineElementBase)
|
||||
NS_IMPL_RELEASE_INHERITED(nsSVGPolylineElement,nsSVGPolylineElementBase)
|
||||
|
||||
DOMCI_NODE_DATA(SVGPolylineElement, nsSVGPolylineElement)
|
||||
|
||||
NS_INTERFACE_TABLE_HEAD(nsSVGPolylineElement)
|
||||
NS_NODE_INTERFACE_TABLE4(nsSVGPolylineElement, nsIDOMNode, nsIDOMElement,
|
||||
nsIDOMSVGElement,
|
||||
nsIDOMSVGPolylineElement)
|
||||
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(SVGPolylineElement)
|
||||
NS_INTERFACE_MAP_END_INHERITING(nsSVGPolylineElementBase)
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Implementation
|
||||
|
||||
nsSVGPolylineElement::nsSVGPolylineElement(already_AddRefed<nsINodeInfo> aNodeInfo)
|
||||
: nsSVGPolylineElementBase(aNodeInfo)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// nsIDOMNode methods
|
||||
|
||||
NS_IMPL_ELEMENT_CLONE_WITH_INIT(nsSVGPolylineElement)
|
20
dom/webidl/SVGAnimatedPoints.webidl
Normal file
20
dom/webidl/SVGAnimatedPoints.webidl
Normal 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.
|
||||
*/
|
||||
|
||||
[NoInterfaceObject]
|
||||
interface SVGAnimatedPoints {
|
||||
[Constant]
|
||||
readonly attribute SVGPointList points;
|
||||
[Constant]
|
||||
readonly attribute SVGPointList animatedPoints;
|
||||
};
|
||||
|
17
dom/webidl/SVGPolygonElement.webidl
Normal file
17
dom/webidl/SVGPolygonElement.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/
|
||||
*
|
||||
* Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C
|
||||
* liability, trademark and document use rules apply.
|
||||
*/
|
||||
|
||||
interface SVGPolygonElement : SVGGraphicsElement {
|
||||
};
|
||||
|
||||
SVGPolygonElement implements SVGAnimatedPoints;
|
||||
|
17
dom/webidl/SVGPolylineElement.webidl
Normal file
17
dom/webidl/SVGPolylineElement.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/
|
||||
*
|
||||
* Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C
|
||||
* liability, trademark and document use rules apply.
|
||||
*/
|
||||
|
||||
interface SVGPolylineElement : SVGGraphicsElement {
|
||||
};
|
||||
|
||||
SVGPolylineElement implements SVGAnimatedPoints;
|
||||
|
@ -101,6 +101,7 @@ webidl_files = \
|
||||
SVGAnimatedBoolean.webidl \
|
||||
SVGAnimatedLengthList.webidl \
|
||||
SVGAnimatedNumberList.webidl \
|
||||
SVGAnimatedPoints.webidl \
|
||||
SVGAnimatedPreserveAspectRatio.webidl \
|
||||
SVGAnimatedTransformList.webidl \
|
||||
SVGDefsElement.webidl \
|
||||
@ -120,6 +121,8 @@ webidl_files = \
|
||||
SVGPathSegList.webidl \
|
||||
SVGPoint.webidl \
|
||||
SVGPointList.webidl \
|
||||
SVGPolygonElement.webidl \
|
||||
SVGPolylineElement.webidl \
|
||||
SVGPreserveAspectRatio.webidl \
|
||||
SVGScriptElement.webidl \
|
||||
SVGStopElement.webidl \
|
||||
|
Loading…
Reference in New Issue
Block a user