Line data Source code
1 : /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 : /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 : /* This Source Code Form is subject to the terms of the Mozilla Public
4 : * License, v. 2.0. If a copy of the MPL was not distributed with this
5 : * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 :
7 : #ifndef MOZILLA_DOMSVGPATHSEG_H__
8 : #define MOZILLA_DOMSVGPATHSEG_H__
9 :
10 : #include "DOMSVGPathSegList.h"
11 : #include "nsCycleCollectionParticipant.h"
12 : #include "nsWrapperCache.h"
13 : #include "SVGPathSegUtils.h"
14 : #include "mozilla/dom/SVGPathSegBinding.h"
15 :
16 : class nsSVGElement;
17 :
18 : #define MOZ_SVG_LIST_INDEX_BIT_COUNT 31
19 :
20 : namespace mozilla {
21 :
22 : #define CHECK_ARG_COUNT_IN_SYNC(segType) \
23 : MOZ_ASSERT(ArrayLength(mArgs) == \
24 : SVGPathSegUtils::ArgCountForType(uint32_t(segType)) || \
25 : uint32_t(segType) == PATHSEG_CLOSEPATH, \
26 : "Arg count/array size out of sync")
27 :
28 : #define IMPL_SVGPATHSEG_SUBCLASS_COMMON(segName, segType) \
29 : explicit DOMSVGPathSeg##segName(const float *aArgs) \
30 : : DOMSVGPathSeg() \
31 : { \
32 : CHECK_ARG_COUNT_IN_SYNC(segType); \
33 : memcpy(mArgs, aArgs, \
34 : SVGPathSegUtils::ArgCountForType(uint32_t(segType)) * sizeof(float)); \
35 : } \
36 : DOMSVGPathSeg##segName(DOMSVGPathSegList *aList, \
37 : uint32_t aListIndex, \
38 : bool aIsAnimValItem) \
39 : : DOMSVGPathSeg(aList, aListIndex, aIsAnimValItem) \
40 : { \
41 : CHECK_ARG_COUNT_IN_SYNC(segType); \
42 : } \
43 : /* From DOMSVGPathSeg: */ \
44 : virtual uint32_t \
45 : Type() const override \
46 : { \
47 : return segType; \
48 : } \
49 : virtual DOMSVGPathSeg* \
50 : Clone() override \
51 : { \
52 : /* InternalItem() + 1, because we're skipping the encoded seg type */ \
53 : float *args = IsInList() ? InternalItem() + 1 : mArgs; \
54 : return new DOMSVGPathSeg##segName(args); \
55 : } \
56 : virtual float* \
57 : PtrToMemberArgs() override \
58 : { \
59 : return mArgs; \
60 : } \
61 : \
62 : virtual JSObject* \
63 : WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override \
64 : { \
65 : return dom::SVGPathSeg##segName##Binding::Wrap(aCx, this, aGivenProto); \
66 : }
67 :
68 :
69 : /**
70 : * Class DOMSVGPathSeg
71 : *
72 : * This class is the base class of the classes that create the DOM objects that
73 : * wrap the internal path segments that are encoded in an SVGPathData. Its
74 : * sub-classes are also used to create the objects returned by
75 : * SVGPathElement.createSVGPathSegXxx().
76 : *
77 : * See the architecture comment in DOMSVGPathSegList.h for an overview of the
78 : * important points regarding these DOM wrapper structures.
79 : *
80 : * See the architecture comment in DOMSVGLength.h (yes, LENGTH) for an overview
81 : * of the important points regarding how this specific class works.
82 : *
83 : * The main differences between this class and DOMSVGLength is that we have
84 : * sub-classes (it does not), and the "internal counterpart" that we provide a
85 : * DOM wrapper for is a list of floats, not an instance of an internal class.
86 : */
87 : class DOMSVGPathSeg : public nsWrapperCache
88 : {
89 : friend class AutoChangePathSegNotifier;
90 :
91 : public:
92 0 : NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(DOMSVGPathSeg)
93 0 : NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS(DOMSVGPathSeg)
94 :
95 : /**
96 : * Unlike the other list classes, we hide our ctor (because no one should be
97 : * creating instances of this class directly). This factory method in exposed
98 : * instead to take care of creating instances of the correct sub-class.
99 : */
100 : static DOMSVGPathSeg *CreateFor(DOMSVGPathSegList *aList,
101 : uint32_t aListIndex,
102 : bool aIsAnimValItem);
103 :
104 : /**
105 : * Create an unowned copy of this object. The caller is responsible for the
106 : * first AddRef()!
107 : */
108 : virtual DOMSVGPathSeg* Clone() = 0;
109 :
110 0 : bool IsInList() const {
111 0 : return !!mList;
112 : }
113 :
114 : /**
115 : * In future, if this class is used for non-list segments, this will be
116 : * different to IsInList().
117 : */
118 0 : bool HasOwner() const {
119 0 : return !!mList;
120 : }
121 :
122 : /**
123 : * This method is called to notify this DOM object that it is being inserted
124 : * into a list, and give it the information it needs as a result.
125 : *
126 : * This object MUST NOT already belong to a list when this method is called.
127 : * That's not to say that script can't move these DOM objects between
128 : * lists - it can - it's just that the logic to handle that (and send out
129 : * the necessary notifications) is located elsewhere (in DOMSVGPathSegList).)
130 : */
131 : void InsertingIntoList(DOMSVGPathSegList *aList,
132 : uint32_t aListIndex,
133 : bool aIsAnimValItem);
134 :
135 0 : static uint32_t MaxListIndex() {
136 0 : return (1U << MOZ_SVG_LIST_INDEX_BIT_COUNT) - 1;
137 : }
138 :
139 : /// This method is called to notify this object that its list index changed.
140 0 : void UpdateListIndex(uint32_t aListIndex) {
141 0 : mListIndex = aListIndex;
142 0 : }
143 :
144 : /**
145 : * This method is called to notify this DOM object that it is about to be
146 : * removed from its current DOM list so that it can first make a copy of its
147 : * internal counterpart's values. (If it didn't do this, then it would
148 : * "lose" its value on being removed.)
149 : */
150 : void RemovingFromList();
151 :
152 : /**
153 : * This method converts the segment to a string of floats as found in
154 : * SVGPathData (i.e. the first float contains the type of the segment,
155 : * encoded into a float, followed by its arguments in the same order as they
156 : * are given in the <path> element's 'd' attribute).
157 : */
158 : void ToSVGPathSegEncodedData(float *aData);
159 :
160 : /**
161 : * The type of this path segment.
162 : */
163 : virtual uint32_t Type() const = 0;
164 :
165 : // WebIDL
166 0 : DOMSVGPathSegList* GetParentObject() { return mList; }
167 0 : uint16_t PathSegType() const { return Type(); }
168 0 : void GetPathSegTypeAsLetter(nsAString &aPathSegTypeAsLetter)
169 0 : { aPathSegTypeAsLetter = SVGPathSegUtils::GetPathSegTypeAsLetter(Type()); }
170 : virtual JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override = 0;
171 :
172 : protected:
173 :
174 : /**
175 : * Generic ctor for DOMSVGPathSeg objects that are created for an attribute.
176 : */
177 : DOMSVGPathSeg(DOMSVGPathSegList *aList,
178 : uint32_t aListIndex,
179 : bool aIsAnimValItem);
180 :
181 : /**
182 : * Ctor for creating the objects returned by
183 : * SVGPathElement.createSVGPathSegXxx(), which do not initially belong to an
184 : * attribute.
185 : */
186 : DOMSVGPathSeg();
187 :
188 0 : virtual ~DOMSVGPathSeg() {
189 : // Our mList's weak ref to us must be nulled out when we die. If GC has
190 : // unlinked us using the cycle collector code, then that has already
191 : // happened, and mList is null.
192 0 : if (mList) {
193 0 : mList->ItemAt(mListIndex) = nullptr;
194 : }
195 0 : }
196 :
197 0 : nsSVGElement* Element() {
198 0 : return mList->Element();
199 : }
200 :
201 : /**
202 : * Get a reference to the internal SVGPathSeg list item that this DOM wrapper
203 : * object currently wraps.
204 : *
205 : * To simplify the code we just have this one method for obtaining both
206 : * baseVal and animVal internal items. This means that animVal items don't
207 : * get const protection, but then our setter methods guard against changing
208 : * animVal items.
209 : */
210 : float* InternalItem();
211 :
212 : virtual float* PtrToMemberArgs() = 0;
213 :
214 : #ifdef DEBUG
215 : bool IndexIsValid();
216 : #endif
217 :
218 : RefPtr<DOMSVGPathSegList> mList;
219 :
220 : // Bounds for the following are checked in the ctor, so be sure to update
221 : // that if you change the capacity of any of the following.
222 :
223 : uint32_t mListIndex:MOZ_SVG_LIST_INDEX_BIT_COUNT;
224 : uint32_t mIsAnimValItem:1; // uint32_t because MSVC won't pack otherwise
225 : };
226 :
227 0 : class DOMSVGPathSegClosePath
228 : : public DOMSVGPathSeg
229 : {
230 : public:
231 0 : DOMSVGPathSegClosePath()
232 0 : : DOMSVGPathSeg()
233 : {
234 0 : }
235 :
236 0 : IMPL_SVGPATHSEG_SUBCLASS_COMMON(ClosePath, PATHSEG_CLOSEPATH)
237 :
238 : protected:
239 : // To allow IMPL_SVGPATHSEG_SUBCLASS_COMMON above to compile we need an
240 : // mArgs, but since C++ doesn't allow zero-sized arrays we need to give it
241 : // one (unused) element.
242 : float mArgs[1];
243 : };
244 :
245 0 : class DOMSVGPathSegMovetoAbs
246 : : public DOMSVGPathSeg
247 : {
248 : public:
249 0 : DOMSVGPathSegMovetoAbs(float x, float y)
250 0 : : DOMSVGPathSeg()
251 : {
252 0 : mArgs[0] = x;
253 0 : mArgs[1] = y;
254 0 : }
255 :
256 0 : IMPL_SVGPATHSEG_SUBCLASS_COMMON(MovetoAbs, PATHSEG_MOVETO_ABS)
257 :
258 : float X();
259 : void SetX(float aX, ErrorResult& rv);
260 : float Y();
261 : void SetY(float aY, ErrorResult& rv);
262 :
263 : protected:
264 : float mArgs[2];
265 : };
266 :
267 0 : class DOMSVGPathSegMovetoRel
268 : : public DOMSVGPathSeg
269 : {
270 : public:
271 0 : DOMSVGPathSegMovetoRel(float x, float y)
272 0 : : DOMSVGPathSeg()
273 : {
274 0 : mArgs[0] = x;
275 0 : mArgs[1] = y;
276 0 : }
277 :
278 0 : IMPL_SVGPATHSEG_SUBCLASS_COMMON(MovetoRel, PATHSEG_MOVETO_REL)
279 :
280 : float X();
281 : void SetX(float aX, ErrorResult& rv);
282 : float Y();
283 : void SetY(float aY, ErrorResult& rv);
284 :
285 : protected:
286 : float mArgs[2];
287 : };
288 :
289 0 : class DOMSVGPathSegLinetoAbs
290 : : public DOMSVGPathSeg
291 : {
292 : public:
293 0 : DOMSVGPathSegLinetoAbs(float x, float y)
294 0 : : DOMSVGPathSeg()
295 : {
296 0 : mArgs[0] = x;
297 0 : mArgs[1] = y;
298 0 : }
299 :
300 0 : IMPL_SVGPATHSEG_SUBCLASS_COMMON(LinetoAbs, PATHSEG_LINETO_ABS)
301 :
302 : float X();
303 : void SetX(float aX, ErrorResult& rv);
304 : float Y();
305 : void SetY(float aY, ErrorResult& rv);
306 :
307 : protected:
308 : float mArgs[2];
309 : };
310 :
311 0 : class DOMSVGPathSegLinetoRel
312 : : public DOMSVGPathSeg
313 : {
314 : public:
315 0 : DOMSVGPathSegLinetoRel(float x, float y)
316 0 : : DOMSVGPathSeg()
317 : {
318 0 : mArgs[0] = x;
319 0 : mArgs[1] = y;
320 0 : }
321 :
322 0 : IMPL_SVGPATHSEG_SUBCLASS_COMMON(LinetoRel, PATHSEG_LINETO_REL)
323 :
324 : float X();
325 : void SetX(float aX, ErrorResult& rv);
326 : float Y();
327 : void SetY(float aY, ErrorResult& rv);
328 :
329 : protected:
330 : float mArgs[2];
331 : };
332 :
333 0 : class DOMSVGPathSegCurvetoCubicAbs
334 : : public DOMSVGPathSeg
335 : {
336 : public:
337 0 : DOMSVGPathSegCurvetoCubicAbs(float x1, float y1,
338 : float x2, float y2,
339 : float x, float y)
340 0 : : DOMSVGPathSeg()
341 : {
342 0 : mArgs[0] = x1;
343 0 : mArgs[1] = y1;
344 0 : mArgs[2] = x2;
345 0 : mArgs[3] = y2;
346 0 : mArgs[4] = x;
347 0 : mArgs[5] = y;
348 0 : }
349 :
350 : float X();
351 : void SetX(float aX, ErrorResult& rv);
352 : float Y();
353 : void SetY(float aY, ErrorResult& rv);
354 : float X1();
355 : void SetX1(float aX1, ErrorResult& rv);
356 : float Y1();
357 : void SetY1(float aY1, ErrorResult& rv);
358 : float X2();
359 : void SetX2(float aX2, ErrorResult& rv);
360 : float Y2();
361 : void SetY2(float aY2, ErrorResult& rv);
362 :
363 0 : IMPL_SVGPATHSEG_SUBCLASS_COMMON(CurvetoCubicAbs, PATHSEG_CURVETO_CUBIC_ABS)
364 :
365 : protected:
366 : float mArgs[6];
367 : };
368 :
369 0 : class DOMSVGPathSegCurvetoCubicRel
370 : : public DOMSVGPathSeg
371 : {
372 : public:
373 0 : DOMSVGPathSegCurvetoCubicRel(float x1, float y1,
374 : float x2, float y2,
375 : float x, float y)
376 0 : : DOMSVGPathSeg()
377 : {
378 0 : mArgs[0] = x1;
379 0 : mArgs[1] = y1;
380 0 : mArgs[2] = x2;
381 0 : mArgs[3] = y2;
382 0 : mArgs[4] = x;
383 0 : mArgs[5] = y;
384 0 : }
385 :
386 0 : IMPL_SVGPATHSEG_SUBCLASS_COMMON(CurvetoCubicRel, PATHSEG_CURVETO_CUBIC_REL)
387 :
388 : float X();
389 : void SetX(float aX, ErrorResult& rv);
390 : float Y();
391 : void SetY(float aY, ErrorResult& rv);
392 : float X1();
393 : void SetX1(float aX1, ErrorResult& rv);
394 : float Y1();
395 : void SetY1(float aY1, ErrorResult& rv);
396 : float X2();
397 : void SetX2(float aX2, ErrorResult& rv);
398 : float Y2();
399 : void SetY2(float aY2, ErrorResult& rv);
400 :
401 : protected:
402 : float mArgs[6];
403 : };
404 :
405 0 : class DOMSVGPathSegCurvetoQuadraticAbs
406 : : public DOMSVGPathSeg
407 : {
408 : public:
409 0 : DOMSVGPathSegCurvetoQuadraticAbs(float x1, float y1,
410 : float x, float y)
411 0 : : DOMSVGPathSeg()
412 : {
413 0 : mArgs[0] = x1;
414 0 : mArgs[1] = y1;
415 0 : mArgs[2] = x;
416 0 : mArgs[3] = y;
417 0 : }
418 :
419 0 : IMPL_SVGPATHSEG_SUBCLASS_COMMON(CurvetoQuadraticAbs, PATHSEG_CURVETO_QUADRATIC_ABS)
420 :
421 : float X();
422 : void SetX(float aX, ErrorResult& rv);
423 : float Y();
424 : void SetY(float aY, ErrorResult& rv);
425 : float X1();
426 : void SetX1(float aX1, ErrorResult& rv);
427 : float Y1();
428 : void SetY1(float aY1, ErrorResult& rv);
429 :
430 : protected:
431 : float mArgs[4];
432 : };
433 :
434 0 : class DOMSVGPathSegCurvetoQuadraticRel
435 : : public DOMSVGPathSeg
436 : {
437 : public:
438 0 : DOMSVGPathSegCurvetoQuadraticRel(float x1, float y1,
439 : float x, float y)
440 0 : : DOMSVGPathSeg()
441 : {
442 0 : mArgs[0] = x1;
443 0 : mArgs[1] = y1;
444 0 : mArgs[2] = x;
445 0 : mArgs[3] = y;
446 0 : }
447 :
448 0 : IMPL_SVGPATHSEG_SUBCLASS_COMMON(CurvetoQuadraticRel, PATHSEG_CURVETO_QUADRATIC_REL)
449 :
450 : float X();
451 : void SetX(float aX, ErrorResult& rv);
452 : float Y();
453 : void SetY(float aY, ErrorResult& rv);
454 : float X1();
455 : void SetX1(float aX1, ErrorResult& rv);
456 : float Y1();
457 : void SetY1(float aY1, ErrorResult& rv);
458 :
459 : protected:
460 : float mArgs[4];
461 : };
462 :
463 0 : class DOMSVGPathSegArcAbs
464 : : public DOMSVGPathSeg
465 : {
466 : public:
467 0 : DOMSVGPathSegArcAbs(float r1, float r2, float angle,
468 : bool largeArcFlag, bool sweepFlag,
469 : float x, float y)
470 0 : : DOMSVGPathSeg()
471 : {
472 0 : mArgs[0] = r1;
473 0 : mArgs[1] = r2;
474 0 : mArgs[2] = angle;
475 0 : mArgs[3] = largeArcFlag;
476 0 : mArgs[4] = sweepFlag;
477 0 : mArgs[5] = x;
478 0 : mArgs[6] = y;
479 0 : }
480 :
481 0 : IMPL_SVGPATHSEG_SUBCLASS_COMMON(ArcAbs, PATHSEG_ARC_ABS)
482 :
483 : float X();
484 : void SetX(float aX, ErrorResult& rv);
485 : float Y();
486 : void SetY(float aY, ErrorResult& rv);
487 : float R1();
488 : void SetR1(float aR1, ErrorResult& rv);
489 : float R2();
490 : void SetR2(float aR2, ErrorResult& rv);
491 : float Angle();
492 : void SetAngle(float aAngle, ErrorResult& rv);
493 : bool LargeArcFlag();
494 : void SetLargeArcFlag(bool aFlag, ErrorResult& rv);
495 : bool SweepFlag();
496 : void SetSweepFlag(bool aFlag, ErrorResult& rv);
497 :
498 : protected:
499 : float mArgs[7];
500 : };
501 :
502 0 : class DOMSVGPathSegArcRel
503 : : public DOMSVGPathSeg
504 : {
505 : public:
506 0 : DOMSVGPathSegArcRel(float r1, float r2, float angle,
507 : bool largeArcFlag, bool sweepFlag,
508 : float x, float y)
509 0 : : DOMSVGPathSeg()
510 : {
511 0 : mArgs[0] = r1;
512 0 : mArgs[1] = r2;
513 0 : mArgs[2] = angle;
514 0 : mArgs[3] = largeArcFlag;
515 0 : mArgs[4] = sweepFlag;
516 0 : mArgs[5] = x;
517 0 : mArgs[6] = y;
518 0 : }
519 :
520 0 : IMPL_SVGPATHSEG_SUBCLASS_COMMON(ArcRel, PATHSEG_ARC_REL)
521 :
522 : float X();
523 : void SetX(float aX, ErrorResult& rv);
524 : float Y();
525 : void SetY(float aY, ErrorResult& rv);
526 : float R1();
527 : void SetR1(float aR1, ErrorResult& rv);
528 : float R2();
529 : void SetR2(float aR2, ErrorResult& rv);
530 : float Angle();
531 : void SetAngle(float aAngle, ErrorResult& rv);
532 : bool LargeArcFlag();
533 : void SetLargeArcFlag(bool aFlag, ErrorResult& rv);
534 : bool SweepFlag();
535 : void SetSweepFlag(bool aFlag, ErrorResult& rv);
536 :
537 : protected:
538 : float mArgs[7];
539 : };
540 :
541 0 : class DOMSVGPathSegLinetoHorizontalAbs
542 : : public DOMSVGPathSeg
543 : {
544 : public:
545 0 : explicit DOMSVGPathSegLinetoHorizontalAbs(float x)
546 0 : : DOMSVGPathSeg()
547 : {
548 0 : mArgs[0] = x;
549 0 : }
550 :
551 0 : IMPL_SVGPATHSEG_SUBCLASS_COMMON(LinetoHorizontalAbs, PATHSEG_LINETO_HORIZONTAL_ABS)
552 :
553 : float X();
554 : void SetX(float aX, ErrorResult& rv);
555 :
556 : protected:
557 : float mArgs[1];
558 : };
559 :
560 0 : class DOMSVGPathSegLinetoHorizontalRel
561 : : public DOMSVGPathSeg
562 : {
563 : public:
564 0 : explicit DOMSVGPathSegLinetoHorizontalRel(float x)
565 0 : : DOMSVGPathSeg()
566 : {
567 0 : mArgs[0] = x;
568 0 : }
569 :
570 0 : IMPL_SVGPATHSEG_SUBCLASS_COMMON(LinetoHorizontalRel, PATHSEG_LINETO_HORIZONTAL_REL)
571 :
572 : float X();
573 : void SetX(float aX, ErrorResult& rv);
574 :
575 : protected:
576 : float mArgs[1];
577 : };
578 :
579 0 : class DOMSVGPathSegLinetoVerticalAbs
580 : : public DOMSVGPathSeg
581 : {
582 : public:
583 0 : explicit DOMSVGPathSegLinetoVerticalAbs(float y)
584 0 : : DOMSVGPathSeg()
585 : {
586 0 : mArgs[0] = y;
587 0 : }
588 :
589 0 : IMPL_SVGPATHSEG_SUBCLASS_COMMON(LinetoVerticalAbs, PATHSEG_LINETO_VERTICAL_ABS)
590 :
591 : float Y();
592 : void SetY(float aY, ErrorResult& rv);
593 :
594 : protected:
595 : float mArgs[1];
596 : };
597 :
598 0 : class DOMSVGPathSegLinetoVerticalRel
599 : : public DOMSVGPathSeg
600 : {
601 : public:
602 0 : explicit DOMSVGPathSegLinetoVerticalRel(float y)
603 0 : : DOMSVGPathSeg()
604 : {
605 0 : mArgs[0] = y;
606 0 : }
607 :
608 0 : IMPL_SVGPATHSEG_SUBCLASS_COMMON(LinetoVerticalRel, PATHSEG_LINETO_VERTICAL_REL)
609 :
610 : float Y();
611 : void SetY(float aY, ErrorResult& rv);
612 :
613 : protected:
614 : float mArgs[1];
615 : };
616 :
617 0 : class DOMSVGPathSegCurvetoCubicSmoothAbs
618 : : public DOMSVGPathSeg
619 : {
620 : public:
621 0 : DOMSVGPathSegCurvetoCubicSmoothAbs(float x2, float y2,
622 : float x, float y)
623 0 : : DOMSVGPathSeg()
624 : {
625 0 : mArgs[0] = x2;
626 0 : mArgs[1] = y2;
627 0 : mArgs[2] = x;
628 0 : mArgs[3] = y;
629 0 : }
630 :
631 0 : IMPL_SVGPATHSEG_SUBCLASS_COMMON(CurvetoCubicSmoothAbs, PATHSEG_CURVETO_CUBIC_SMOOTH_ABS)
632 :
633 : float X();
634 : void SetX(float aX, ErrorResult& rv);
635 : float Y();
636 : void SetY(float aY, ErrorResult& rv);
637 : float X2();
638 : void SetX2(float aX2, ErrorResult& rv);
639 : float Y2();
640 : void SetY2(float aY2, ErrorResult& rv);
641 :
642 : protected:
643 : float mArgs[4];
644 : };
645 :
646 0 : class DOMSVGPathSegCurvetoCubicSmoothRel
647 : : public DOMSVGPathSeg
648 : {
649 : public:
650 0 : DOMSVGPathSegCurvetoCubicSmoothRel(float x2, float y2,
651 : float x, float y)
652 0 : : DOMSVGPathSeg()
653 : {
654 0 : mArgs[0] = x2;
655 0 : mArgs[1] = y2;
656 0 : mArgs[2] = x;
657 0 : mArgs[3] = y;
658 0 : }
659 :
660 0 : IMPL_SVGPATHSEG_SUBCLASS_COMMON(CurvetoCubicSmoothRel, PATHSEG_CURVETO_CUBIC_SMOOTH_REL)
661 :
662 : float X();
663 : void SetX(float aX, ErrorResult& rv);
664 : float Y();
665 : void SetY(float aY, ErrorResult& rv);
666 : float X2();
667 : void SetX2(float aX2, ErrorResult& rv);
668 : float Y2();
669 : void SetY2(float aY2, ErrorResult& rv);
670 :
671 : protected:
672 : float mArgs[4];
673 : };
674 :
675 0 : class DOMSVGPathSegCurvetoQuadraticSmoothAbs
676 : : public DOMSVGPathSeg
677 : {
678 : public:
679 0 : DOMSVGPathSegCurvetoQuadraticSmoothAbs(float x, float y)
680 0 : : DOMSVGPathSeg()
681 : {
682 0 : mArgs[0] = x;
683 0 : mArgs[1] = y;
684 0 : }
685 :
686 0 : IMPL_SVGPATHSEG_SUBCLASS_COMMON(CurvetoQuadraticSmoothAbs, PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS)
687 :
688 : float X();
689 : void SetX(float aX, ErrorResult& rv);
690 : float Y();
691 : void SetY(float aY, ErrorResult& rv);
692 :
693 : protected:
694 : float mArgs[2];
695 : };
696 :
697 0 : class DOMSVGPathSegCurvetoQuadraticSmoothRel
698 : : public DOMSVGPathSeg
699 : {
700 : public:
701 0 : DOMSVGPathSegCurvetoQuadraticSmoothRel(float x, float y)
702 0 : : DOMSVGPathSeg()
703 : {
704 0 : mArgs[0] = x;
705 0 : mArgs[1] = y;
706 0 : }
707 :
708 0 : IMPL_SVGPATHSEG_SUBCLASS_COMMON(CurvetoQuadraticSmoothRel, PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL)
709 :
710 : float X();
711 : void SetX(float aX, ErrorResult& rv);
712 : float Y();
713 : void SetY(float aY, ErrorResult& rv);
714 :
715 : protected:
716 : float mArgs[2];
717 : };
718 :
719 : } // namespace mozilla
720 :
721 : #undef MOZ_SVG_LIST_INDEX_BIT_COUNT
722 :
723 : #endif // MOZILLA_DOMSVGPATHSEG_H__
|