2015-05-03 22:32:37 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
2012-05-21 15:12:37 +04:00
|
|
|
/* 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/. */
|
2010-11-08 18:07:00 +03:00
|
|
|
|
|
|
|
#include "DOMSVGPathSeg.h"
|
|
|
|
#include "DOMSVGPathSegList.h"
|
|
|
|
#include "SVGAnimatedPathSegList.h"
|
2018-12-21 11:58:14 +03:00
|
|
|
#include "SVGElement.h"
|
2012-07-27 18:03:27 +04:00
|
|
|
#include "nsError.h"
|
2010-11-08 18:07:00 +03:00
|
|
|
|
|
|
|
// See the architecture comment in DOMSVGPathSegList.h.
|
|
|
|
|
2013-12-25 12:33:48 +04:00
|
|
|
namespace mozilla {
|
2010-11-08 18:07:00 +03:00
|
|
|
|
2018-06-26 00:20:54 +03:00
|
|
|
using namespace dom::SVGPathSeg_Binding;
|
2018-02-18 18:53:13 +03:00
|
|
|
|
2014-04-25 20:49:00 +04:00
|
|
|
// We could use NS_IMPL_CYCLE_COLLECTION(, except that in Unlink() we need to
|
2010-11-08 18:07:00 +03:00
|
|
|
// clear our list's weak ref to us to be safe. (The other option would be to
|
|
|
|
// not unlink and rely on the breaking of the other edges in the cycle, as
|
|
|
|
// NS_SVG_VAL_IMPL_CYCLE_COLLECTION does.)
|
2013-08-02 05:29:05 +04:00
|
|
|
NS_IMPL_CYCLE_COLLECTION_CLASS(DOMSVGPathSeg)
|
|
|
|
|
2010-11-08 18:07:00 +03:00
|
|
|
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(DOMSVGPathSeg)
|
|
|
|
// We may not belong to a list, so we must null check tmp->mList.
|
|
|
|
if (tmp->mList) {
|
2012-07-30 18:20:58 +04:00
|
|
|
tmp->mList->ItemAt(tmp->mListIndex) = nullptr;
|
2010-11-08 18:07:00 +03:00
|
|
|
}
|
2012-11-15 11:32:40 +04:00
|
|
|
NS_IMPL_CYCLE_COLLECTION_UNLINK(mList)
|
2012-12-23 08:54:22 +04:00
|
|
|
NS_IMPL_CYCLE_COLLECTION_UNLINK_PRESERVED_WRAPPER
|
2010-11-08 18:07:00 +03:00
|
|
|
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
|
2012-12-23 08:54:22 +04:00
|
|
|
|
2010-11-08 18:07:00 +03:00
|
|
|
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(DOMSVGPathSeg)
|
2012-11-15 11:32:40 +04:00
|
|
|
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mList)
|
2010-11-08 18:07:00 +03:00
|
|
|
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
|
|
|
|
|
2012-12-23 08:54:22 +04:00
|
|
|
NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN(DOMSVGPathSeg)
|
|
|
|
NS_IMPL_CYCLE_COLLECTION_TRACE_PRESERVED_WRAPPER
|
|
|
|
NS_IMPL_CYCLE_COLLECTION_TRACE_END
|
|
|
|
|
2013-09-11 03:03:57 +04:00
|
|
|
NS_IMPL_CYCLE_COLLECTION_ROOT_NATIVE(DOMSVGPathSeg, AddRef)
|
|
|
|
NS_IMPL_CYCLE_COLLECTION_UNROOT_NATIVE(DOMSVGPathSeg, Release)
|
2010-11-08 18:07:00 +03:00
|
|
|
|
2013-12-25 02:09:22 +04:00
|
|
|
//----------------------------------------------------------------------
|
|
|
|
// Helper class: AutoChangePathSegNotifier
|
|
|
|
// Stack-based helper class to pair calls to WillChangePathSegList
|
|
|
|
// and DidChangePathSegList.
|
2015-09-03 19:15:23 +03:00
|
|
|
class MOZ_RAII AutoChangePathSegNotifier {
|
2013-12-25 02:09:22 +04:00
|
|
|
public:
|
2014-09-01 05:08:04 +04:00
|
|
|
explicit AutoChangePathSegNotifier(
|
|
|
|
DOMSVGPathSeg* aPathSeg MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
|
2013-12-25 02:09:22 +04:00
|
|
|
: mPathSeg(aPathSeg) {
|
|
|
|
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
|
2013-12-25 12:33:48 +04:00
|
|
|
MOZ_ASSERT(mPathSeg, "Expecting non-null pathSeg");
|
2013-12-25 02:09:22 +04:00
|
|
|
MOZ_ASSERT(mPathSeg->HasOwner(),
|
|
|
|
"Expecting list to have an owner for notification");
|
|
|
|
mEmptyOrOldValue = mPathSeg->Element()->WillChangePathSegList();
|
|
|
|
}
|
|
|
|
|
|
|
|
~AutoChangePathSegNotifier() {
|
|
|
|
mPathSeg->Element()->DidChangePathSegList(mEmptyOrOldValue);
|
2018-11-20 10:01:49 +03:00
|
|
|
// Null check mPathSeg->mList, since DidChangePathSegList can run script,
|
|
|
|
// potentially removing mPathSeg from its list.
|
|
|
|
if (mPathSeg->mList && mPathSeg->mList->AttrIsAnimating()) {
|
2013-12-25 02:09:22 +04:00
|
|
|
mPathSeg->Element()->AnimationNeedsResample();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
2013-12-25 12:33:48 +04:00
|
|
|
DOMSVGPathSeg* const mPathSeg;
|
2013-12-25 02:09:22 +04:00
|
|
|
nsAttrValue mEmptyOrOldValue;
|
|
|
|
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
|
|
|
|
};
|
|
|
|
|
2010-11-08 18:07:00 +03:00
|
|
|
DOMSVGPathSeg::DOMSVGPathSeg(DOMSVGPathSegList* aList, uint32_t aListIndex,
|
2011-09-29 10:19:26 +04:00
|
|
|
bool aIsAnimValItem)
|
2010-11-08 18:07:00 +03:00
|
|
|
: mList(aList), mListIndex(aListIndex), mIsAnimValItem(aIsAnimValItem) {
|
|
|
|
// These shifts are in sync with the members in the header.
|
2015-02-10 01:34:50 +03:00
|
|
|
MOZ_ASSERT(aList && aListIndex <= MaxListIndex(), "bad arg");
|
2010-11-08 18:07:00 +03:00
|
|
|
|
2015-02-10 01:34:50 +03:00
|
|
|
MOZ_ASSERT(IndexIsValid(), "Bad index for DOMSVGPathSeg!");
|
2010-11-08 18:07:00 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
DOMSVGPathSeg::DOMSVGPathSeg()
|
2011-10-17 18:59:28 +04:00
|
|
|
: mList(nullptr), mListIndex(0), mIsAnimValItem(false) {}
|
2010-11-08 18:07:00 +03:00
|
|
|
|
|
|
|
void DOMSVGPathSeg::InsertingIntoList(DOMSVGPathSegList* aList,
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t aListIndex,
|
2011-09-29 10:19:26 +04:00
|
|
|
bool aIsAnimValItem) {
|
2015-02-10 01:34:50 +03:00
|
|
|
MOZ_ASSERT(!HasOwner(), "Inserting item that is already in a list");
|
2010-11-08 18:07:00 +03:00
|
|
|
|
|
|
|
mList = aList;
|
|
|
|
mListIndex = aListIndex;
|
|
|
|
mIsAnimValItem = aIsAnimValItem;
|
|
|
|
|
2015-02-10 01:34:50 +03:00
|
|
|
MOZ_ASSERT(IndexIsValid(), "Bad index for DOMSVGPathSeg!");
|
2010-11-08 18:07:00 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void DOMSVGPathSeg::RemovingFromList() {
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t argCount = SVGPathSegUtils::ArgCountForType(Type());
|
2010-11-08 18:07:00 +03:00
|
|
|
// InternalItem() + 1, because the args come after the encoded seg type
|
|
|
|
memcpy(PtrToMemberArgs(), InternalItem() + 1, argCount * sizeof(float));
|
2012-07-30 18:20:58 +04:00
|
|
|
mList = nullptr;
|
2011-10-17 18:59:28 +04:00
|
|
|
mIsAnimValItem = false;
|
2010-11-08 18:07:00 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void DOMSVGPathSeg::ToSVGPathSegEncodedData(float* aRaw) {
|
2015-02-10 01:34:50 +03:00
|
|
|
MOZ_ASSERT(aRaw, "null pointer");
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t argCount = SVGPathSegUtils::ArgCountForType(Type());
|
2010-11-08 18:07:00 +03:00
|
|
|
if (IsInList()) {
|
|
|
|
// 1 + argCount, because we're copying the encoded seg type and args
|
|
|
|
memcpy(aRaw, InternalItem(), (1 + argCount) * sizeof(float));
|
|
|
|
} else {
|
|
|
|
aRaw[0] = SVGPathSegUtils::EncodeType(Type());
|
|
|
|
// aRaw + 1, because the args go after the encoded seg type
|
|
|
|
memcpy(aRaw + 1, PtrToMemberArgs(), argCount * sizeof(float));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
float* DOMSVGPathSeg::InternalItem() {
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t dataIndex = mList->mItems[mListIndex].mInternalDataIndex;
|
2010-11-08 18:07:00 +03:00
|
|
|
return &(mList->InternalList().mData[dataIndex]);
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef DEBUG
|
|
|
|
bool DOMSVGPathSeg::IndexIsValid() {
|
|
|
|
SVGAnimatedPathSegList* alist = Element()->GetAnimPathSegList();
|
|
|
|
return (mIsAnimValItem && mListIndex < alist->GetAnimValue().CountItems()) ||
|
|
|
|
(!mIsAnimValItem && mListIndex < alist->GetBaseValue().CountItems());
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////
|
|
|
|
// Implementation of DOMSVGPathSeg sub-classes below this point
|
|
|
|
|
|
|
|
#define IMPL_PROP_WITH_TYPE(segName, propName, index, type) \
|
2012-12-23 08:54:22 +04:00
|
|
|
type DOMSVGPathSeg##segName::propName() { \
|
2010-11-08 18:07:00 +03:00
|
|
|
if (mIsAnimValItem && HasOwner()) { \
|
2012-12-23 08:54:22 +04:00
|
|
|
Element()->FlushAnimations(); /* May make HasOwner() == false */ \
|
2010-11-08 18:07:00 +03:00
|
|
|
} \
|
2012-12-23 08:54:22 +04:00
|
|
|
return type(HasOwner() ? InternalItem()[1 + index] : mArgs[index]); \
|
2010-11-08 18:07:00 +03:00
|
|
|
} \
|
2012-12-23 08:54:22 +04:00
|
|
|
void DOMSVGPathSeg##segName::Set##propName(type a##propName, \
|
|
|
|
ErrorResult& rv) { \
|
2010-11-08 18:07:00 +03:00
|
|
|
if (mIsAnimValItem) { \
|
2012-12-23 08:54:22 +04:00
|
|
|
rv.Throw(NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR); \
|
|
|
|
return; \
|
2010-11-08 18:07:00 +03:00
|
|
|
} \
|
|
|
|
if (HasOwner()) { \
|
2012-02-16 03:40:46 +04:00
|
|
|
if (InternalItem()[1 + index] == float(a##propName)) { \
|
2012-12-23 08:54:22 +04:00
|
|
|
return; \
|
2012-02-16 03:40:46 +04:00
|
|
|
} \
|
2013-12-25 02:09:22 +04:00
|
|
|
AutoChangePathSegNotifier notifier(this); \
|
2010-11-08 18:07:00 +03:00
|
|
|
InternalItem()[1 + index] = float(a##propName); \
|
|
|
|
} else { \
|
|
|
|
mArgs[index] = float(a##propName); \
|
|
|
|
} \
|
|
|
|
}
|
|
|
|
|
|
|
|
// For float, the normal type of arguments
|
|
|
|
#define IMPL_FLOAT_PROP(segName, propName, index) \
|
|
|
|
IMPL_PROP_WITH_TYPE(segName, propName, index, float)
|
|
|
|
|
|
|
|
// For the boolean flags in arc commands
|
|
|
|
#define IMPL_BOOL_PROP(segName, propName, index) \
|
2011-09-29 10:19:26 +04:00
|
|
|
IMPL_PROP_WITH_TYPE(segName, propName, index, bool)
|
2010-11-08 18:07:00 +03:00
|
|
|
|
2012-12-23 08:54:22 +04:00
|
|
|
///////////////////////////////////////////////////////////////////////
|
2010-11-08 18:07:00 +03:00
|
|
|
|
|
|
|
IMPL_FLOAT_PROP(MovetoAbs, X, 0)
|
|
|
|
IMPL_FLOAT_PROP(MovetoAbs, Y, 1)
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
IMPL_FLOAT_PROP(MovetoRel, X, 0)
|
|
|
|
IMPL_FLOAT_PROP(MovetoRel, Y, 1)
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
IMPL_FLOAT_PROP(LinetoAbs, X, 0)
|
|
|
|
IMPL_FLOAT_PROP(LinetoAbs, Y, 1)
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
IMPL_FLOAT_PROP(LinetoRel, X, 0)
|
|
|
|
IMPL_FLOAT_PROP(LinetoRel, Y, 1)
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
IMPL_FLOAT_PROP(CurvetoCubicAbs, X1, 0)
|
|
|
|
IMPL_FLOAT_PROP(CurvetoCubicAbs, Y1, 1)
|
|
|
|
IMPL_FLOAT_PROP(CurvetoCubicAbs, X2, 2)
|
|
|
|
IMPL_FLOAT_PROP(CurvetoCubicAbs, Y2, 3)
|
|
|
|
IMPL_FLOAT_PROP(CurvetoCubicAbs, X, 4)
|
|
|
|
IMPL_FLOAT_PROP(CurvetoCubicAbs, Y, 5)
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
IMPL_FLOAT_PROP(CurvetoCubicRel, X1, 0)
|
|
|
|
IMPL_FLOAT_PROP(CurvetoCubicRel, Y1, 1)
|
|
|
|
IMPL_FLOAT_PROP(CurvetoCubicRel, X2, 2)
|
|
|
|
IMPL_FLOAT_PROP(CurvetoCubicRel, Y2, 3)
|
|
|
|
IMPL_FLOAT_PROP(CurvetoCubicRel, X, 4)
|
|
|
|
IMPL_FLOAT_PROP(CurvetoCubicRel, Y, 5)
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
IMPL_FLOAT_PROP(CurvetoQuadraticAbs, X1, 0)
|
|
|
|
IMPL_FLOAT_PROP(CurvetoQuadraticAbs, Y1, 1)
|
|
|
|
IMPL_FLOAT_PROP(CurvetoQuadraticAbs, X, 2)
|
|
|
|
IMPL_FLOAT_PROP(CurvetoQuadraticAbs, Y, 3)
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
IMPL_FLOAT_PROP(CurvetoQuadraticRel, X1, 0)
|
|
|
|
IMPL_FLOAT_PROP(CurvetoQuadraticRel, Y1, 1)
|
|
|
|
IMPL_FLOAT_PROP(CurvetoQuadraticRel, X, 2)
|
|
|
|
IMPL_FLOAT_PROP(CurvetoQuadraticRel, Y, 3)
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
IMPL_FLOAT_PROP(ArcAbs, R1, 0)
|
|
|
|
IMPL_FLOAT_PROP(ArcAbs, R2, 1)
|
|
|
|
IMPL_FLOAT_PROP(ArcAbs, Angle, 2)
|
|
|
|
IMPL_BOOL_PROP(ArcAbs, LargeArcFlag, 3)
|
|
|
|
IMPL_BOOL_PROP(ArcAbs, SweepFlag, 4)
|
|
|
|
IMPL_FLOAT_PROP(ArcAbs, X, 5)
|
|
|
|
IMPL_FLOAT_PROP(ArcAbs, Y, 6)
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
IMPL_FLOAT_PROP(ArcRel, R1, 0)
|
|
|
|
IMPL_FLOAT_PROP(ArcRel, R2, 1)
|
|
|
|
IMPL_FLOAT_PROP(ArcRel, Angle, 2)
|
|
|
|
IMPL_BOOL_PROP(ArcRel, LargeArcFlag, 3)
|
|
|
|
IMPL_BOOL_PROP(ArcRel, SweepFlag, 4)
|
|
|
|
IMPL_FLOAT_PROP(ArcRel, X, 5)
|
|
|
|
IMPL_FLOAT_PROP(ArcRel, Y, 6)
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
IMPL_FLOAT_PROP(LinetoHorizontalAbs, X, 0)
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
IMPL_FLOAT_PROP(LinetoHorizontalRel, X, 0)
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
IMPL_FLOAT_PROP(LinetoVerticalAbs, Y, 0)
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
IMPL_FLOAT_PROP(LinetoVerticalRel, Y, 0)
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
IMPL_FLOAT_PROP(CurvetoCubicSmoothAbs, X2, 0)
|
|
|
|
IMPL_FLOAT_PROP(CurvetoCubicSmoothAbs, Y2, 1)
|
|
|
|
IMPL_FLOAT_PROP(CurvetoCubicSmoothAbs, X, 2)
|
|
|
|
IMPL_FLOAT_PROP(CurvetoCubicSmoothAbs, Y, 3)
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
IMPL_FLOAT_PROP(CurvetoCubicSmoothRel, X2, 0)
|
|
|
|
IMPL_FLOAT_PROP(CurvetoCubicSmoothRel, Y2, 1)
|
|
|
|
IMPL_FLOAT_PROP(CurvetoCubicSmoothRel, X, 2)
|
|
|
|
IMPL_FLOAT_PROP(CurvetoCubicSmoothRel, Y, 3)
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
IMPL_FLOAT_PROP(CurvetoQuadraticSmoothAbs, X, 0)
|
|
|
|
IMPL_FLOAT_PROP(CurvetoQuadraticSmoothAbs, Y, 1)
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
IMPL_FLOAT_PROP(CurvetoQuadraticSmoothRel, X, 0)
|
|
|
|
IMPL_FLOAT_PROP(CurvetoQuadraticSmoothRel, Y, 1)
|
|
|
|
|
|
|
|
// This must come after DOMSVGPathSegClosePath et. al. have been declared.
|
2019-02-26 01:05:29 +03:00
|
|
|
/* static */
|
|
|
|
DOMSVGPathSeg* DOMSVGPathSeg::CreateFor(DOMSVGPathSegList* aList,
|
|
|
|
uint32_t aListIndex,
|
|
|
|
bool aIsAnimValItem) {
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t dataIndex = aList->mItems[aListIndex].mInternalDataIndex;
|
2010-11-08 18:07:00 +03:00
|
|
|
float* data = &aList->InternalList().mData[dataIndex];
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t type = SVGPathSegUtils::DecodeType(data[0]);
|
2010-11-08 18:07:00 +03:00
|
|
|
|
|
|
|
switch (type) {
|
2012-12-23 08:54:22 +04:00
|
|
|
case PATHSEG_CLOSEPATH:
|
2010-11-08 18:07:00 +03:00
|
|
|
return new DOMSVGPathSegClosePath(aList, aListIndex, aIsAnimValItem);
|
2012-12-23 08:54:22 +04:00
|
|
|
case PATHSEG_MOVETO_ABS:
|
2010-11-08 18:07:00 +03:00
|
|
|
return new DOMSVGPathSegMovetoAbs(aList, aListIndex, aIsAnimValItem);
|
2012-12-23 08:54:22 +04:00
|
|
|
case PATHSEG_MOVETO_REL:
|
2010-11-08 18:07:00 +03:00
|
|
|
return new DOMSVGPathSegMovetoRel(aList, aListIndex, aIsAnimValItem);
|
2012-12-23 08:54:22 +04:00
|
|
|
case PATHSEG_LINETO_ABS:
|
2010-11-08 18:07:00 +03:00
|
|
|
return new DOMSVGPathSegLinetoAbs(aList, aListIndex, aIsAnimValItem);
|
2012-12-23 08:54:22 +04:00
|
|
|
case PATHSEG_LINETO_REL:
|
2010-11-08 18:07:00 +03:00
|
|
|
return new DOMSVGPathSegLinetoRel(aList, aListIndex, aIsAnimValItem);
|
2012-12-23 08:54:22 +04:00
|
|
|
case PATHSEG_CURVETO_CUBIC_ABS:
|
2010-11-08 18:07:00 +03:00
|
|
|
return new DOMSVGPathSegCurvetoCubicAbs(aList, aListIndex,
|
|
|
|
aIsAnimValItem);
|
2012-12-23 08:54:22 +04:00
|
|
|
case PATHSEG_CURVETO_CUBIC_REL:
|
2010-11-08 18:07:00 +03:00
|
|
|
return new DOMSVGPathSegCurvetoCubicRel(aList, aListIndex,
|
|
|
|
aIsAnimValItem);
|
2012-12-23 08:54:22 +04:00
|
|
|
case PATHSEG_CURVETO_QUADRATIC_ABS:
|
2010-11-08 18:07:00 +03:00
|
|
|
return new DOMSVGPathSegCurvetoQuadraticAbs(aList, aListIndex,
|
|
|
|
aIsAnimValItem);
|
2012-12-23 08:54:22 +04:00
|
|
|
case PATHSEG_CURVETO_QUADRATIC_REL:
|
2010-11-08 18:07:00 +03:00
|
|
|
return new DOMSVGPathSegCurvetoQuadraticRel(aList, aListIndex,
|
|
|
|
aIsAnimValItem);
|
2012-12-23 08:54:22 +04:00
|
|
|
case PATHSEG_ARC_ABS:
|
2010-11-08 18:07:00 +03:00
|
|
|
return new DOMSVGPathSegArcAbs(aList, aListIndex, aIsAnimValItem);
|
2012-12-23 08:54:22 +04:00
|
|
|
case PATHSEG_ARC_REL:
|
2010-11-08 18:07:00 +03:00
|
|
|
return new DOMSVGPathSegArcRel(aList, aListIndex, aIsAnimValItem);
|
2012-12-23 08:54:22 +04:00
|
|
|
case PATHSEG_LINETO_HORIZONTAL_ABS:
|
2010-11-08 18:07:00 +03:00
|
|
|
return new DOMSVGPathSegLinetoHorizontalAbs(aList, aListIndex,
|
|
|
|
aIsAnimValItem);
|
2012-12-23 08:54:22 +04:00
|
|
|
case PATHSEG_LINETO_HORIZONTAL_REL:
|
2010-11-08 18:07:00 +03:00
|
|
|
return new DOMSVGPathSegLinetoHorizontalRel(aList, aListIndex,
|
|
|
|
aIsAnimValItem);
|
2012-12-23 08:54:22 +04:00
|
|
|
case PATHSEG_LINETO_VERTICAL_ABS:
|
2010-11-08 18:07:00 +03:00
|
|
|
return new DOMSVGPathSegLinetoVerticalAbs(aList, aListIndex,
|
|
|
|
aIsAnimValItem);
|
2012-12-23 08:54:22 +04:00
|
|
|
case PATHSEG_LINETO_VERTICAL_REL:
|
2010-11-08 18:07:00 +03:00
|
|
|
return new DOMSVGPathSegLinetoVerticalRel(aList, aListIndex,
|
|
|
|
aIsAnimValItem);
|
2012-12-23 08:54:22 +04:00
|
|
|
case PATHSEG_CURVETO_CUBIC_SMOOTH_ABS:
|
2010-11-08 18:07:00 +03:00
|
|
|
return new DOMSVGPathSegCurvetoCubicSmoothAbs(aList, aListIndex,
|
|
|
|
aIsAnimValItem);
|
2012-12-23 08:54:22 +04:00
|
|
|
case PATHSEG_CURVETO_CUBIC_SMOOTH_REL:
|
2010-11-08 18:07:00 +03:00
|
|
|
return new DOMSVGPathSegCurvetoCubicSmoothRel(aList, aListIndex,
|
|
|
|
aIsAnimValItem);
|
2012-12-23 08:54:22 +04:00
|
|
|
case PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS:
|
2010-11-08 18:07:00 +03:00
|
|
|
return new DOMSVGPathSegCurvetoQuadraticSmoothAbs(aList, aListIndex,
|
|
|
|
aIsAnimValItem);
|
2012-12-23 08:54:22 +04:00
|
|
|
case PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL:
|
2010-11-08 18:07:00 +03:00
|
|
|
return new DOMSVGPathSegCurvetoQuadraticSmoothRel(aList, aListIndex,
|
|
|
|
aIsAnimValItem);
|
|
|
|
default:
|
2018-06-18 08:43:11 +03:00
|
|
|
MOZ_ASSERT_UNREACHABLE("Invalid path segment type");
|
2012-07-30 18:20:58 +04:00
|
|
|
return nullptr;
|
2010-11-08 18:07:00 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-12-25 12:33:48 +04:00
|
|
|
} // namespace mozilla
|