1 : /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 : /* ***** BEGIN LICENSE BLOCK *****
3 : * Version: MPL 1.1/GPL 2.0/LGPL 2.1
4 : *
5 : * The contents of this file are subject to the Mozilla Public License Version
6 : * 1.1 (the "License"); you may not use this file except in compliance with
7 : * the License. You may obtain a copy of the License at
8 : * http://www.mozilla.org/MPL/
9 : *
10 : * Software distributed under the License is distributed on an "AS IS" basis,
11 : * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 : * for the specific language governing rights and limitations under the
13 : * License.
14 : *
15 : * The Original Code is Mozilla SVG Project code.
16 : *
17 : * The Initial Developer of the Original Code is the Mozilla Foundation.
18 : * Portions created by the Initial Developer are Copyright (C) 2010
19 : * the Initial Developer. All Rights Reserved.
20 : *
21 : * Contributor(s):
22 : *
23 : * Alternatively, the contents of this file may be used under the terms of
24 : * either the GNU General Public License Version 2 or later (the "GPL"), or
25 : * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
26 : * in which case the provisions of the GPL or the LGPL are applicable instead
27 : * of those above. If you wish to allow use of your version of this file only
28 : * under the terms of either the GPL or the LGPL, and not to allow others to
29 : * use your version of this file under the terms of the MPL, indicate your
30 : * decision by deleting the provisions above and replace them with the notice
31 : * and other provisions required by the GPL or the LGPL. If you do not delete
32 : * the provisions above, a recipient may use your version of this file under
33 : * the terms of any one of the MPL, the GPL or the LGPL.
34 : *
35 : * ***** END LICENSE BLOCK ***** */
36 :
37 : #include "mozilla/Util.h"
38 :
39 : #include "DOMSVGPathSeg.h"
40 : #include "DOMSVGPathSegList.h"
41 : #include "SVGPathSegUtils.h"
42 : #include "SVGAnimatedPathSegList.h"
43 : #include "nsSVGElement.h"
44 : #include "nsIDOMSVGPathSeg.h"
45 : #include "nsDOMError.h"
46 : #include "nsContentUtils.h"
47 :
48 : // See the architecture comment in DOMSVGPathSegList.h.
49 :
50 : using namespace mozilla;
51 :
52 : // We could use NS_IMPL_CYCLE_COLLECTION_1, except that in Unlink() we need to
53 : // clear our list's weak ref to us to be safe. (The other option would be to
54 : // not unlink and rely on the breaking of the other edges in the cycle, as
55 : // NS_SVG_VAL_IMPL_CYCLE_COLLECTION does.)
56 1464 : NS_IMPL_CYCLE_COLLECTION_CLASS(DOMSVGPathSeg)
57 0 : NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(DOMSVGPathSeg)
58 : // We may not belong to a list, so we must null check tmp->mList.
59 0 : if (tmp->mList) {
60 0 : tmp->mList->ItemAt(tmp->mListIndex) = nsnull;
61 : }
62 0 : NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mList)
63 0 : NS_IMPL_CYCLE_COLLECTION_UNLINK_END
64 0 : NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(DOMSVGPathSeg)
65 0 : NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mList)
66 0 : NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
67 :
68 0 : NS_IMPL_CYCLE_COLLECTING_ADDREF(DOMSVGPathSeg)
69 0 : NS_IMPL_CYCLE_COLLECTING_RELEASE(DOMSVGPathSeg)
70 :
71 : DOMCI_DATA(SVGPathSeg, DOMSVGPathSeg)
72 :
73 0 : NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(DOMSVGPathSeg)
74 0 : NS_INTERFACE_MAP_ENTRY(DOMSVGPathSeg) // pseudo-interface
75 0 : NS_INTERFACE_MAP_ENTRY(nsIDOMSVGPathSeg)
76 0 : NS_INTERFACE_MAP_ENTRY(nsISupports)
77 0 : NS_INTERFACE_MAP_END
78 :
79 :
80 0 : DOMSVGPathSeg::DOMSVGPathSeg(DOMSVGPathSegList *aList,
81 : PRUint32 aListIndex,
82 : bool aIsAnimValItem)
83 : : mList(aList)
84 : , mListIndex(aListIndex)
85 0 : , mIsAnimValItem(aIsAnimValItem)
86 : {
87 : // These shifts are in sync with the members in the header.
88 0 : NS_ABORT_IF_FALSE(aList &&
89 : aListIndex <= MaxListIndex(), "bad arg");
90 :
91 0 : NS_ABORT_IF_FALSE(IndexIsValid(), "Bad index for DOMSVGPathSeg!");
92 0 : }
93 :
94 0 : DOMSVGPathSeg::DOMSVGPathSeg()
95 : : mList(nsnull)
96 : , mListIndex(0)
97 0 : , mIsAnimValItem(false)
98 : {
99 0 : }
100 :
101 : NS_IMETHODIMP
102 0 : DOMSVGPathSeg::GetPathSegType(PRUint16 *aPathSegType)
103 : {
104 0 : *aPathSegType = PRUint16(Type());
105 0 : return NS_OK;
106 : }
107 :
108 : NS_IMETHODIMP
109 0 : DOMSVGPathSeg::GetPathSegTypeAsLetter(nsAString &aPathSegTypeAsLetter)
110 : {
111 0 : aPathSegTypeAsLetter = SVGPathSegUtils::GetPathSegTypeAsLetter(Type());
112 0 : return NS_OK;
113 : }
114 :
115 : void
116 0 : DOMSVGPathSeg::InsertingIntoList(DOMSVGPathSegList *aList,
117 : PRUint32 aListIndex,
118 : bool aIsAnimValItem)
119 : {
120 0 : NS_ABORT_IF_FALSE(!HasOwner(), "Inserting item that is already in a list");
121 :
122 0 : mList = aList;
123 0 : mListIndex = aListIndex;
124 0 : mIsAnimValItem = aIsAnimValItem;
125 :
126 0 : NS_ABORT_IF_FALSE(IndexIsValid(), "Bad index for DOMSVGPathSeg!");
127 0 : }
128 :
129 : void
130 0 : DOMSVGPathSeg::RemovingFromList()
131 : {
132 0 : PRUint32 argCount = SVGPathSegUtils::ArgCountForType(Type());
133 : // InternalItem() + 1, because the args come after the encoded seg type
134 0 : memcpy(PtrToMemberArgs(), InternalItem() + 1, argCount * sizeof(float));
135 0 : mList = nsnull;
136 0 : mIsAnimValItem = false;
137 0 : }
138 :
139 : void
140 0 : DOMSVGPathSeg::ToSVGPathSegEncodedData(float* aRaw)
141 : {
142 0 : NS_ABORT_IF_FALSE(aRaw, "null pointer");
143 0 : PRUint32 argCount = SVGPathSegUtils::ArgCountForType(Type());
144 0 : if (IsInList()) {
145 : // 1 + argCount, because we're copying the encoded seg type and args
146 0 : memcpy(aRaw, InternalItem(), (1 + argCount) * sizeof(float));
147 : } else {
148 0 : aRaw[0] = SVGPathSegUtils::EncodeType(Type());
149 : // aRaw + 1, because the args go after the encoded seg type
150 0 : memcpy(aRaw + 1, PtrToMemberArgs(), argCount * sizeof(float));
151 : }
152 0 : }
153 :
154 : float*
155 0 : DOMSVGPathSeg::InternalItem()
156 : {
157 0 : PRUint32 dataIndex = mList->mItems[mListIndex].mInternalDataIndex;
158 0 : return &(mList->InternalList().mData[dataIndex]);
159 : }
160 :
161 : #ifdef DEBUG
162 : bool
163 0 : DOMSVGPathSeg::IndexIsValid()
164 : {
165 0 : SVGAnimatedPathSegList *alist = Element()->GetAnimPathSegList();
166 : return (mIsAnimValItem &&
167 0 : mListIndex < alist->GetAnimValue().CountItems()) ||
168 0 : (!mIsAnimValItem &&
169 0 : mListIndex < alist->GetBaseValue().CountItems());
170 : }
171 : #endif
172 :
173 :
174 : ////////////////////////////////////////////////////////////////////////
175 : // Implementation of DOMSVGPathSeg sub-classes below this point
176 :
177 : #define CHECK_ARG_COUNT_IN_SYNC(segType) \
178 : NS_ABORT_IF_FALSE(ArrayLength(mArgs) == \
179 : SVGPathSegUtils::ArgCountForType(PRUint32(segType)) || \
180 : PRUint32(segType) == nsIDOMSVGPathSeg::PATHSEG_CLOSEPATH, \
181 : "Arg count/array size out of sync")
182 :
183 : #define IMPL_SVGPATHSEG_SUBCLASS_COMMON(segName, segType) \
184 : DOMSVGPathSeg##segName(const float *aArgs) \
185 : : DOMSVGPathSeg() \
186 : { \
187 : CHECK_ARG_COUNT_IN_SYNC(segType); \
188 : memcpy(mArgs, aArgs, \
189 : SVGPathSegUtils::ArgCountForType(PRUint32(segType)) * sizeof(float)); \
190 : } \
191 : DOMSVGPathSeg##segName(DOMSVGPathSegList *aList, \
192 : PRUint32 aListIndex, \
193 : bool aIsAnimValItem) \
194 : : DOMSVGPathSeg(aList, aListIndex, aIsAnimValItem) \
195 : { \
196 : CHECK_ARG_COUNT_IN_SYNC(segType); \
197 : } \
198 : /* From DOMSVGPathSeg: */ \
199 : virtual PRUint32 \
200 : Type() const \
201 : { \
202 : return segType; \
203 : } \
204 : virtual DOMSVGPathSeg* \
205 : Clone() \
206 : { \
207 : /* InternalItem() + 1, because we're skipping the encoded seg type */ \
208 : float *args = IsInList() ? InternalItem() + 1 : mArgs; \
209 : return new DOMSVGPathSeg##segName(args); \
210 : } \
211 : virtual float* \
212 : PtrToMemberArgs() \
213 : { \
214 : return mArgs; \
215 : }
216 :
217 : #define IMPL_NSISUPPORTS_SVGPATHSEG_SUBCLASS(segName) \
218 : /* Forward to the CYCLE_COLLECTING_ADDREF on our base class */ \
219 : NS_IMPL_ADDREF_INHERITED(DOMSVGPathSeg##segName, DOMSVGPathSeg) \
220 : NS_IMPL_RELEASE_INHERITED(DOMSVGPathSeg##segName, DOMSVGPathSeg) \
221 : \
222 : DOMCI_DATA(SVGPathSeg##segName, DOMSVGPathSeg##segName) \
223 : \
224 : NS_INTERFACE_MAP_BEGIN(DOMSVGPathSeg##segName) \
225 : NS_INTERFACE_MAP_ENTRY(nsIDOMSVGPathSeg##segName) \
226 : NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(SVGPathSeg##segName) \
227 : NS_INTERFACE_MAP_END_INHERITING(DOMSVGPathSeg)
228 :
229 : #define IMPL_PROP_WITH_TYPE(segName, propName, index, type) \
230 : /* attribute type propName; */ \
231 : NS_IMETHODIMP \
232 : DOMSVGPathSeg##segName::Get##propName(type *a##propName) \
233 : { \
234 : if (mIsAnimValItem && HasOwner()) { \
235 : Element()->FlushAnimations(); /* May make HasOwner() == false */ \
236 : } \
237 : *a##propName = type(HasOwner() ? InternalItem()[1+index] : mArgs[index]); \
238 : return NS_OK; \
239 : } \
240 : NS_IMETHODIMP \
241 : DOMSVGPathSeg##segName::Set##propName(type a##propName) \
242 : { \
243 : if (mIsAnimValItem) { \
244 : return NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR; \
245 : } \
246 : NS_ENSURE_FINITE(float(a##propName), NS_ERROR_ILLEGAL_VALUE); \
247 : if (HasOwner()) { \
248 : if (InternalItem()[1+index] == float(a##propName)) { \
249 : return NS_OK; \
250 : } \
251 : NS_ABORT_IF_FALSE(IsInList(), "Will/DidChangePathSegList() is wrong"); \
252 : nsAttrValue emptyOrOldValue = Element()->WillChangePathSegList(); \
253 : InternalItem()[1+index] = float(a##propName); \
254 : Element()->DidChangePathSegList(emptyOrOldValue); \
255 : if (mList->AttrIsAnimating()) { \
256 : Element()->AnimationNeedsResample(); \
257 : } \
258 : } else { \
259 : mArgs[index] = float(a##propName); \
260 : } \
261 : return NS_OK; \
262 : }
263 :
264 : // For float, the normal type of arguments
265 : #define IMPL_FLOAT_PROP(segName, propName, index) \
266 : IMPL_PROP_WITH_TYPE(segName, propName, index, float)
267 :
268 : // For the boolean flags in arc commands
269 : #define IMPL_BOOL_PROP(segName, propName, index) \
270 : IMPL_PROP_WITH_TYPE(segName, propName, index, bool)
271 :
272 :
273 : ////////////////////////////////////////////////////////////////////////
274 :
275 : class DOMSVGPathSegClosePath
276 : : public DOMSVGPathSeg
277 : , public nsIDOMSVGPathSegClosePath
278 0 : {
279 : public:
280 0 : DOMSVGPathSegClosePath()
281 0 : : DOMSVGPathSeg()
282 : {
283 0 : }
284 :
285 : NS_DECL_ISUPPORTS
286 : NS_DECL_NSIDOMSVGPATHSEGCLOSEPATH
287 0 : IMPL_SVGPATHSEG_SUBCLASS_COMMON(ClosePath, PATHSEG_CLOSEPATH)
288 :
289 : protected:
290 : // To allow IMPL_SVGPATHSEG_SUBCLASS_COMMON above to compile we need an
291 : // mArgs, but since C++ doesn't allow zero-sized arrays we need to give it
292 : // one (unused) element.
293 : float mArgs[1];
294 : };
295 :
296 0 : IMPL_NSISUPPORTS_SVGPATHSEG_SUBCLASS(ClosePath)
297 :
298 :
299 : ////////////////////////////////////////////////////////////////////////
300 :
301 : class DOMSVGPathSegMovetoAbs
302 : : public DOMSVGPathSeg
303 : , public nsIDOMSVGPathSegMovetoAbs
304 0 : {
305 : public:
306 0 : DOMSVGPathSegMovetoAbs(float x, float y)
307 0 : : DOMSVGPathSeg()
308 : {
309 0 : mArgs[0] = x;
310 0 : mArgs[1] = y;
311 0 : }
312 :
313 : NS_DECL_ISUPPORTS
314 : NS_DECL_NSIDOMSVGPATHSEGMOVETOABS
315 0 : IMPL_SVGPATHSEG_SUBCLASS_COMMON(MovetoAbs, PATHSEG_MOVETO_ABS)
316 :
317 : protected:
318 : float mArgs[2];
319 : };
320 :
321 0 : IMPL_NSISUPPORTS_SVGPATHSEG_SUBCLASS(MovetoAbs)
322 :
323 0 : IMPL_FLOAT_PROP(MovetoAbs, X, 0)
324 0 : IMPL_FLOAT_PROP(MovetoAbs, Y, 1)
325 :
326 :
327 : ////////////////////////////////////////////////////////////////////////
328 :
329 : class DOMSVGPathSegMovetoRel
330 : : public DOMSVGPathSeg
331 : , public nsIDOMSVGPathSegMovetoRel
332 0 : {
333 : public:
334 0 : DOMSVGPathSegMovetoRel(float x, float y)
335 0 : : DOMSVGPathSeg()
336 : {
337 0 : mArgs[0] = x;
338 0 : mArgs[1] = y;
339 0 : }
340 :
341 : NS_DECL_ISUPPORTS
342 : NS_DECL_NSIDOMSVGPATHSEGMOVETOREL
343 0 : IMPL_SVGPATHSEG_SUBCLASS_COMMON(MovetoRel, PATHSEG_MOVETO_REL)
344 :
345 : protected:
346 : float mArgs[2];
347 : };
348 :
349 0 : IMPL_NSISUPPORTS_SVGPATHSEG_SUBCLASS(MovetoRel)
350 :
351 0 : IMPL_FLOAT_PROP(MovetoRel, X, 0)
352 0 : IMPL_FLOAT_PROP(MovetoRel, Y, 1)
353 :
354 :
355 :
356 : ////////////////////////////////////////////////////////////////////////
357 :
358 : class DOMSVGPathSegLinetoAbs
359 : : public DOMSVGPathSeg
360 : , public nsIDOMSVGPathSegLinetoAbs
361 0 : {
362 : public:
363 0 : DOMSVGPathSegLinetoAbs(float x, float y)
364 0 : : DOMSVGPathSeg()
365 : {
366 0 : mArgs[0] = x;
367 0 : mArgs[1] = y;
368 0 : }
369 :
370 : NS_DECL_ISUPPORTS
371 : NS_DECL_NSIDOMSVGPATHSEGLINETOABS
372 0 : IMPL_SVGPATHSEG_SUBCLASS_COMMON(LinetoAbs, PATHSEG_LINETO_ABS)
373 :
374 : protected:
375 : float mArgs[2];
376 : };
377 :
378 0 : IMPL_NSISUPPORTS_SVGPATHSEG_SUBCLASS(LinetoAbs)
379 :
380 0 : IMPL_FLOAT_PROP(LinetoAbs, X, 0)
381 0 : IMPL_FLOAT_PROP(LinetoAbs, Y, 1)
382 :
383 :
384 : ////////////////////////////////////////////////////////////////////////
385 :
386 : class DOMSVGPathSegLinetoRel
387 : : public DOMSVGPathSeg
388 : , public nsIDOMSVGPathSegLinetoRel
389 0 : {
390 : public:
391 0 : DOMSVGPathSegLinetoRel(float x, float y)
392 0 : : DOMSVGPathSeg()
393 : {
394 0 : mArgs[0] = x;
395 0 : mArgs[1] = y;
396 0 : }
397 :
398 : NS_DECL_ISUPPORTS
399 : NS_DECL_NSIDOMSVGPATHSEGLINETOREL
400 0 : IMPL_SVGPATHSEG_SUBCLASS_COMMON(LinetoRel, PATHSEG_LINETO_REL)
401 :
402 : protected:
403 : float mArgs[2];
404 : };
405 :
406 0 : IMPL_NSISUPPORTS_SVGPATHSEG_SUBCLASS(LinetoRel)
407 :
408 0 : IMPL_FLOAT_PROP(LinetoRel, X, 0)
409 0 : IMPL_FLOAT_PROP(LinetoRel, Y, 1)
410 :
411 :
412 : ////////////////////////////////////////////////////////////////////////
413 :
414 : class DOMSVGPathSegCurvetoCubicAbs
415 : : public DOMSVGPathSeg
416 : , public nsIDOMSVGPathSegCurvetoCubicAbs
417 0 : {
418 : public:
419 0 : DOMSVGPathSegCurvetoCubicAbs(float x1, float y1,
420 : float x2, float y2,
421 : float x, float y)
422 0 : : DOMSVGPathSeg()
423 : {
424 0 : mArgs[0] = x1;
425 0 : mArgs[1] = y1;
426 0 : mArgs[2] = x2;
427 0 : mArgs[3] = y2;
428 0 : mArgs[4] = x;
429 0 : mArgs[5] = y;
430 0 : }
431 :
432 : NS_DECL_ISUPPORTS
433 : NS_DECL_NSIDOMSVGPATHSEGCURVETOCUBICABS
434 0 : IMPL_SVGPATHSEG_SUBCLASS_COMMON(CurvetoCubicAbs, PATHSEG_CURVETO_CUBIC_ABS)
435 :
436 : protected:
437 : float mArgs[6];
438 : };
439 :
440 0 : IMPL_NSISUPPORTS_SVGPATHSEG_SUBCLASS(CurvetoCubicAbs)
441 :
442 0 : IMPL_FLOAT_PROP(CurvetoCubicAbs, X1, 0)
443 0 : IMPL_FLOAT_PROP(CurvetoCubicAbs, Y1, 1)
444 0 : IMPL_FLOAT_PROP(CurvetoCubicAbs, X2, 2)
445 0 : IMPL_FLOAT_PROP(CurvetoCubicAbs, Y2, 3)
446 0 : IMPL_FLOAT_PROP(CurvetoCubicAbs, X, 4)
447 0 : IMPL_FLOAT_PROP(CurvetoCubicAbs, Y, 5)
448 :
449 :
450 : ////////////////////////////////////////////////////////////////////////
451 :
452 : class DOMSVGPathSegCurvetoCubicRel
453 : : public DOMSVGPathSeg
454 : , public nsIDOMSVGPathSegCurvetoCubicRel
455 0 : {
456 : public:
457 0 : DOMSVGPathSegCurvetoCubicRel(float x1, float y1,
458 : float x2, float y2,
459 : float x, float y)
460 0 : : DOMSVGPathSeg()
461 : {
462 0 : mArgs[0] = x1;
463 0 : mArgs[1] = y1;
464 0 : mArgs[2] = x2;
465 0 : mArgs[3] = y2;
466 0 : mArgs[4] = x;
467 0 : mArgs[5] = y;
468 0 : }
469 :
470 : NS_DECL_ISUPPORTS
471 : NS_DECL_NSIDOMSVGPATHSEGCURVETOCUBICREL
472 0 : IMPL_SVGPATHSEG_SUBCLASS_COMMON(CurvetoCubicRel, PATHSEG_CURVETO_CUBIC_REL)
473 :
474 : protected:
475 : float mArgs[6];
476 : };
477 :
478 0 : IMPL_NSISUPPORTS_SVGPATHSEG_SUBCLASS(CurvetoCubicRel)
479 :
480 0 : IMPL_FLOAT_PROP(CurvetoCubicRel, X1, 0)
481 0 : IMPL_FLOAT_PROP(CurvetoCubicRel, Y1, 1)
482 0 : IMPL_FLOAT_PROP(CurvetoCubicRel, X2, 2)
483 0 : IMPL_FLOAT_PROP(CurvetoCubicRel, Y2, 3)
484 0 : IMPL_FLOAT_PROP(CurvetoCubicRel, X, 4)
485 0 : IMPL_FLOAT_PROP(CurvetoCubicRel, Y, 5)
486 :
487 :
488 : ////////////////////////////////////////////////////////////////////////
489 :
490 : class DOMSVGPathSegCurvetoQuadraticAbs
491 : : public DOMSVGPathSeg
492 : , public nsIDOMSVGPathSegCurvetoQuadraticAbs
493 0 : {
494 : public:
495 0 : DOMSVGPathSegCurvetoQuadraticAbs(float x1, float y1,
496 : float x, float y)
497 0 : : DOMSVGPathSeg()
498 : {
499 0 : mArgs[0] = x1;
500 0 : mArgs[1] = y1;
501 0 : mArgs[2] = x;
502 0 : mArgs[3] = y;
503 0 : }
504 :
505 : NS_DECL_ISUPPORTS
506 : NS_DECL_NSIDOMSVGPATHSEGCURVETOQUADRATICABS
507 0 : IMPL_SVGPATHSEG_SUBCLASS_COMMON(CurvetoQuadraticAbs, PATHSEG_CURVETO_QUADRATIC_ABS)
508 :
509 : protected:
510 : float mArgs[4];
511 : };
512 :
513 0 : IMPL_NSISUPPORTS_SVGPATHSEG_SUBCLASS(CurvetoQuadraticAbs)
514 :
515 0 : IMPL_FLOAT_PROP(CurvetoQuadraticAbs, X1, 0)
516 0 : IMPL_FLOAT_PROP(CurvetoQuadraticAbs, Y1, 1)
517 0 : IMPL_FLOAT_PROP(CurvetoQuadraticAbs, X, 2)
518 0 : IMPL_FLOAT_PROP(CurvetoQuadraticAbs, Y, 3)
519 :
520 :
521 : ////////////////////////////////////////////////////////////////////////
522 :
523 : class DOMSVGPathSegCurvetoQuadraticRel
524 : : public DOMSVGPathSeg
525 : , public nsIDOMSVGPathSegCurvetoQuadraticRel
526 0 : {
527 : public:
528 0 : DOMSVGPathSegCurvetoQuadraticRel(float x1, float y1,
529 : float x, float y)
530 0 : : DOMSVGPathSeg()
531 : {
532 0 : mArgs[0] = x1;
533 0 : mArgs[1] = y1;
534 0 : mArgs[2] = x;
535 0 : mArgs[3] = y;
536 0 : }
537 :
538 : NS_DECL_ISUPPORTS
539 : NS_DECL_NSIDOMSVGPATHSEGCURVETOQUADRATICREL
540 0 : IMPL_SVGPATHSEG_SUBCLASS_COMMON(CurvetoQuadraticRel, PATHSEG_CURVETO_QUADRATIC_REL)
541 :
542 : protected:
543 : float mArgs[4];
544 : };
545 :
546 0 : IMPL_NSISUPPORTS_SVGPATHSEG_SUBCLASS(CurvetoQuadraticRel)
547 :
548 0 : IMPL_FLOAT_PROP(CurvetoQuadraticRel, X1, 0)
549 0 : IMPL_FLOAT_PROP(CurvetoQuadraticRel, Y1, 1)
550 0 : IMPL_FLOAT_PROP(CurvetoQuadraticRel, X, 2)
551 0 : IMPL_FLOAT_PROP(CurvetoQuadraticRel, Y, 3)
552 :
553 :
554 : ////////////////////////////////////////////////////////////////////////
555 :
556 : class DOMSVGPathSegArcAbs
557 : : public DOMSVGPathSeg
558 : , public nsIDOMSVGPathSegArcAbs
559 0 : {
560 : public:
561 0 : DOMSVGPathSegArcAbs(float r1, float r2, float angle,
562 : bool largeArcFlag, bool sweepFlag,
563 : float x, float y)
564 0 : : DOMSVGPathSeg()
565 : {
566 0 : mArgs[0] = r1;
567 0 : mArgs[1] = r2;
568 0 : mArgs[2] = angle;
569 0 : mArgs[3] = largeArcFlag;
570 0 : mArgs[4] = sweepFlag;
571 0 : mArgs[5] = x;
572 0 : mArgs[6] = y;
573 0 : }
574 :
575 : NS_DECL_ISUPPORTS
576 : NS_DECL_NSIDOMSVGPATHSEGARCABS
577 0 : IMPL_SVGPATHSEG_SUBCLASS_COMMON(ArcAbs, PATHSEG_ARC_ABS)
578 :
579 : protected:
580 : float mArgs[7];
581 : };
582 :
583 0 : IMPL_NSISUPPORTS_SVGPATHSEG_SUBCLASS(ArcAbs)
584 :
585 0 : IMPL_FLOAT_PROP(ArcAbs, R1, 0)
586 0 : IMPL_FLOAT_PROP(ArcAbs, R2, 1)
587 0 : IMPL_FLOAT_PROP(ArcAbs, Angle, 2)
588 0 : IMPL_BOOL_PROP(ArcAbs, LargeArcFlag, 3)
589 0 : IMPL_BOOL_PROP(ArcAbs, SweepFlag, 4)
590 0 : IMPL_FLOAT_PROP(ArcAbs, X, 5)
591 0 : IMPL_FLOAT_PROP(ArcAbs, Y, 6)
592 :
593 :
594 : ////////////////////////////////////////////////////////////////////////
595 :
596 : class DOMSVGPathSegArcRel
597 : : public DOMSVGPathSeg
598 : , public nsIDOMSVGPathSegArcRel
599 0 : {
600 : public:
601 0 : DOMSVGPathSegArcRel(float r1, float r2, float angle,
602 : bool largeArcFlag, bool sweepFlag,
603 : float x, float y)
604 0 : : DOMSVGPathSeg()
605 : {
606 0 : mArgs[0] = r1;
607 0 : mArgs[1] = r2;
608 0 : mArgs[2] = angle;
609 0 : mArgs[3] = largeArcFlag;
610 0 : mArgs[4] = sweepFlag;
611 0 : mArgs[5] = x;
612 0 : mArgs[6] = y;
613 0 : }
614 :
615 : NS_DECL_ISUPPORTS
616 : NS_DECL_NSIDOMSVGPATHSEGARCREL
617 0 : IMPL_SVGPATHSEG_SUBCLASS_COMMON(ArcRel, PATHSEG_ARC_REL)
618 :
619 : protected:
620 : float mArgs[7];
621 : };
622 :
623 0 : IMPL_NSISUPPORTS_SVGPATHSEG_SUBCLASS(ArcRel)
624 :
625 0 : IMPL_FLOAT_PROP(ArcRel, R1, 0)
626 0 : IMPL_FLOAT_PROP(ArcRel, R2, 1)
627 0 : IMPL_FLOAT_PROP(ArcRel, Angle, 2)
628 0 : IMPL_BOOL_PROP(ArcRel, LargeArcFlag, 3)
629 0 : IMPL_BOOL_PROP(ArcRel, SweepFlag, 4)
630 0 : IMPL_FLOAT_PROP(ArcRel, X, 5)
631 0 : IMPL_FLOAT_PROP(ArcRel, Y, 6)
632 :
633 :
634 : ////////////////////////////////////////////////////////////////////////
635 :
636 : class DOMSVGPathSegLinetoHorizontalAbs
637 : : public DOMSVGPathSeg
638 : , public nsIDOMSVGPathSegLinetoHorizontalAbs
639 0 : {
640 : public:
641 0 : DOMSVGPathSegLinetoHorizontalAbs(float x)
642 0 : : DOMSVGPathSeg()
643 : {
644 0 : mArgs[0] = x;
645 0 : }
646 :
647 : NS_DECL_ISUPPORTS
648 : NS_DECL_NSIDOMSVGPATHSEGLINETOHORIZONTALABS
649 0 : IMPL_SVGPATHSEG_SUBCLASS_COMMON(LinetoHorizontalAbs, PATHSEG_LINETO_HORIZONTAL_ABS)
650 :
651 : protected:
652 : float mArgs[1];
653 : };
654 :
655 0 : IMPL_NSISUPPORTS_SVGPATHSEG_SUBCLASS(LinetoHorizontalAbs)
656 :
657 0 : IMPL_FLOAT_PROP(LinetoHorizontalAbs, X, 0)
658 :
659 :
660 : ////////////////////////////////////////////////////////////////////////
661 :
662 : class DOMSVGPathSegLinetoHorizontalRel
663 : : public DOMSVGPathSeg
664 : , public nsIDOMSVGPathSegLinetoHorizontalRel
665 0 : {
666 : public:
667 0 : DOMSVGPathSegLinetoHorizontalRel(float x)
668 0 : : DOMSVGPathSeg()
669 : {
670 0 : mArgs[0] = x;
671 0 : }
672 :
673 : NS_DECL_ISUPPORTS
674 : NS_DECL_NSIDOMSVGPATHSEGLINETOHORIZONTALREL
675 0 : IMPL_SVGPATHSEG_SUBCLASS_COMMON(LinetoHorizontalRel, PATHSEG_LINETO_HORIZONTAL_REL)
676 :
677 : protected:
678 : float mArgs[1];
679 : };
680 :
681 0 : IMPL_NSISUPPORTS_SVGPATHSEG_SUBCLASS(LinetoHorizontalRel)
682 :
683 0 : IMPL_FLOAT_PROP(LinetoHorizontalRel, X, 0)
684 :
685 :
686 : ////////////////////////////////////////////////////////////////////////
687 :
688 : class DOMSVGPathSegLinetoVerticalAbs
689 : : public DOMSVGPathSeg
690 : , public nsIDOMSVGPathSegLinetoVerticalAbs
691 0 : {
692 : public:
693 0 : DOMSVGPathSegLinetoVerticalAbs(float y)
694 0 : : DOMSVGPathSeg()
695 : {
696 0 : mArgs[0] = y;
697 0 : }
698 :
699 : NS_DECL_ISUPPORTS
700 : NS_DECL_NSIDOMSVGPATHSEGLINETOVERTICALABS
701 0 : IMPL_SVGPATHSEG_SUBCLASS_COMMON(LinetoVerticalAbs, PATHSEG_LINETO_VERTICAL_ABS)
702 :
703 : protected:
704 : float mArgs[1];
705 : };
706 :
707 0 : IMPL_NSISUPPORTS_SVGPATHSEG_SUBCLASS(LinetoVerticalAbs)
708 :
709 0 : IMPL_FLOAT_PROP(LinetoVerticalAbs, Y, 0)
710 :
711 :
712 : ////////////////////////////////////////////////////////////////////////
713 :
714 : class DOMSVGPathSegLinetoVerticalRel
715 : : public DOMSVGPathSeg
716 : , public nsIDOMSVGPathSegLinetoVerticalRel
717 0 : {
718 : public:
719 0 : DOMSVGPathSegLinetoVerticalRel(float y)
720 0 : : DOMSVGPathSeg()
721 : {
722 0 : mArgs[0] = y;
723 0 : }
724 :
725 : NS_DECL_ISUPPORTS
726 : NS_DECL_NSIDOMSVGPATHSEGLINETOVERTICALREL
727 0 : IMPL_SVGPATHSEG_SUBCLASS_COMMON(LinetoVerticalRel, PATHSEG_LINETO_VERTICAL_REL)
728 :
729 : protected:
730 : float mArgs[1];
731 : };
732 :
733 0 : IMPL_NSISUPPORTS_SVGPATHSEG_SUBCLASS(LinetoVerticalRel)
734 :
735 0 : IMPL_FLOAT_PROP(LinetoVerticalRel, Y, 0)
736 :
737 :
738 : ////////////////////////////////////////////////////////////////////////
739 :
740 : class DOMSVGPathSegCurvetoCubicSmoothAbs
741 : : public DOMSVGPathSeg
742 : , public nsIDOMSVGPathSegCurvetoCubicSmoothAbs
743 0 : {
744 : public:
745 0 : DOMSVGPathSegCurvetoCubicSmoothAbs(float x2, float y2,
746 : float x, float y)
747 0 : : DOMSVGPathSeg()
748 : {
749 0 : mArgs[0] = x2;
750 0 : mArgs[1] = y2;
751 0 : mArgs[2] = x;
752 0 : mArgs[3] = y;
753 0 : }
754 :
755 : NS_DECL_ISUPPORTS
756 : NS_DECL_NSIDOMSVGPATHSEGCURVETOCUBICSMOOTHABS
757 0 : IMPL_SVGPATHSEG_SUBCLASS_COMMON(CurvetoCubicSmoothAbs, PATHSEG_CURVETO_CUBIC_SMOOTH_ABS)
758 :
759 : protected:
760 : float mArgs[4];
761 : };
762 :
763 0 : IMPL_NSISUPPORTS_SVGPATHSEG_SUBCLASS(CurvetoCubicSmoothAbs)
764 :
765 0 : IMPL_FLOAT_PROP(CurvetoCubicSmoothAbs, X2, 0)
766 0 : IMPL_FLOAT_PROP(CurvetoCubicSmoothAbs, Y2, 1)
767 0 : IMPL_FLOAT_PROP(CurvetoCubicSmoothAbs, X, 2)
768 0 : IMPL_FLOAT_PROP(CurvetoCubicSmoothAbs, Y, 3)
769 :
770 :
771 : ////////////////////////////////////////////////////////////////////////
772 :
773 : class DOMSVGPathSegCurvetoCubicSmoothRel
774 : : public DOMSVGPathSeg
775 : , public nsIDOMSVGPathSegCurvetoCubicSmoothRel
776 0 : {
777 : public:
778 0 : DOMSVGPathSegCurvetoCubicSmoothRel(float x2, float y2,
779 : float x, float y)
780 0 : : DOMSVGPathSeg()
781 : {
782 0 : mArgs[0] = x2;
783 0 : mArgs[1] = y2;
784 0 : mArgs[2] = x;
785 0 : mArgs[3] = y;
786 0 : }
787 :
788 : NS_DECL_ISUPPORTS
789 : NS_DECL_NSIDOMSVGPATHSEGCURVETOCUBICSMOOTHREL
790 0 : IMPL_SVGPATHSEG_SUBCLASS_COMMON(CurvetoCubicSmoothRel, PATHSEG_CURVETO_CUBIC_SMOOTH_REL)
791 :
792 : protected:
793 : float mArgs[4];
794 : };
795 :
796 0 : IMPL_NSISUPPORTS_SVGPATHSEG_SUBCLASS(CurvetoCubicSmoothRel)
797 :
798 0 : IMPL_FLOAT_PROP(CurvetoCubicSmoothRel, X2, 0)
799 0 : IMPL_FLOAT_PROP(CurvetoCubicSmoothRel, Y2, 1)
800 0 : IMPL_FLOAT_PROP(CurvetoCubicSmoothRel, X, 2)
801 0 : IMPL_FLOAT_PROP(CurvetoCubicSmoothRel, Y, 3)
802 :
803 :
804 : ////////////////////////////////////////////////////////////////////////
805 :
806 : class DOMSVGPathSegCurvetoQuadraticSmoothAbs
807 : : public DOMSVGPathSeg
808 : , public nsIDOMSVGPathSegCurvetoQuadraticSmoothAbs
809 0 : {
810 : public:
811 0 : DOMSVGPathSegCurvetoQuadraticSmoothAbs(float x, float y)
812 0 : : DOMSVGPathSeg()
813 : {
814 0 : mArgs[0] = x;
815 0 : mArgs[1] = y;
816 0 : }
817 :
818 : NS_DECL_ISUPPORTS
819 : NS_DECL_NSIDOMSVGPATHSEGCURVETOQUADRATICSMOOTHABS
820 0 : IMPL_SVGPATHSEG_SUBCLASS_COMMON(CurvetoQuadraticSmoothAbs, PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS)
821 :
822 : protected:
823 : float mArgs[2];
824 : };
825 :
826 0 : IMPL_NSISUPPORTS_SVGPATHSEG_SUBCLASS(CurvetoQuadraticSmoothAbs)
827 :
828 0 : IMPL_FLOAT_PROP(CurvetoQuadraticSmoothAbs, X, 0)
829 0 : IMPL_FLOAT_PROP(CurvetoQuadraticSmoothAbs, Y, 1)
830 :
831 :
832 : ////////////////////////////////////////////////////////////////////////
833 :
834 : class DOMSVGPathSegCurvetoQuadraticSmoothRel
835 : : public DOMSVGPathSeg
836 : , public nsIDOMSVGPathSegCurvetoQuadraticSmoothRel
837 0 : {
838 : public:
839 0 : DOMSVGPathSegCurvetoQuadraticSmoothRel(float x, float y)
840 0 : : DOMSVGPathSeg()
841 : {
842 0 : mArgs[0] = x;
843 0 : mArgs[1] = y;
844 0 : }
845 :
846 : NS_DECL_ISUPPORTS
847 : NS_DECL_NSIDOMSVGPATHSEGCURVETOQUADRATICSMOOTHREL
848 0 : IMPL_SVGPATHSEG_SUBCLASS_COMMON(CurvetoQuadraticSmoothRel, PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL)
849 :
850 : protected:
851 : float mArgs[2];
852 : };
853 :
854 0 : IMPL_NSISUPPORTS_SVGPATHSEG_SUBCLASS(CurvetoQuadraticSmoothRel)
855 :
856 0 : IMPL_FLOAT_PROP(CurvetoQuadraticSmoothRel, X, 0)
857 0 : IMPL_FLOAT_PROP(CurvetoQuadraticSmoothRel, Y, 1)
858 :
859 :
860 :
861 : // This must come after DOMSVGPathSegClosePath et. al. have been declared.
862 : /* static */ DOMSVGPathSeg*
863 0 : DOMSVGPathSeg::CreateFor(DOMSVGPathSegList *aList,
864 : PRUint32 aListIndex,
865 : bool aIsAnimValItem)
866 : {
867 0 : PRUint32 dataIndex = aList->mItems[aListIndex].mInternalDataIndex;
868 0 : float *data = &aList->InternalList().mData[dataIndex];
869 0 : PRUint32 type = SVGPathSegUtils::DecodeType(data[0]);
870 :
871 0 : switch (type)
872 : {
873 : case nsIDOMSVGPathSeg::PATHSEG_CLOSEPATH:
874 0 : return new DOMSVGPathSegClosePath(aList, aListIndex, aIsAnimValItem);
875 : case nsIDOMSVGPathSeg::PATHSEG_MOVETO_ABS:
876 0 : return new DOMSVGPathSegMovetoAbs(aList, aListIndex, aIsAnimValItem);
877 : case nsIDOMSVGPathSeg::PATHSEG_MOVETO_REL:
878 0 : return new DOMSVGPathSegMovetoRel(aList, aListIndex, aIsAnimValItem);
879 : case nsIDOMSVGPathSeg::PATHSEG_LINETO_ABS:
880 0 : return new DOMSVGPathSegLinetoAbs(aList, aListIndex, aIsAnimValItem);
881 : case nsIDOMSVGPathSeg::PATHSEG_LINETO_REL:
882 0 : return new DOMSVGPathSegLinetoRel(aList, aListIndex, aIsAnimValItem);
883 : case nsIDOMSVGPathSeg::PATHSEG_CURVETO_CUBIC_ABS:
884 0 : return new DOMSVGPathSegCurvetoCubicAbs(aList, aListIndex, aIsAnimValItem);
885 : case nsIDOMSVGPathSeg::PATHSEG_CURVETO_CUBIC_REL:
886 0 : return new DOMSVGPathSegCurvetoCubicRel(aList, aListIndex, aIsAnimValItem);
887 : case nsIDOMSVGPathSeg::PATHSEG_CURVETO_QUADRATIC_ABS:
888 0 : return new DOMSVGPathSegCurvetoQuadraticAbs(aList, aListIndex, aIsAnimValItem);
889 : case nsIDOMSVGPathSeg::PATHSEG_CURVETO_QUADRATIC_REL:
890 0 : return new DOMSVGPathSegCurvetoQuadraticRel(aList, aListIndex, aIsAnimValItem);
891 : case nsIDOMSVGPathSeg::PATHSEG_ARC_ABS:
892 0 : return new DOMSVGPathSegArcAbs(aList, aListIndex, aIsAnimValItem);
893 : case nsIDOMSVGPathSeg::PATHSEG_ARC_REL:
894 0 : return new DOMSVGPathSegArcRel(aList, aListIndex, aIsAnimValItem);
895 : case nsIDOMSVGPathSeg::PATHSEG_LINETO_HORIZONTAL_ABS:
896 0 : return new DOMSVGPathSegLinetoHorizontalAbs(aList, aListIndex, aIsAnimValItem);
897 : case nsIDOMSVGPathSeg::PATHSEG_LINETO_HORIZONTAL_REL:
898 0 : return new DOMSVGPathSegLinetoHorizontalRel(aList, aListIndex, aIsAnimValItem);
899 : case nsIDOMSVGPathSeg::PATHSEG_LINETO_VERTICAL_ABS:
900 0 : return new DOMSVGPathSegLinetoVerticalAbs(aList, aListIndex, aIsAnimValItem);
901 : case nsIDOMSVGPathSeg::PATHSEG_LINETO_VERTICAL_REL:
902 0 : return new DOMSVGPathSegLinetoVerticalRel(aList, aListIndex, aIsAnimValItem);
903 : case nsIDOMSVGPathSeg::PATHSEG_CURVETO_CUBIC_SMOOTH_ABS:
904 0 : return new DOMSVGPathSegCurvetoCubicSmoothAbs(aList, aListIndex, aIsAnimValItem);
905 : case nsIDOMSVGPathSeg::PATHSEG_CURVETO_CUBIC_SMOOTH_REL:
906 0 : return new DOMSVGPathSegCurvetoCubicSmoothRel(aList, aListIndex, aIsAnimValItem);
907 : case nsIDOMSVGPathSeg::PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS:
908 0 : return new DOMSVGPathSegCurvetoQuadraticSmoothAbs(aList, aListIndex, aIsAnimValItem);
909 : case nsIDOMSVGPathSeg::PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL:
910 0 : return new DOMSVGPathSegCurvetoQuadraticSmoothRel(aList, aListIndex, aIsAnimValItem);
911 : default:
912 0 : NS_NOTREACHED("Invalid path segment type");
913 0 : return nsnull;
914 : }
915 : }
916 :
917 :
918 :
919 :
920 : nsIDOMSVGPathSeg*
921 0 : NS_NewSVGPathSegClosePath()
922 : {
923 0 : return new DOMSVGPathSegClosePath();
924 : }
925 :
926 : nsIDOMSVGPathSeg*
927 0 : NS_NewSVGPathSegMovetoAbs(float x, float y)
928 : {
929 0 : return new DOMSVGPathSegMovetoAbs(x, y);
930 : }
931 :
932 : nsIDOMSVGPathSeg*
933 0 : NS_NewSVGPathSegMovetoRel(float x, float y)
934 : {
935 0 : return new DOMSVGPathSegMovetoRel(x, y);
936 : }
937 :
938 : nsIDOMSVGPathSeg*
939 0 : NS_NewSVGPathSegLinetoAbs(float x, float y)
940 : {
941 0 : return new DOMSVGPathSegLinetoAbs(x, y);
942 : }
943 :
944 : nsIDOMSVGPathSeg*
945 0 : NS_NewSVGPathSegLinetoRel(float x, float y)
946 : {
947 0 : return new DOMSVGPathSegLinetoRel(x, y);
948 : }
949 :
950 : nsIDOMSVGPathSeg*
951 0 : NS_NewSVGPathSegCurvetoCubicAbs(float x, float y,
952 : float x1, float y1,
953 : float x2, float y2)
954 : {
955 : // Note that we swap from DOM API argument order to the argument order used
956 : // in the <path> element's 'd' attribute (i.e. we put the arguments for the
957 : // end point of the segment last instead of first).
958 :
959 0 : return new DOMSVGPathSegCurvetoCubicAbs(x1, y1, x2, y2, x, y);
960 : }
961 :
962 : nsIDOMSVGPathSeg*
963 0 : NS_NewSVGPathSegCurvetoCubicRel(float x, float y,
964 : float x1, float y1,
965 : float x2, float y2)
966 : {
967 : // See comment in NS_NewSVGPathSegCurvetoCubicAbs!
968 :
969 0 : return new DOMSVGPathSegCurvetoCubicRel(x1, y1, x2, y2, x, y);
970 : }
971 :
972 : nsIDOMSVGPathSeg*
973 0 : NS_NewSVGPathSegCurvetoQuadraticAbs(float x, float y,
974 : float x1, float y1)
975 : {
976 : // See comment in NS_NewSVGPathSegCurvetoCubicAbs!
977 :
978 0 : return new DOMSVGPathSegCurvetoQuadraticAbs(x1, y1, x, y);
979 : }
980 :
981 : nsIDOMSVGPathSeg*
982 0 : NS_NewSVGPathSegCurvetoQuadraticRel(float x, float y,
983 : float x1, float y1)
984 : {
985 : // See comment in NS_NewSVGPathSegCurvetoCubicAbs!
986 :
987 0 : return new DOMSVGPathSegCurvetoQuadraticRel(x1, y1, x, y);
988 : }
989 :
990 : nsIDOMSVGPathSeg*
991 0 : NS_NewSVGPathSegArcAbs(float x, float y,
992 : float r1, float r2, float angle,
993 : bool largeArcFlag, bool sweepFlag)
994 : {
995 : // See comment in NS_NewSVGPathSegCurvetoCubicAbs!
996 :
997 0 : return new DOMSVGPathSegArcAbs(r1, r2, angle, largeArcFlag, sweepFlag, x, y);
998 : }
999 :
1000 : nsIDOMSVGPathSeg*
1001 0 : NS_NewSVGPathSegArcRel(float x, float y,
1002 : float r1, float r2, float angle,
1003 : bool largeArcFlag, bool sweepFlag)
1004 : {
1005 : // See comment in NS_NewSVGPathSegCurvetoCubicAbs!
1006 :
1007 0 : return new DOMSVGPathSegArcRel(r1, r2, angle, largeArcFlag, sweepFlag, x, y);
1008 : }
1009 :
1010 : nsIDOMSVGPathSeg*
1011 0 : NS_NewSVGPathSegLinetoHorizontalAbs(float x)
1012 : {
1013 0 : return new DOMSVGPathSegLinetoHorizontalAbs(x);
1014 : }
1015 :
1016 : nsIDOMSVGPathSeg*
1017 0 : NS_NewSVGPathSegLinetoHorizontalRel(float x)
1018 : {
1019 0 : return new DOMSVGPathSegLinetoHorizontalRel(x);
1020 : }
1021 :
1022 : nsIDOMSVGPathSeg*
1023 0 : NS_NewSVGPathSegLinetoVerticalAbs(float y)
1024 : {
1025 0 : return new DOMSVGPathSegLinetoVerticalAbs(y);
1026 : }
1027 :
1028 : nsIDOMSVGPathSeg*
1029 0 : NS_NewSVGPathSegLinetoVerticalRel(float y)
1030 : {
1031 0 : return new DOMSVGPathSegLinetoVerticalRel(y);
1032 : }
1033 :
1034 : nsIDOMSVGPathSeg*
1035 0 : NS_NewSVGPathSegCurvetoCubicSmoothAbs(float x, float y,
1036 : float x2, float y2)
1037 : {
1038 : // See comment in NS_NewSVGPathSegCurvetoCubicAbs!
1039 :
1040 0 : return new DOMSVGPathSegCurvetoCubicSmoothAbs(x2, y2, x, y);
1041 : }
1042 :
1043 : nsIDOMSVGPathSeg*
1044 0 : NS_NewSVGPathSegCurvetoCubicSmoothRel(float x, float y,
1045 : float x2, float y2)
1046 : {
1047 : // See comment in NS_NewSVGPathSegCurvetoCubicAbs!
1048 :
1049 0 : return new DOMSVGPathSegCurvetoCubicSmoothRel(x2, y2, x, y);
1050 : }
1051 :
1052 : nsIDOMSVGPathSeg*
1053 0 : NS_NewSVGPathSegCurvetoQuadraticSmoothAbs(float x, float y)
1054 : {
1055 0 : return new DOMSVGPathSegCurvetoQuadraticSmoothAbs(x, y);
1056 : }
1057 :
1058 : nsIDOMSVGPathSeg*
1059 0 : NS_NewSVGPathSegCurvetoQuadraticSmoothRel(float x, float y)
1060 : {
1061 0 : return new DOMSVGPathSegCurvetoQuadraticSmoothRel(x, y);
1062 4392 : }
1063 :
|