Drop ExceptionCodeDescription class
[WebKit-https.git] / Source / WebKit / WebProcess / InjectedBundle / API / gtk / DOM / WebKitDOMHTMLTableElement.cpp
1 /*
2  *  This file is part of the WebKit open source project.
3  *
4  *  This library is free software; you can redistribute it and/or
5  *  modify it under the terms of the GNU Library General Public
6  *  License as published by the Free Software Foundation; either
7  *  version 2 of the License, or (at your option) any later version.
8  *
9  *  This library is distributed in the hope that it will be useful,
10  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  *  Library General Public License for more details.
13  *
14  *  You should have received a copy of the GNU Library General Public License
15  *  along with this library; see the file COPYING.LIB.  If not, write to
16  *  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17  *  Boston, MA 02110-1301, USA.
18  */
19
20 #include "config.h"
21 #include "WebKitDOMHTMLTableElement.h"
22
23 #include <WebCore/CSSImportRule.h>
24 #include "DOMObjectCache.h"
25 #include <WebCore/DOMException.h>
26 #include <WebCore/Document.h>
27 #include "GObjectEventListener.h"
28 #include <WebCore/HTMLNames.h>
29 #include <WebCore/JSMainThreadExecState.h>
30 #include "WebKitDOMEventPrivate.h"
31 #include "WebKitDOMEventTarget.h"
32 #include "WebKitDOMHTMLCollectionPrivate.h"
33 #include "WebKitDOMHTMLElementPrivate.h"
34 #include "WebKitDOMHTMLTableCaptionElementPrivate.h"
35 #include "WebKitDOMHTMLTableElementPrivate.h"
36 #include "WebKitDOMHTMLTableSectionElementPrivate.h"
37 #include "WebKitDOMNodePrivate.h"
38 #include "WebKitDOMPrivate.h"
39 #include "ConvertToUTF8String.h"
40 #include <wtf/GetPtr.h>
41 #include <wtf/RefPtr.h>
42
43 namespace WebKit {
44
45 WebKitDOMHTMLTableElement* kit(WebCore::HTMLTableElement* obj)
46 {
47     return WEBKIT_DOM_HTML_TABLE_ELEMENT(kit(static_cast<WebCore::Node*>(obj)));
48 }
49
50 WebCore::HTMLTableElement* core(WebKitDOMHTMLTableElement* request)
51 {
52     return request ? static_cast<WebCore::HTMLTableElement*>(WEBKIT_DOM_OBJECT(request)->coreObject) : 0;
53 }
54
55 WebKitDOMHTMLTableElement* wrapHTMLTableElement(WebCore::HTMLTableElement* coreObject)
56 {
57     ASSERT(coreObject);
58     return WEBKIT_DOM_HTML_TABLE_ELEMENT(g_object_new(WEBKIT_DOM_TYPE_HTML_TABLE_ELEMENT, "core-object", coreObject, nullptr));
59 }
60
61 } // namespace WebKit
62
63 static gboolean webkit_dom_html_table_element_dispatch_event(WebKitDOMEventTarget* target, WebKitDOMEvent* event, GError** error)
64 {
65     WebCore::Event* coreEvent = WebKit::core(event);
66     if (!coreEvent)
67         return false;
68     WebCore::HTMLTableElement* coreTarget = static_cast<WebCore::HTMLTableElement*>(WEBKIT_DOM_OBJECT(target)->coreObject);
69
70     auto result = coreTarget->dispatchEventForBindings(*coreEvent);
71     if (result.hasException()) {
72         auto description = WebCore::DOMException::description(result.releaseException().code());
73         g_set_error_literal(error, g_quark_from_string("WEBKIT_DOM"), description.legacyCode, description.name);
74         return false;
75     }
76     return result.releaseReturnValue();
77 }
78
79 static gboolean webkit_dom_html_table_element_add_event_listener(WebKitDOMEventTarget* target, const char* eventName, GClosure* handler, gboolean useCapture)
80 {
81     WebCore::HTMLTableElement* coreTarget = static_cast<WebCore::HTMLTableElement*>(WEBKIT_DOM_OBJECT(target)->coreObject);
82     return WebKit::GObjectEventListener::addEventListener(G_OBJECT(target), coreTarget, eventName, handler, useCapture);
83 }
84
85 static gboolean webkit_dom_html_table_element_remove_event_listener(WebKitDOMEventTarget* target, const char* eventName, GClosure* handler, gboolean useCapture)
86 {
87     WebCore::HTMLTableElement* coreTarget = static_cast<WebCore::HTMLTableElement*>(WEBKIT_DOM_OBJECT(target)->coreObject);
88     return WebKit::GObjectEventListener::removeEventListener(G_OBJECT(target), coreTarget, eventName, handler, useCapture);
89 }
90
91 static void webkit_dom_event_target_init(WebKitDOMEventTargetIface* iface)
92 {
93     iface->dispatch_event = webkit_dom_html_table_element_dispatch_event;
94     iface->add_event_listener = webkit_dom_html_table_element_add_event_listener;
95     iface->remove_event_listener = webkit_dom_html_table_element_remove_event_listener;
96 }
97
98 G_DEFINE_TYPE_WITH_CODE(WebKitDOMHTMLTableElement, webkit_dom_html_table_element, WEBKIT_DOM_TYPE_HTML_ELEMENT, G_IMPLEMENT_INTERFACE(WEBKIT_DOM_TYPE_EVENT_TARGET, webkit_dom_event_target_init))
99
100 enum {
101     PROP_0,
102     PROP_CAPTION,
103     PROP_T_HEAD,
104     PROP_T_FOOT,
105     PROP_ROWS,
106     PROP_T_BODIES,
107     PROP_ALIGN,
108     PROP_BG_COLOR,
109     PROP_BORDER,
110     PROP_CELL_PADDING,
111     PROP_CELL_SPACING,
112     PROP_RULES,
113     PROP_SUMMARY,
114     PROP_WIDTH,
115 };
116
117 static void webkit_dom_html_table_element_set_property(GObject* object, guint propertyId, const GValue* value, GParamSpec* pspec)
118 {
119     WebKitDOMHTMLTableElement* self = WEBKIT_DOM_HTML_TABLE_ELEMENT(object);
120
121     switch (propertyId) {
122     case PROP_ALIGN:
123         webkit_dom_html_table_element_set_align(self, g_value_get_string(value));
124         break;
125     case PROP_BG_COLOR:
126         webkit_dom_html_table_element_set_bg_color(self, g_value_get_string(value));
127         break;
128     case PROP_BORDER:
129         webkit_dom_html_table_element_set_border(self, g_value_get_string(value));
130         break;
131     case PROP_CELL_PADDING:
132         webkit_dom_html_table_element_set_cell_padding(self, g_value_get_string(value));
133         break;
134     case PROP_CELL_SPACING:
135         webkit_dom_html_table_element_set_cell_spacing(self, g_value_get_string(value));
136         break;
137     case PROP_RULES:
138         webkit_dom_html_table_element_set_rules(self, g_value_get_string(value));
139         break;
140     case PROP_SUMMARY:
141         webkit_dom_html_table_element_set_summary(self, g_value_get_string(value));
142         break;
143     case PROP_WIDTH:
144         webkit_dom_html_table_element_set_width(self, g_value_get_string(value));
145         break;
146     default:
147         G_OBJECT_WARN_INVALID_PROPERTY_ID(object, propertyId, pspec);
148         break;
149     }
150 }
151
152 static void webkit_dom_html_table_element_get_property(GObject* object, guint propertyId, GValue* value, GParamSpec* pspec)
153 {
154     WebKitDOMHTMLTableElement* self = WEBKIT_DOM_HTML_TABLE_ELEMENT(object);
155
156     switch (propertyId) {
157     case PROP_CAPTION:
158         g_value_set_object(value, webkit_dom_html_table_element_get_caption(self));
159         break;
160     case PROP_T_HEAD:
161         g_value_set_object(value, webkit_dom_html_table_element_get_t_head(self));
162         break;
163     case PROP_T_FOOT:
164         g_value_set_object(value, webkit_dom_html_table_element_get_t_foot(self));
165         break;
166     case PROP_ROWS:
167         g_value_set_object(value, webkit_dom_html_table_element_get_rows(self));
168         break;
169     case PROP_T_BODIES:
170         g_value_set_object(value, webkit_dom_html_table_element_get_t_bodies(self));
171         break;
172     case PROP_ALIGN:
173         g_value_take_string(value, webkit_dom_html_table_element_get_align(self));
174         break;
175     case PROP_BG_COLOR:
176         g_value_take_string(value, webkit_dom_html_table_element_get_bg_color(self));
177         break;
178     case PROP_BORDER:
179         g_value_take_string(value, webkit_dom_html_table_element_get_border(self));
180         break;
181     case PROP_CELL_PADDING:
182         g_value_take_string(value, webkit_dom_html_table_element_get_cell_padding(self));
183         break;
184     case PROP_CELL_SPACING:
185         g_value_take_string(value, webkit_dom_html_table_element_get_cell_spacing(self));
186         break;
187     case PROP_RULES:
188         g_value_take_string(value, webkit_dom_html_table_element_get_rules(self));
189         break;
190     case PROP_SUMMARY:
191         g_value_take_string(value, webkit_dom_html_table_element_get_summary(self));
192         break;
193     case PROP_WIDTH:
194         g_value_take_string(value, webkit_dom_html_table_element_get_width(self));
195         break;
196     default:
197         G_OBJECT_WARN_INVALID_PROPERTY_ID(object, propertyId, pspec);
198         break;
199     }
200 }
201
202 static void webkit_dom_html_table_element_class_init(WebKitDOMHTMLTableElementClass* requestClass)
203 {
204     GObjectClass* gobjectClass = G_OBJECT_CLASS(requestClass);
205     gobjectClass->set_property = webkit_dom_html_table_element_set_property;
206     gobjectClass->get_property = webkit_dom_html_table_element_get_property;
207
208     g_object_class_install_property(
209         gobjectClass,
210         PROP_CAPTION,
211         g_param_spec_object(
212             "caption",
213             "HTMLTableElement:caption",
214             "read-only WebKitDOMHTMLTableCaptionElement* HTMLTableElement:caption",
215             WEBKIT_DOM_TYPE_HTML_TABLE_CAPTION_ELEMENT,
216             WEBKIT_PARAM_READABLE));
217
218     g_object_class_install_property(
219         gobjectClass,
220         PROP_T_HEAD,
221         g_param_spec_object(
222             "t-head",
223             "HTMLTableElement:t-head",
224             "read-only WebKitDOMHTMLTableSectionElement* HTMLTableElement:t-head",
225             WEBKIT_DOM_TYPE_HTML_TABLE_SECTION_ELEMENT,
226             WEBKIT_PARAM_READABLE));
227
228     g_object_class_install_property(
229         gobjectClass,
230         PROP_T_FOOT,
231         g_param_spec_object(
232             "t-foot",
233             "HTMLTableElement:t-foot",
234             "read-only WebKitDOMHTMLTableSectionElement* HTMLTableElement:t-foot",
235             WEBKIT_DOM_TYPE_HTML_TABLE_SECTION_ELEMENT,
236             WEBKIT_PARAM_READABLE));
237
238     g_object_class_install_property(
239         gobjectClass,
240         PROP_ROWS,
241         g_param_spec_object(
242             "rows",
243             "HTMLTableElement:rows",
244             "read-only WebKitDOMHTMLCollection* HTMLTableElement:rows",
245             WEBKIT_DOM_TYPE_HTML_COLLECTION,
246             WEBKIT_PARAM_READABLE));
247
248     g_object_class_install_property(
249         gobjectClass,
250         PROP_T_BODIES,
251         g_param_spec_object(
252             "t-bodies",
253             "HTMLTableElement:t-bodies",
254             "read-only WebKitDOMHTMLCollection* HTMLTableElement:t-bodies",
255             WEBKIT_DOM_TYPE_HTML_COLLECTION,
256             WEBKIT_PARAM_READABLE));
257
258     g_object_class_install_property(
259         gobjectClass,
260         PROP_ALIGN,
261         g_param_spec_string(
262             "align",
263             "HTMLTableElement:align",
264             "read-write gchar* HTMLTableElement:align",
265             "",
266             WEBKIT_PARAM_READWRITE));
267
268     g_object_class_install_property(
269         gobjectClass,
270         PROP_BG_COLOR,
271         g_param_spec_string(
272             "bg-color",
273             "HTMLTableElement:bg-color",
274             "read-write gchar* HTMLTableElement:bg-color",
275             "",
276             WEBKIT_PARAM_READWRITE));
277
278     g_object_class_install_property(
279         gobjectClass,
280         PROP_BORDER,
281         g_param_spec_string(
282             "border",
283             "HTMLTableElement:border",
284             "read-write gchar* HTMLTableElement:border",
285             "",
286             WEBKIT_PARAM_READWRITE));
287
288     g_object_class_install_property(
289         gobjectClass,
290         PROP_CELL_PADDING,
291         g_param_spec_string(
292             "cell-padding",
293             "HTMLTableElement:cell-padding",
294             "read-write gchar* HTMLTableElement:cell-padding",
295             "",
296             WEBKIT_PARAM_READWRITE));
297
298     g_object_class_install_property(
299         gobjectClass,
300         PROP_CELL_SPACING,
301         g_param_spec_string(
302             "cell-spacing",
303             "HTMLTableElement:cell-spacing",
304             "read-write gchar* HTMLTableElement:cell-spacing",
305             "",
306             WEBKIT_PARAM_READWRITE));
307
308     g_object_class_install_property(
309         gobjectClass,
310         PROP_RULES,
311         g_param_spec_string(
312             "rules",
313             "HTMLTableElement:rules",
314             "read-write gchar* HTMLTableElement:rules",
315             "",
316             WEBKIT_PARAM_READWRITE));
317
318     g_object_class_install_property(
319         gobjectClass,
320         PROP_SUMMARY,
321         g_param_spec_string(
322             "summary",
323             "HTMLTableElement:summary",
324             "read-write gchar* HTMLTableElement:summary",
325             "",
326             WEBKIT_PARAM_READWRITE));
327
328     g_object_class_install_property(
329         gobjectClass,
330         PROP_WIDTH,
331         g_param_spec_string(
332             "width",
333             "HTMLTableElement:width",
334             "read-write gchar* HTMLTableElement:width",
335             "",
336             WEBKIT_PARAM_READWRITE));
337
338 }
339
340 static void webkit_dom_html_table_element_init(WebKitDOMHTMLTableElement* request)
341 {
342     UNUSED_PARAM(request);
343 }
344
345 WebKitDOMHTMLElement* webkit_dom_html_table_element_create_t_head(WebKitDOMHTMLTableElement* self)
346 {
347     WebCore::JSMainThreadNullState state;
348     g_return_val_if_fail(WEBKIT_DOM_IS_HTML_TABLE_ELEMENT(self), 0);
349     WebCore::HTMLTableElement* item = WebKit::core(self);
350     RefPtr<WebCore::HTMLElement> gobjectResult = WTF::getPtr(item->createTHead());
351     return WebKit::kit(gobjectResult.get());
352 }
353
354 void webkit_dom_html_table_element_delete_t_head(WebKitDOMHTMLTableElement* self)
355 {
356     WebCore::JSMainThreadNullState state;
357     g_return_if_fail(WEBKIT_DOM_IS_HTML_TABLE_ELEMENT(self));
358     WebCore::HTMLTableElement* item = WebKit::core(self);
359     item->deleteTHead();
360 }
361
362 WebKitDOMHTMLElement* webkit_dom_html_table_element_create_t_foot(WebKitDOMHTMLTableElement* self)
363 {
364     WebCore::JSMainThreadNullState state;
365     g_return_val_if_fail(WEBKIT_DOM_IS_HTML_TABLE_ELEMENT(self), 0);
366     WebCore::HTMLTableElement* item = WebKit::core(self);
367     RefPtr<WebCore::HTMLElement> gobjectResult = WTF::getPtr(item->createTFoot());
368     return WebKit::kit(gobjectResult.get());
369 }
370
371 void webkit_dom_html_table_element_delete_t_foot(WebKitDOMHTMLTableElement* self)
372 {
373     WebCore::JSMainThreadNullState state;
374     g_return_if_fail(WEBKIT_DOM_IS_HTML_TABLE_ELEMENT(self));
375     WebCore::HTMLTableElement* item = WebKit::core(self);
376     item->deleteTFoot();
377 }
378
379 WebKitDOMHTMLElement* webkit_dom_html_table_element_create_caption(WebKitDOMHTMLTableElement* self)
380 {
381     WebCore::JSMainThreadNullState state;
382     g_return_val_if_fail(WEBKIT_DOM_IS_HTML_TABLE_ELEMENT(self), 0);
383     WebCore::HTMLTableElement* item = WebKit::core(self);
384     RefPtr<WebCore::HTMLElement> gobjectResult = WTF::getPtr(item->createCaption());
385     return WebKit::kit(gobjectResult.get());
386 }
387
388 void webkit_dom_html_table_element_delete_caption(WebKitDOMHTMLTableElement* self)
389 {
390     WebCore::JSMainThreadNullState state;
391     g_return_if_fail(WEBKIT_DOM_IS_HTML_TABLE_ELEMENT(self));
392     WebCore::HTMLTableElement* item = WebKit::core(self);
393     item->deleteCaption();
394 }
395
396 WebKitDOMHTMLElement* webkit_dom_html_table_element_insert_row(WebKitDOMHTMLTableElement* self, glong index, GError** error)
397 {
398     WebCore::JSMainThreadNullState state;
399     g_return_val_if_fail(WEBKIT_DOM_IS_HTML_TABLE_ELEMENT(self), 0);
400     g_return_val_if_fail(!error || !*error, 0);
401     WebCore::HTMLTableElement* item = WebKit::core(self);
402     auto result = item->insertRow(index);
403     if (result.hasException()) {
404         auto description = WebCore::DOMException::description(result.releaseException().code());
405         g_set_error_literal(error, g_quark_from_string("WEBKIT_DOM"), description.legacyCode, description.name);
406         return nullptr;
407     }
408     return WebKit::kit(result.releaseReturnValue().ptr());
409 }
410
411 void webkit_dom_html_table_element_delete_row(WebKitDOMHTMLTableElement* self, glong index, GError** error)
412 {
413     WebCore::JSMainThreadNullState state;
414     g_return_if_fail(WEBKIT_DOM_IS_HTML_TABLE_ELEMENT(self));
415     g_return_if_fail(!error || !*error);
416     WebCore::HTMLTableElement* item = WebKit::core(self);
417     auto result = item->deleteRow(index);
418     if (result.hasException()) {
419         auto description = WebCore::DOMException::description(result.releaseException().code());
420         g_set_error_literal(error, g_quark_from_string("WEBKIT_DOM"), description.legacyCode, description.name);
421     }
422 }
423
424 WebKitDOMHTMLTableCaptionElement* webkit_dom_html_table_element_get_caption(WebKitDOMHTMLTableElement* self)
425 {
426     WebCore::JSMainThreadNullState state;
427     g_return_val_if_fail(WEBKIT_DOM_IS_HTML_TABLE_ELEMENT(self), 0);
428     WebCore::HTMLTableElement* item = WebKit::core(self);
429     RefPtr<WebCore::HTMLTableCaptionElement> gobjectResult = WTF::getPtr(item->caption());
430     return WebKit::kit(gobjectResult.get());
431 }
432
433 void webkit_dom_html_table_element_set_caption(WebKitDOMHTMLTableElement* self, WebKitDOMHTMLTableCaptionElement* value, GError** error)
434 {
435     WebCore::JSMainThreadNullState state;
436     g_return_if_fail(WEBKIT_DOM_IS_HTML_TABLE_ELEMENT(self));
437     g_return_if_fail(WEBKIT_DOM_IS_HTML_TABLE_CAPTION_ELEMENT(value));
438     g_return_if_fail(!error || !*error);
439     WebCore::HTMLTableElement* item = WebKit::core(self);
440     WebCore::HTMLTableCaptionElement* convertedValue = WebKit::core(value);
441     auto result = item->setCaption(convertedValue);
442     if (result.hasException()) {
443         auto description = WebCore::DOMException::description(result.releaseException().code());
444         g_set_error_literal(error, g_quark_from_string("WEBKIT_DOM"), description.legacyCode, description.name);
445     }
446 }
447
448 WebKitDOMHTMLTableSectionElement* webkit_dom_html_table_element_get_t_head(WebKitDOMHTMLTableElement* self)
449 {
450     WebCore::JSMainThreadNullState state;
451     g_return_val_if_fail(WEBKIT_DOM_IS_HTML_TABLE_ELEMENT(self), 0);
452     WebCore::HTMLTableElement* item = WebKit::core(self);
453     RefPtr<WebCore::HTMLTableSectionElement> gobjectResult = WTF::getPtr(item->tHead());
454     return WebKit::kit(gobjectResult.get());
455 }
456
457 void webkit_dom_html_table_element_set_t_head(WebKitDOMHTMLTableElement* self, WebKitDOMHTMLTableSectionElement* value, GError** error)
458 {
459     WebCore::JSMainThreadNullState state;
460     g_return_if_fail(WEBKIT_DOM_IS_HTML_TABLE_ELEMENT(self));
461     g_return_if_fail(WEBKIT_DOM_IS_HTML_TABLE_SECTION_ELEMENT(value));
462     g_return_if_fail(!error || !*error);
463     WebCore::HTMLTableElement* item = WebKit::core(self);
464     WebCore::HTMLTableSectionElement* convertedValue = WebKit::core(value);
465     auto result = item->setTHead(convertedValue);
466     if (result.hasException()) {
467         auto description = WebCore::DOMException::description(result.releaseException().code());
468         g_set_error_literal(error, g_quark_from_string("WEBKIT_DOM"), description.legacyCode, description.name);
469     }
470 }
471
472 WebKitDOMHTMLTableSectionElement* webkit_dom_html_table_element_get_t_foot(WebKitDOMHTMLTableElement* self)
473 {
474     WebCore::JSMainThreadNullState state;
475     g_return_val_if_fail(WEBKIT_DOM_IS_HTML_TABLE_ELEMENT(self), 0);
476     WebCore::HTMLTableElement* item = WebKit::core(self);
477     RefPtr<WebCore::HTMLTableSectionElement> gobjectResult = WTF::getPtr(item->tFoot());
478     return WebKit::kit(gobjectResult.get());
479 }
480
481 void webkit_dom_html_table_element_set_t_foot(WebKitDOMHTMLTableElement* self, WebKitDOMHTMLTableSectionElement* value, GError** error)
482 {
483     WebCore::JSMainThreadNullState state;
484     g_return_if_fail(WEBKIT_DOM_IS_HTML_TABLE_ELEMENT(self));
485     g_return_if_fail(WEBKIT_DOM_IS_HTML_TABLE_SECTION_ELEMENT(value));
486     g_return_if_fail(!error || !*error);
487     WebCore::HTMLTableElement* item = WebKit::core(self);
488     WebCore::HTMLTableSectionElement* convertedValue = WebKit::core(value);
489     auto result = item->setTFoot(convertedValue);
490     if (result.hasException()) {
491         auto description = WebCore::DOMException::description(result.releaseException().code());
492         g_set_error_literal(error, g_quark_from_string("WEBKIT_DOM"), description.legacyCode, description.name);
493     }
494 }
495
496 WebKitDOMHTMLCollection* webkit_dom_html_table_element_get_rows(WebKitDOMHTMLTableElement* self)
497 {
498     WebCore::JSMainThreadNullState state;
499     g_return_val_if_fail(WEBKIT_DOM_IS_HTML_TABLE_ELEMENT(self), 0);
500     WebCore::HTMLTableElement* item = WebKit::core(self);
501     RefPtr<WebCore::HTMLCollection> gobjectResult = WTF::getPtr(item->rows());
502     return WebKit::kit(gobjectResult.get());
503 }
504
505 WebKitDOMHTMLCollection* webkit_dom_html_table_element_get_t_bodies(WebKitDOMHTMLTableElement* self)
506 {
507     WebCore::JSMainThreadNullState state;
508     g_return_val_if_fail(WEBKIT_DOM_IS_HTML_TABLE_ELEMENT(self), 0);
509     WebCore::HTMLTableElement* item = WebKit::core(self);
510     RefPtr<WebCore::HTMLCollection> gobjectResult = WTF::getPtr(item->tBodies());
511     return WebKit::kit(gobjectResult.get());
512 }
513
514 gchar* webkit_dom_html_table_element_get_align(WebKitDOMHTMLTableElement* self)
515 {
516     WebCore::JSMainThreadNullState state;
517     g_return_val_if_fail(WEBKIT_DOM_IS_HTML_TABLE_ELEMENT(self), 0);
518     WebCore::HTMLTableElement* item = WebKit::core(self);
519     gchar* result = convertToUTF8String(item->attributeWithoutSynchronization(WebCore::HTMLNames::alignAttr));
520     return result;
521 }
522
523 void webkit_dom_html_table_element_set_align(WebKitDOMHTMLTableElement* self, const gchar* value)
524 {
525     WebCore::JSMainThreadNullState state;
526     g_return_if_fail(WEBKIT_DOM_IS_HTML_TABLE_ELEMENT(self));
527     g_return_if_fail(value);
528     WebCore::HTMLTableElement* item = WebKit::core(self);
529     WTF::String convertedValue = WTF::String::fromUTF8(value);
530     item->setAttributeWithoutSynchronization(WebCore::HTMLNames::alignAttr, convertedValue);
531 }
532
533 gchar* webkit_dom_html_table_element_get_bg_color(WebKitDOMHTMLTableElement* self)
534 {
535     WebCore::JSMainThreadNullState state;
536     g_return_val_if_fail(WEBKIT_DOM_IS_HTML_TABLE_ELEMENT(self), 0);
537     WebCore::HTMLTableElement* item = WebKit::core(self);
538     gchar* result = convertToUTF8String(item->attributeWithoutSynchronization(WebCore::HTMLNames::bgcolorAttr));
539     return result;
540 }
541
542 void webkit_dom_html_table_element_set_bg_color(WebKitDOMHTMLTableElement* self, const gchar* value)
543 {
544     WebCore::JSMainThreadNullState state;
545     g_return_if_fail(WEBKIT_DOM_IS_HTML_TABLE_ELEMENT(self));
546     g_return_if_fail(value);
547     WebCore::HTMLTableElement* item = WebKit::core(self);
548     WTF::String convertedValue = WTF::String::fromUTF8(value);
549     item->setAttributeWithoutSynchronization(WebCore::HTMLNames::bgcolorAttr, convertedValue);
550 }
551
552 gchar* webkit_dom_html_table_element_get_border(WebKitDOMHTMLTableElement* self)
553 {
554     WebCore::JSMainThreadNullState state;
555     g_return_val_if_fail(WEBKIT_DOM_IS_HTML_TABLE_ELEMENT(self), 0);
556     WebCore::HTMLTableElement* item = WebKit::core(self);
557     gchar* result = convertToUTF8String(item->attributeWithoutSynchronization(WebCore::HTMLNames::borderAttr));
558     return result;
559 }
560
561 void webkit_dom_html_table_element_set_border(WebKitDOMHTMLTableElement* self, const gchar* value)
562 {
563     WebCore::JSMainThreadNullState state;
564     g_return_if_fail(WEBKIT_DOM_IS_HTML_TABLE_ELEMENT(self));
565     g_return_if_fail(value);
566     WebCore::HTMLTableElement* item = WebKit::core(self);
567     WTF::String convertedValue = WTF::String::fromUTF8(value);
568     item->setAttributeWithoutSynchronization(WebCore::HTMLNames::borderAttr, convertedValue);
569 }
570
571 gchar* webkit_dom_html_table_element_get_cell_padding(WebKitDOMHTMLTableElement* self)
572 {
573     WebCore::JSMainThreadNullState state;
574     g_return_val_if_fail(WEBKIT_DOM_IS_HTML_TABLE_ELEMENT(self), 0);
575     WebCore::HTMLTableElement* item = WebKit::core(self);
576     gchar* result = convertToUTF8String(item->attributeWithoutSynchronization(WebCore::HTMLNames::cellpaddingAttr));
577     return result;
578 }
579
580 void webkit_dom_html_table_element_set_cell_padding(WebKitDOMHTMLTableElement* self, const gchar* value)
581 {
582     WebCore::JSMainThreadNullState state;
583     g_return_if_fail(WEBKIT_DOM_IS_HTML_TABLE_ELEMENT(self));
584     g_return_if_fail(value);
585     WebCore::HTMLTableElement* item = WebKit::core(self);
586     WTF::String convertedValue = WTF::String::fromUTF8(value);
587     item->setAttributeWithoutSynchronization(WebCore::HTMLNames::cellpaddingAttr, convertedValue);
588 }
589
590 gchar* webkit_dom_html_table_element_get_cell_spacing(WebKitDOMHTMLTableElement* self)
591 {
592     WebCore::JSMainThreadNullState state;
593     g_return_val_if_fail(WEBKIT_DOM_IS_HTML_TABLE_ELEMENT(self), 0);
594     WebCore::HTMLTableElement* item = WebKit::core(self);
595     gchar* result = convertToUTF8String(item->attributeWithoutSynchronization(WebCore::HTMLNames::cellspacingAttr));
596     return result;
597 }
598
599 void webkit_dom_html_table_element_set_cell_spacing(WebKitDOMHTMLTableElement* self, const gchar* value)
600 {
601     WebCore::JSMainThreadNullState state;
602     g_return_if_fail(WEBKIT_DOM_IS_HTML_TABLE_ELEMENT(self));
603     g_return_if_fail(value);
604     WebCore::HTMLTableElement* item = WebKit::core(self);
605     WTF::String convertedValue = WTF::String::fromUTF8(value);
606     item->setAttributeWithoutSynchronization(WebCore::HTMLNames::cellspacingAttr, convertedValue);
607 }
608
609 gchar* webkit_dom_html_table_element_get_rules(WebKitDOMHTMLTableElement* self)
610 {
611     WebCore::JSMainThreadNullState state;
612     g_return_val_if_fail(WEBKIT_DOM_IS_HTML_TABLE_ELEMENT(self), 0);
613     WebCore::HTMLTableElement* item = WebKit::core(self);
614     gchar* result = convertToUTF8String(item->attributeWithoutSynchronization(WebCore::HTMLNames::rulesAttr));
615     return result;
616 }
617
618 void webkit_dom_html_table_element_set_rules(WebKitDOMHTMLTableElement* self, const gchar* value)
619 {
620     WebCore::JSMainThreadNullState state;
621     g_return_if_fail(WEBKIT_DOM_IS_HTML_TABLE_ELEMENT(self));
622     g_return_if_fail(value);
623     WebCore::HTMLTableElement* item = WebKit::core(self);
624     WTF::String convertedValue = WTF::String::fromUTF8(value);
625     item->setAttributeWithoutSynchronization(WebCore::HTMLNames::rulesAttr, convertedValue);
626 }
627
628 gchar* webkit_dom_html_table_element_get_summary(WebKitDOMHTMLTableElement* self)
629 {
630     WebCore::JSMainThreadNullState state;
631     g_return_val_if_fail(WEBKIT_DOM_IS_HTML_TABLE_ELEMENT(self), 0);
632     WebCore::HTMLTableElement* item = WebKit::core(self);
633     gchar* result = convertToUTF8String(item->attributeWithoutSynchronization(WebCore::HTMLNames::summaryAttr));
634     return result;
635 }
636
637 void webkit_dom_html_table_element_set_summary(WebKitDOMHTMLTableElement* self, const gchar* value)
638 {
639     WebCore::JSMainThreadNullState state;
640     g_return_if_fail(WEBKIT_DOM_IS_HTML_TABLE_ELEMENT(self));
641     g_return_if_fail(value);
642     WebCore::HTMLTableElement* item = WebKit::core(self);
643     WTF::String convertedValue = WTF::String::fromUTF8(value);
644     item->setAttributeWithoutSynchronization(WebCore::HTMLNames::summaryAttr, convertedValue);
645 }
646
647 gchar* webkit_dom_html_table_element_get_width(WebKitDOMHTMLTableElement* self)
648 {
649     WebCore::JSMainThreadNullState state;
650     g_return_val_if_fail(WEBKIT_DOM_IS_HTML_TABLE_ELEMENT(self), 0);
651     WebCore::HTMLTableElement* item = WebKit::core(self);
652     gchar* result = convertToUTF8String(item->attributeWithoutSynchronization(WebCore::HTMLNames::widthAttr));
653     return result;
654 }
655
656 void webkit_dom_html_table_element_set_width(WebKitDOMHTMLTableElement* self, const gchar* value)
657 {
658     WebCore::JSMainThreadNullState state;
659     g_return_if_fail(WEBKIT_DOM_IS_HTML_TABLE_ELEMENT(self));
660     g_return_if_fail(value);
661     WebCore::HTMLTableElement* item = WebKit::core(self);
662     WTF::String convertedValue = WTF::String::fromUTF8(value);
663     item->setAttributeWithoutSynchronization(WebCore::HTMLNames::widthAttr, convertedValue);
664 }
665