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