~ubuntu-branches/ubuntu/maverick/webkit/maverick

« back to all changes in this revision

Viewing changes to WebCore/bindings/objc/DOMSVGPathSegInternal.mm

  • Committer: Bazaar Package Importer
  • Author(s): Mike Hommey
  • Date: 2007-08-19 15:54:12 UTC
  • Revision ID: james.westby@ubuntu.com-20070819155412-uxxg1h9plpghmtbi
Tags: upstream-0~svn25144
ImportĀ upstreamĀ versionĀ 0~svn25144

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright (C) 2006 Apple Computer, Inc.  All rights reserved.
 
3
 * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com>
 
4
 *
 
5
 * Redistribution and use in source and binary forms, with or without
 
6
 * modification, are permitted provided that the following conditions
 
7
 * are met:
 
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.
 
13
 *
 
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. 
 
25
 */
 
26
 
 
27
#import "config.h"
 
28
 
 
29
#if ENABLE(SVG)
 
30
 
 
31
#import "DOMSVGPathSegInternal.h"
 
32
 
 
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>
 
57
 
 
58
@implementation DOMSVGPathSeg (WebCoreInternal)
 
59
 
 
60
- (WebCore::SVGPathSeg *)_SVGPathSeg
 
61
{
 
62
    return reinterpret_cast<WebCore::SVGPathSeg*>(_internal);
 
63
}
 
64
 
 
65
- (id)_initWithSVGPathSeg:(WebCore::SVGPathSeg *)impl
 
66
{
 
67
    ASSERT(impl);
 
68
 
 
69
    [super _init];
 
70
    _internal = reinterpret_cast<DOMObjectInternal*>(impl);
 
71
    impl->ref();
 
72
    WebCore::addDOMWrapper(self, impl);
 
73
    return self;
 
74
}
 
75
 
 
76
+ (DOMSVGPathSeg *)_wrapSVGPathSeg:(WebCore::SVGPathSeg *)impl
 
77
{
 
78
    if (!impl)
 
79
        return nil;
 
80
    id cachedInstance;
 
81
    cachedInstance = WebCore::getDOMWrapper(impl);
 
82
    if (cachedInstance)
 
83
        return [[cachedInstance retain] autorelease];
 
84
 
 
85
    Class wrapperClass = nil;
 
86
    switch (impl->pathSegType()) {
 
87
        case WebCore::SVGPathSeg::PATHSEG_UNKNOWN:
 
88
            wrapperClass = [DOMSVGPathSeg class];
 
89
            break;
 
90
        case WebCore::SVGPathSeg::PATHSEG_CLOSEPATH:
 
91
            wrapperClass = [DOMSVGPathSegClosePath class];
 
92
            break;
 
93
        case WebCore::SVGPathSeg::PATHSEG_MOVETO_ABS:
 
94
            wrapperClass = [DOMSVGPathSegMovetoAbs class];
 
95
            break;
 
96
        case WebCore::SVGPathSeg::PATHSEG_MOVETO_REL:
 
97
            wrapperClass = [DOMSVGPathSegMovetoRel class];
 
98
            break;
 
99
        case WebCore::SVGPathSeg::PATHSEG_LINETO_ABS:
 
100
            wrapperClass = [DOMSVGPathSegLinetoAbs class];
 
101
            break;
 
102
        case WebCore::SVGPathSeg::PATHSEG_LINETO_REL:
 
103
            wrapperClass = [DOMSVGPathSegLinetoRel class];
 
104
            break;
 
105
        case WebCore::SVGPathSeg::PATHSEG_CURVETO_CUBIC_ABS:
 
106
            wrapperClass = [DOMSVGPathSegCurvetoCubicAbs class];
 
107
            break;
 
108
        case WebCore::SVGPathSeg::PATHSEG_CURVETO_CUBIC_REL:
 
109
            wrapperClass = [DOMSVGPathSegCurvetoCubicRel class];
 
110
            break;
 
111
        case WebCore::SVGPathSeg::PATHSEG_CURVETO_QUADRATIC_ABS:
 
112
            wrapperClass = [DOMSVGPathSegCurvetoQuadraticAbs class];
 
113
            break;
 
114
        case WebCore::SVGPathSeg::PATHSEG_CURVETO_QUADRATIC_REL:
 
115
            wrapperClass = [DOMSVGPathSegCurvetoQuadraticRel class];
 
116
            break;
 
117
        case WebCore::SVGPathSeg::PATHSEG_ARC_ABS:
 
118
            wrapperClass = [DOMSVGPathSegArcAbs class];
 
119
            break;
 
120
        case WebCore::SVGPathSeg::PATHSEG_ARC_REL:
 
121
            wrapperClass = [DOMSVGPathSegArcRel class];
 
122
            break;
 
123
        case WebCore::SVGPathSeg::PATHSEG_LINETO_HORIZONTAL_ABS:
 
124
            wrapperClass = [DOMSVGPathSegLinetoHorizontalAbs class];
 
125
            break;
 
126
        case WebCore::SVGPathSeg::PATHSEG_LINETO_HORIZONTAL_REL:
 
127
            wrapperClass = [DOMSVGPathSegLinetoHorizontalRel class];
 
128
            break;
 
129
        case WebCore::SVGPathSeg::PATHSEG_LINETO_VERTICAL_ABS:
 
130
            wrapperClass = [DOMSVGPathSegLinetoVerticalAbs class];
 
131
            break;
 
132
        case WebCore::SVGPathSeg::PATHSEG_LINETO_VERTICAL_REL:
 
133
            wrapperClass = [DOMSVGPathSegLinetoVerticalRel class];
 
134
            break;
 
135
        case WebCore::SVGPathSeg::PATHSEG_CURVETO_CUBIC_SMOOTH_ABS:
 
136
            wrapperClass = [DOMSVGPathSegCurvetoCubicSmoothAbs class];
 
137
            break;
 
138
        case WebCore::SVGPathSeg::PATHSEG_CURVETO_CUBIC_SMOOTH_REL:
 
139
            wrapperClass = [DOMSVGPathSegCurvetoCubicSmoothRel class];
 
140
            break;
 
141
        case WebCore::SVGPathSeg::PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS:
 
142
            wrapperClass = [DOMSVGPathSegCurvetoQuadraticSmoothAbs class];
 
143
            break;
 
144
        case WebCore::SVGPathSeg::PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL:
 
145
            wrapperClass = [DOMSVGPathSegCurvetoQuadraticSmoothRel class];
 
146
            break;
 
147
    }
 
148
 
 
149
    return [[[wrapperClass alloc] _initWithSVGPathSeg:impl] autorelease];
 
150
}
 
151
 
 
152
@end
 
153
 
 
154
#endif // ENABLE(SVG)