2
* Copyright (C) 2006 Apple Computer, Inc. All rights reserved.
3
* Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com>
5
* Redistribution and use in source and binary forms, with or without
6
* modification, are permitted provided that the following conditions
8
* 1. Redistributions of source code must retain the above copyright
9
* notice, this list of conditions and the following disclaimer.
10
* 2. Redistributions in binary form must reproduce the above copyright
11
* notice, this list of conditions and the following disclaimer in the
12
* documentation and/or other materials provided with the distribution.
14
* THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
15
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
17
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
18
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
19
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
20
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
21
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
22
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
24
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31
#import "DOMSVGPathSegInternal.h"
33
#import "DOMInternal.h"
34
#import "DOMSVGPathSeg.h"
35
#import "DOMSVGPathSegArcAbs.h"
36
#import "DOMSVGPathSegArcRel.h"
37
#import "DOMSVGPathSegClosePath.h"
38
#import "DOMSVGPathSegCurvetoCubicAbs.h"
39
#import "DOMSVGPathSegCurvetoCubicRel.h"
40
#import "DOMSVGPathSegCurvetoCubicSmoothAbs.h"
41
#import "DOMSVGPathSegCurvetoCubicSmoothRel.h"
42
#import "DOMSVGPathSegCurvetoQuadraticAbs.h"
43
#import "DOMSVGPathSegCurvetoQuadraticRel.h"
44
#import "DOMSVGPathSegCurvetoQuadraticSmoothAbs.h"
45
#import "DOMSVGPathSegCurvetoQuadraticSmoothRel.h"
46
#import "DOMSVGPathSegLinetoAbs.h"
47
#import "DOMSVGPathSegLinetoHorizontalAbs.h"
48
#import "DOMSVGPathSegLinetoHorizontalRel.h"
49
#import "DOMSVGPathSegLinetoRel.h"
50
#import "DOMSVGPathSegLinetoVerticalAbs.h"
51
#import "DOMSVGPathSegLinetoVerticalRel.h"
52
#import "DOMSVGPathSegList.h"
53
#import "DOMSVGPathSegMovetoAbs.h"
54
#import "DOMSVGPathSegMovetoRel.h"
55
#import "SVGPathSeg.h"
56
#import <objc/objc-class.h>
58
@implementation DOMSVGPathSeg (WebCoreInternal)
60
- (WebCore::SVGPathSeg *)_SVGPathSeg
62
return reinterpret_cast<WebCore::SVGPathSeg*>(_internal);
65
- (id)_initWithSVGPathSeg:(WebCore::SVGPathSeg *)impl
70
_internal = reinterpret_cast<DOMObjectInternal*>(impl);
72
WebCore::addDOMWrapper(self, impl);
76
+ (DOMSVGPathSeg *)_wrapSVGPathSeg:(WebCore::SVGPathSeg *)impl
81
cachedInstance = WebCore::getDOMWrapper(impl);
83
return [[cachedInstance retain] autorelease];
85
Class wrapperClass = nil;
86
switch (impl->pathSegType()) {
87
case WebCore::SVGPathSeg::PATHSEG_UNKNOWN:
88
wrapperClass = [DOMSVGPathSeg class];
90
case WebCore::SVGPathSeg::PATHSEG_CLOSEPATH:
91
wrapperClass = [DOMSVGPathSegClosePath class];
93
case WebCore::SVGPathSeg::PATHSEG_MOVETO_ABS:
94
wrapperClass = [DOMSVGPathSegMovetoAbs class];
96
case WebCore::SVGPathSeg::PATHSEG_MOVETO_REL:
97
wrapperClass = [DOMSVGPathSegMovetoRel class];
99
case WebCore::SVGPathSeg::PATHSEG_LINETO_ABS:
100
wrapperClass = [DOMSVGPathSegLinetoAbs class];
102
case WebCore::SVGPathSeg::PATHSEG_LINETO_REL:
103
wrapperClass = [DOMSVGPathSegLinetoRel class];
105
case WebCore::SVGPathSeg::PATHSEG_CURVETO_CUBIC_ABS:
106
wrapperClass = [DOMSVGPathSegCurvetoCubicAbs class];
108
case WebCore::SVGPathSeg::PATHSEG_CURVETO_CUBIC_REL:
109
wrapperClass = [DOMSVGPathSegCurvetoCubicRel class];
111
case WebCore::SVGPathSeg::PATHSEG_CURVETO_QUADRATIC_ABS:
112
wrapperClass = [DOMSVGPathSegCurvetoQuadraticAbs class];
114
case WebCore::SVGPathSeg::PATHSEG_CURVETO_QUADRATIC_REL:
115
wrapperClass = [DOMSVGPathSegCurvetoQuadraticRel class];
117
case WebCore::SVGPathSeg::PATHSEG_ARC_ABS:
118
wrapperClass = [DOMSVGPathSegArcAbs class];
120
case WebCore::SVGPathSeg::PATHSEG_ARC_REL:
121
wrapperClass = [DOMSVGPathSegArcRel class];
123
case WebCore::SVGPathSeg::PATHSEG_LINETO_HORIZONTAL_ABS:
124
wrapperClass = [DOMSVGPathSegLinetoHorizontalAbs class];
126
case WebCore::SVGPathSeg::PATHSEG_LINETO_HORIZONTAL_REL:
127
wrapperClass = [DOMSVGPathSegLinetoHorizontalRel class];
129
case WebCore::SVGPathSeg::PATHSEG_LINETO_VERTICAL_ABS:
130
wrapperClass = [DOMSVGPathSegLinetoVerticalAbs class];
132
case WebCore::SVGPathSeg::PATHSEG_LINETO_VERTICAL_REL:
133
wrapperClass = [DOMSVGPathSegLinetoVerticalRel class];
135
case WebCore::SVGPathSeg::PATHSEG_CURVETO_CUBIC_SMOOTH_ABS:
136
wrapperClass = [DOMSVGPathSegCurvetoCubicSmoothAbs class];
138
case WebCore::SVGPathSeg::PATHSEG_CURVETO_CUBIC_SMOOTH_REL:
139
wrapperClass = [DOMSVGPathSegCurvetoCubicSmoothRel class];
141
case WebCore::SVGPathSeg::PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS:
142
wrapperClass = [DOMSVGPathSegCurvetoQuadraticSmoothAbs class];
144
case WebCore::SVGPathSeg::PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL:
145
wrapperClass = [DOMSVGPathSegCurvetoQuadraticSmoothRel class];
149
return [[[wrapperClass alloc] _initWithSVGPathSeg:impl] autorelease];
154
#endif // ENABLE(SVG)