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