Move URL from WebCore to WTF
[WebKit-https.git] / Source / WebKitLegacy / mac / DOM / DOMHTMLTableElement.mm
1 /*
2  * Copyright (C) 2004-2016 Apple Inc. All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions
6  * are met:
7  * 1. Redistributions of source code must retain the above copyright
8  *    notice, this list of conditions and the following disclaimer.
9  * 2. Redistributions in binary form must reproduce the above copyright
10  *    notice, this list of conditions and the following disclaimer in the
11  *    documentation and/or other materials provided with the distribution.
12  *
13  * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
14  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
17  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24  */
25
26 #import "DOMHTMLTableElement.h"
27
28 #import "DOMHTMLCollectionInternal.h"
29 #import "DOMHTMLElementInternal.h"
30 #import "DOMHTMLTableCaptionElementInternal.h"
31 #import "DOMHTMLTableSectionElementInternal.h"
32 #import "DOMNodeInternal.h"
33 #import "ExceptionHandlers.h"
34 #import <WebCore/HTMLCollection.h>
35 #import <WebCore/HTMLElement.h>
36 #import <WebCore/HTMLNames.h>
37 #import <WebCore/HTMLTableCaptionElement.h>
38 #import <WebCore/HTMLTableElement.h>
39 #import <WebCore/HTMLTableSectionElement.h>
40 #import <WebCore/JSExecState.h>
41 #import <WebCore/ThreadCheck.h>
42 #import <WebCore/WebScriptObjectPrivate.h>
43 #import <wtf/GetPtr.h>
44 #import <wtf/URL.h>
45
46 #define IMPL static_cast<WebCore::HTMLTableElement*>(reinterpret_cast<WebCore::Node*>(_internal))
47
48 @implementation DOMHTMLTableElement
49
50 - (DOMHTMLTableCaptionElement *)caption
51 {
52     WebCore::JSMainThreadNullState state;
53     return kit(WTF::getPtr(IMPL->caption()));
54 }
55
56 - (void)setCaption:(DOMHTMLTableCaptionElement *)newCaption
57 {
58     WebCore::JSMainThreadNullState state;
59     raiseOnDOMError(IMPL->setCaption(core(newCaption)));
60 }
61
62 - (DOMHTMLTableSectionElement *)tHead
63 {
64     WebCore::JSMainThreadNullState state;
65     return kit(WTF::getPtr(IMPL->tHead()));
66 }
67
68 - (void)setTHead:(DOMHTMLTableSectionElement *)newTHead
69 {
70     WebCore::JSMainThreadNullState state;
71     raiseOnDOMError(IMPL->setTHead(core(newTHead)));
72 }
73
74 - (DOMHTMLTableSectionElement *)tFoot
75 {
76     WebCore::JSMainThreadNullState state;
77     return kit(WTF::getPtr(IMPL->tFoot()));
78 }
79
80 - (void)setTFoot:(DOMHTMLTableSectionElement *)newTFoot
81 {
82     WebCore::JSMainThreadNullState state;
83     raiseOnDOMError(IMPL->setTFoot(core(newTFoot)));
84 }
85
86 - (DOMHTMLCollection *)rows
87 {
88     WebCore::JSMainThreadNullState state;
89     return kit(WTF::getPtr(IMPL->rows()));
90 }
91
92 - (DOMHTMLCollection *)tBodies
93 {
94     WebCore::JSMainThreadNullState state;
95     return kit(WTF::getPtr(IMPL->tBodies()));
96 }
97
98 - (NSString *)align
99 {
100     WebCore::JSMainThreadNullState state;
101     return IMPL->getAttribute(WebCore::HTMLNames::alignAttr);
102 }
103
104 - (void)setAlign:(NSString *)newAlign
105 {
106     WebCore::JSMainThreadNullState state;
107     IMPL->setAttributeWithoutSynchronization(WebCore::HTMLNames::alignAttr, newAlign);
108 }
109
110 - (NSString *)bgColor
111 {
112     WebCore::JSMainThreadNullState state;
113     return IMPL->getAttribute(WebCore::HTMLNames::bgcolorAttr);
114 }
115
116 - (void)setBgColor:(NSString *)newBgColor
117 {
118     WebCore::JSMainThreadNullState state;
119     IMPL->setAttributeWithoutSynchronization(WebCore::HTMLNames::bgcolorAttr, newBgColor);
120 }
121
122 - (NSString *)border
123 {
124     WebCore::JSMainThreadNullState state;
125     return IMPL->getAttribute(WebCore::HTMLNames::borderAttr);
126 }
127
128 - (void)setBorder:(NSString *)newBorder
129 {
130     WebCore::JSMainThreadNullState state;
131     IMPL->setAttributeWithoutSynchronization(WebCore::HTMLNames::borderAttr, newBorder);
132 }
133
134 - (NSString *)cellPadding
135 {
136     WebCore::JSMainThreadNullState state;
137     return IMPL->getAttribute(WebCore::HTMLNames::cellpaddingAttr);
138 }
139
140 - (void)setCellPadding:(NSString *)newCellPadding
141 {
142     WebCore::JSMainThreadNullState state;
143     IMPL->setAttributeWithoutSynchronization(WebCore::HTMLNames::cellpaddingAttr, newCellPadding);
144 }
145
146 - (NSString *)cellSpacing
147 {
148     WebCore::JSMainThreadNullState state;
149     return IMPL->getAttribute(WebCore::HTMLNames::cellspacingAttr);
150 }
151
152 - (void)setCellSpacing:(NSString *)newCellSpacing
153 {
154     WebCore::JSMainThreadNullState state;
155     IMPL->setAttributeWithoutSynchronization(WebCore::HTMLNames::cellspacingAttr, newCellSpacing);
156 }
157
158 - (NSString *)frameBorders
159 {
160     WebCore::JSMainThreadNullState state;
161     return IMPL->getAttribute(WebCore::HTMLNames::frameAttr);
162 }
163
164 - (void)setFrameBorders:(NSString *)newFrameBorders
165 {
166     WebCore::JSMainThreadNullState state;
167     IMPL->setAttributeWithoutSynchronization(WebCore::HTMLNames::frameAttr, newFrameBorders);
168 }
169
170 - (NSString *)rules
171 {
172     WebCore::JSMainThreadNullState state;
173     return IMPL->getAttribute(WebCore::HTMLNames::rulesAttr);
174 }
175
176 - (void)setRules:(NSString *)newRules
177 {
178     WebCore::JSMainThreadNullState state;
179     IMPL->setAttributeWithoutSynchronization(WebCore::HTMLNames::rulesAttr, newRules);
180 }
181
182 - (NSString *)summary
183 {
184     WebCore::JSMainThreadNullState state;
185     return IMPL->getAttribute(WebCore::HTMLNames::summaryAttr);
186 }
187
188 - (void)setSummary:(NSString *)newSummary
189 {
190     WebCore::JSMainThreadNullState state;
191     IMPL->setAttributeWithoutSynchronization(WebCore::HTMLNames::summaryAttr, newSummary);
192 }
193
194 - (NSString *)width
195 {
196     WebCore::JSMainThreadNullState state;
197     return IMPL->getAttribute(WebCore::HTMLNames::widthAttr);
198 }
199
200 - (void)setWidth:(NSString *)newWidth
201 {
202     WebCore::JSMainThreadNullState state;
203     IMPL->setAttributeWithoutSynchronization(WebCore::HTMLNames::widthAttr, newWidth);
204 }
205
206 - (DOMHTMLElement *)createTHead
207 {
208     WebCore::JSMainThreadNullState state;
209     return kit(WTF::getPtr(IMPL->createTHead()));
210 }
211
212 - (void)deleteTHead
213 {
214     WebCore::JSMainThreadNullState state;
215     IMPL->deleteTHead();
216 }
217
218 - (DOMHTMLElement *)createTFoot
219 {
220     WebCore::JSMainThreadNullState state;
221     return kit(WTF::getPtr(IMPL->createTFoot()));
222 }
223
224 - (void)deleteTFoot
225 {
226     WebCore::JSMainThreadNullState state;
227     IMPL->deleteTFoot();
228 }
229
230 - (DOMHTMLElement *)createTBody
231 {
232     WebCore::JSMainThreadNullState state;
233     return kit(WTF::getPtr(IMPL->createTBody()));
234 }
235
236 - (DOMHTMLElement *)createCaption
237 {
238     WebCore::JSMainThreadNullState state;
239     return kit(WTF::getPtr(IMPL->createCaption()));
240 }
241
242 - (void)deleteCaption
243 {
244     WebCore::JSMainThreadNullState state;
245     IMPL->deleteCaption();
246 }
247
248 - (DOMHTMLElement *)insertRow:(int)index
249 {
250     WebCore::JSMainThreadNullState state;
251     return kit(raiseOnDOMError(IMPL->insertRow(index)).ptr());
252 }
253
254 - (void)deleteRow:(int)index
255 {
256     WebCore::JSMainThreadNullState state;
257     raiseOnDOMError(IMPL->deleteRow(index));
258 }
259
260 @end