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 "WebKitDOMHTMLImageElement.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 "WebKitDOMHTMLImageElementPrivate.h" |
33 | #include "WebKitDOMNodePrivate.h" |
34 | #include "WebKitDOMPrivate.h" |
35 | #include "ConvertToUTF8String.h" |
36 | #include <wtf/GetPtr.h> |
37 | #include <wtf/RefPtr.h> |
38 | |
39 | G_GNUC_BEGIN_IGNORE_DEPRECATIONS; |
40 | |
41 | namespace WebKit { |
42 | |
43 | WebKitDOMHTMLImageElement* kit(WebCore::HTMLImageElement* obj) |
44 | { |
45 | return WEBKIT_DOM_HTML_IMAGE_ELEMENT(kit(static_cast<WebCore::Node*>(obj))); |
46 | } |
47 | |
48 | WebCore::HTMLImageElement* core(WebKitDOMHTMLImageElement* request) |
49 | { |
50 | return request ? static_cast<WebCore::HTMLImageElement*>(WEBKIT_DOM_OBJECT(request)->coreObject) : 0; |
51 | } |
52 | |
53 | WebKitDOMHTMLImageElement* wrapHTMLImageElement(WebCore::HTMLImageElement* coreObject) |
54 | { |
55 | ASSERT(coreObject); |
56 | return WEBKIT_DOM_HTML_IMAGE_ELEMENT(g_object_new(WEBKIT_DOM_TYPE_HTML_IMAGE_ELEMENT, "core-object" , coreObject, nullptr)); |
57 | } |
58 | |
59 | } // namespace WebKit |
60 | |
61 | static gboolean webkit_dom_html_image_element_dispatch_event(WebKitDOMEventTarget* target, WebKitDOMEvent* event, GError** error) |
62 | { |
63 | WebCore::Event* coreEvent = WebKit::core(event); |
64 | if (!coreEvent) |
65 | return false; |
66 | WebCore::HTMLImageElement* coreTarget = static_cast<WebCore::HTMLImageElement*>(WEBKIT_DOM_OBJECT(target)->coreObject); |
67 | |
68 | auto result = coreTarget->dispatchEventForBindings(*coreEvent); |
69 | if (result.hasException()) { |
70 | auto description = WebCore::DOMException::description(result.releaseException().code()); |
71 | g_set_error_literal(error, g_quark_from_string("WEBKIT_DOM" ), description.legacyCode, description.name); |
72 | return false; |
73 | } |
74 | return result.releaseReturnValue(); |
75 | } |
76 | |
77 | static gboolean webkit_dom_html_image_element_add_event_listener(WebKitDOMEventTarget* target, const char* eventName, GClosure* handler, gboolean useCapture) |
78 | { |
79 | WebCore::HTMLImageElement* coreTarget = static_cast<WebCore::HTMLImageElement*>(WEBKIT_DOM_OBJECT(target)->coreObject); |
80 | return WebKit::GObjectEventListener::addEventListener(G_OBJECT(target), coreTarget, eventName, handler, useCapture); |
81 | } |
82 | |
83 | static gboolean webkit_dom_html_image_element_remove_event_listener(WebKitDOMEventTarget* target, const char* eventName, GClosure* handler, gboolean useCapture) |
84 | { |
85 | WebCore::HTMLImageElement* coreTarget = static_cast<WebCore::HTMLImageElement*>(WEBKIT_DOM_OBJECT(target)->coreObject); |
86 | return WebKit::GObjectEventListener::removeEventListener(G_OBJECT(target), coreTarget, eventName, handler, useCapture); |
87 | } |
88 | |
89 | static void webkit_dom_html_image_element_dom_event_target_init(WebKitDOMEventTargetIface* iface) |
90 | { |
91 | iface->dispatch_event = webkit_dom_html_image_element_dispatch_event; |
92 | iface->add_event_listener = webkit_dom_html_image_element_add_event_listener; |
93 | iface->remove_event_listener = webkit_dom_html_image_element_remove_event_listener; |
94 | } |
95 | |
96 | G_DEFINE_TYPE_WITH_CODE(WebKitDOMHTMLImageElement, webkit_dom_html_image_element, WEBKIT_DOM_TYPE_HTML_ELEMENT, G_IMPLEMENT_INTERFACE(WEBKIT_DOM_TYPE_EVENT_TARGET, webkit_dom_html_image_element_dom_event_target_init)) |
97 | |
98 | enum { |
99 | DOM_HTML_IMAGE_ELEMENT_PROP_0, |
100 | DOM_HTML_IMAGE_ELEMENT_PROP_NAME, |
101 | DOM_HTML_IMAGE_ELEMENT_PROP_ALIGN, |
102 | DOM_HTML_IMAGE_ELEMENT_PROP_ALT, |
103 | DOM_HTML_IMAGE_ELEMENT_PROP_BORDER, |
104 | DOM_HTML_IMAGE_ELEMENT_PROP_HEIGHT, |
105 | DOM_HTML_IMAGE_ELEMENT_PROP_HSPACE, |
106 | DOM_HTML_IMAGE_ELEMENT_PROP_IS_MAP, |
107 | DOM_HTML_IMAGE_ELEMENT_PROP_LONG_DESC, |
108 | DOM_HTML_IMAGE_ELEMENT_PROP_SRC, |
109 | DOM_HTML_IMAGE_ELEMENT_PROP_USE_MAP, |
110 | DOM_HTML_IMAGE_ELEMENT_PROP_VSPACE, |
111 | DOM_HTML_IMAGE_ELEMENT_PROP_WIDTH, |
112 | DOM_HTML_IMAGE_ELEMENT_PROP_COMPLETE, |
113 | DOM_HTML_IMAGE_ELEMENT_PROP_LOWSRC, |
114 | DOM_HTML_IMAGE_ELEMENT_PROP_NATURAL_HEIGHT, |
115 | DOM_HTML_IMAGE_ELEMENT_PROP_NATURAL_WIDTH, |
116 | DOM_HTML_IMAGE_ELEMENT_PROP_X, |
117 | DOM_HTML_IMAGE_ELEMENT_PROP_Y, |
118 | }; |
119 | |
120 | static void webkit_dom_html_image_element_set_property(GObject* object, guint propertyId, const GValue* value, GParamSpec* pspec) |
121 | { |
122 | WebKitDOMHTMLImageElement* self = WEBKIT_DOM_HTML_IMAGE_ELEMENT(object); |
123 | |
124 | switch (propertyId) { |
125 | case DOM_HTML_IMAGE_ELEMENT_PROP_NAME: |
126 | webkit_dom_html_image_element_set_name(self, g_value_get_string(value)); |
127 | break; |
128 | case DOM_HTML_IMAGE_ELEMENT_PROP_ALIGN: |
129 | webkit_dom_html_image_element_set_align(self, g_value_get_string(value)); |
130 | break; |
131 | case DOM_HTML_IMAGE_ELEMENT_PROP_ALT: |
132 | webkit_dom_html_image_element_set_alt(self, g_value_get_string(value)); |
133 | break; |
134 | case DOM_HTML_IMAGE_ELEMENT_PROP_BORDER: |
135 | webkit_dom_html_image_element_set_border(self, g_value_get_string(value)); |
136 | break; |
137 | case DOM_HTML_IMAGE_ELEMENT_PROP_HEIGHT: |
138 | webkit_dom_html_image_element_set_height(self, g_value_get_long(value)); |
139 | break; |
140 | case DOM_HTML_IMAGE_ELEMENT_PROP_HSPACE: |
141 | webkit_dom_html_image_element_set_hspace(self, g_value_get_long(value)); |
142 | break; |
143 | case DOM_HTML_IMAGE_ELEMENT_PROP_IS_MAP: |
144 | webkit_dom_html_image_element_set_is_map(self, g_value_get_boolean(value)); |
145 | break; |
146 | case DOM_HTML_IMAGE_ELEMENT_PROP_LONG_DESC: |
147 | webkit_dom_html_image_element_set_long_desc(self, g_value_get_string(value)); |
148 | break; |
149 | case DOM_HTML_IMAGE_ELEMENT_PROP_SRC: |
150 | webkit_dom_html_image_element_set_src(self, g_value_get_string(value)); |
151 | break; |
152 | case DOM_HTML_IMAGE_ELEMENT_PROP_USE_MAP: |
153 | webkit_dom_html_image_element_set_use_map(self, g_value_get_string(value)); |
154 | break; |
155 | case DOM_HTML_IMAGE_ELEMENT_PROP_VSPACE: |
156 | webkit_dom_html_image_element_set_vspace(self, g_value_get_long(value)); |
157 | break; |
158 | case DOM_HTML_IMAGE_ELEMENT_PROP_WIDTH: |
159 | webkit_dom_html_image_element_set_width(self, g_value_get_long(value)); |
160 | break; |
161 | case DOM_HTML_IMAGE_ELEMENT_PROP_LOWSRC: |
162 | webkit_dom_html_image_element_set_lowsrc(self, g_value_get_string(value)); |
163 | break; |
164 | default: |
165 | G_OBJECT_WARN_INVALID_PROPERTY_ID(object, propertyId, pspec); |
166 | break; |
167 | } |
168 | } |
169 | |
170 | static void webkit_dom_html_image_element_get_property(GObject* object, guint propertyId, GValue* value, GParamSpec* pspec) |
171 | { |
172 | WebKitDOMHTMLImageElement* self = WEBKIT_DOM_HTML_IMAGE_ELEMENT(object); |
173 | |
174 | switch (propertyId) { |
175 | case DOM_HTML_IMAGE_ELEMENT_PROP_NAME: |
176 | g_value_take_string(value, webkit_dom_html_image_element_get_name(self)); |
177 | break; |
178 | case DOM_HTML_IMAGE_ELEMENT_PROP_ALIGN: |
179 | g_value_take_string(value, webkit_dom_html_image_element_get_align(self)); |
180 | break; |
181 | case DOM_HTML_IMAGE_ELEMENT_PROP_ALT: |
182 | g_value_take_string(value, webkit_dom_html_image_element_get_alt(self)); |
183 | break; |
184 | case DOM_HTML_IMAGE_ELEMENT_PROP_BORDER: |
185 | g_value_take_string(value, webkit_dom_html_image_element_get_border(self)); |
186 | break; |
187 | case DOM_HTML_IMAGE_ELEMENT_PROP_HEIGHT: |
188 | g_value_set_long(value, webkit_dom_html_image_element_get_height(self)); |
189 | break; |
190 | case DOM_HTML_IMAGE_ELEMENT_PROP_HSPACE: |
191 | g_value_set_long(value, webkit_dom_html_image_element_get_hspace(self)); |
192 | break; |
193 | case DOM_HTML_IMAGE_ELEMENT_PROP_IS_MAP: |
194 | g_value_set_boolean(value, webkit_dom_html_image_element_get_is_map(self)); |
195 | break; |
196 | case DOM_HTML_IMAGE_ELEMENT_PROP_LONG_DESC: |
197 | g_value_take_string(value, webkit_dom_html_image_element_get_long_desc(self)); |
198 | break; |
199 | case DOM_HTML_IMAGE_ELEMENT_PROP_SRC: |
200 | g_value_take_string(value, webkit_dom_html_image_element_get_src(self)); |
201 | break; |
202 | case DOM_HTML_IMAGE_ELEMENT_PROP_USE_MAP: |
203 | g_value_take_string(value, webkit_dom_html_image_element_get_use_map(self)); |
204 | break; |
205 | case DOM_HTML_IMAGE_ELEMENT_PROP_VSPACE: |
206 | g_value_set_long(value, webkit_dom_html_image_element_get_vspace(self)); |
207 | break; |
208 | case DOM_HTML_IMAGE_ELEMENT_PROP_WIDTH: |
209 | g_value_set_long(value, webkit_dom_html_image_element_get_width(self)); |
210 | break; |
211 | case DOM_HTML_IMAGE_ELEMENT_PROP_COMPLETE: |
212 | g_value_set_boolean(value, webkit_dom_html_image_element_get_complete(self)); |
213 | break; |
214 | case DOM_HTML_IMAGE_ELEMENT_PROP_LOWSRC: |
215 | g_value_take_string(value, webkit_dom_html_image_element_get_lowsrc(self)); |
216 | break; |
217 | case DOM_HTML_IMAGE_ELEMENT_PROP_NATURAL_HEIGHT: |
218 | g_value_set_long(value, webkit_dom_html_image_element_get_natural_height(self)); |
219 | break; |
220 | case DOM_HTML_IMAGE_ELEMENT_PROP_NATURAL_WIDTH: |
221 | g_value_set_long(value, webkit_dom_html_image_element_get_natural_width(self)); |
222 | break; |
223 | case DOM_HTML_IMAGE_ELEMENT_PROP_X: |
224 | g_value_set_long(value, webkit_dom_html_image_element_get_x(self)); |
225 | break; |
226 | case DOM_HTML_IMAGE_ELEMENT_PROP_Y: |
227 | g_value_set_long(value, webkit_dom_html_image_element_get_y(self)); |
228 | break; |
229 | default: |
230 | G_OBJECT_WARN_INVALID_PROPERTY_ID(object, propertyId, pspec); |
231 | break; |
232 | } |
233 | } |
234 | |
235 | static void webkit_dom_html_image_element_class_init(WebKitDOMHTMLImageElementClass* requestClass) |
236 | { |
237 | GObjectClass* gobjectClass = G_OBJECT_CLASS(requestClass); |
238 | gobjectClass->set_property = webkit_dom_html_image_element_set_property; |
239 | gobjectClass->get_property = webkit_dom_html_image_element_get_property; |
240 | |
241 | g_object_class_install_property( |
242 | gobjectClass, |
243 | DOM_HTML_IMAGE_ELEMENT_PROP_NAME, |
244 | g_param_spec_string( |
245 | "name" , |
246 | "HTMLImageElement:name" , |
247 | "read-write gchar* HTMLImageElement:name" , |
248 | "" , |
249 | WEBKIT_PARAM_READWRITE)); |
250 | |
251 | g_object_class_install_property( |
252 | gobjectClass, |
253 | DOM_HTML_IMAGE_ELEMENT_PROP_ALIGN, |
254 | g_param_spec_string( |
255 | "align" , |
256 | "HTMLImageElement:align" , |
257 | "read-write gchar* HTMLImageElement:align" , |
258 | "" , |
259 | WEBKIT_PARAM_READWRITE)); |
260 | |
261 | g_object_class_install_property( |
262 | gobjectClass, |
263 | DOM_HTML_IMAGE_ELEMENT_PROP_ALT, |
264 | g_param_spec_string( |
265 | "alt" , |
266 | "HTMLImageElement:alt" , |
267 | "read-write gchar* HTMLImageElement:alt" , |
268 | "" , |
269 | WEBKIT_PARAM_READWRITE)); |
270 | |
271 | g_object_class_install_property( |
272 | gobjectClass, |
273 | DOM_HTML_IMAGE_ELEMENT_PROP_BORDER, |
274 | g_param_spec_string( |
275 | "border" , |
276 | "HTMLImageElement:border" , |
277 | "read-write gchar* HTMLImageElement:border" , |
278 | "" , |
279 | WEBKIT_PARAM_READWRITE)); |
280 | |
281 | g_object_class_install_property( |
282 | gobjectClass, |
283 | DOM_HTML_IMAGE_ELEMENT_PROP_HEIGHT, |
284 | g_param_spec_long( |
285 | "height" , |
286 | "HTMLImageElement:height" , |
287 | "read-write glong HTMLImageElement:height" , |
288 | G_MINLONG, G_MAXLONG, 0, |
289 | WEBKIT_PARAM_READWRITE)); |
290 | |
291 | g_object_class_install_property( |
292 | gobjectClass, |
293 | DOM_HTML_IMAGE_ELEMENT_PROP_HSPACE, |
294 | g_param_spec_long( |
295 | "hspace" , |
296 | "HTMLImageElement:hspace" , |
297 | "read-write glong HTMLImageElement:hspace" , |
298 | G_MINLONG, G_MAXLONG, 0, |
299 | WEBKIT_PARAM_READWRITE)); |
300 | |
301 | g_object_class_install_property( |
302 | gobjectClass, |
303 | DOM_HTML_IMAGE_ELEMENT_PROP_IS_MAP, |
304 | g_param_spec_boolean( |
305 | "is-map" , |
306 | "HTMLImageElement:is-map" , |
307 | "read-write gboolean HTMLImageElement:is-map" , |
308 | FALSE, |
309 | WEBKIT_PARAM_READWRITE)); |
310 | |
311 | g_object_class_install_property( |
312 | gobjectClass, |
313 | DOM_HTML_IMAGE_ELEMENT_PROP_LONG_DESC, |
314 | g_param_spec_string( |
315 | "long-desc" , |
316 | "HTMLImageElement:long-desc" , |
317 | "read-write gchar* HTMLImageElement:long-desc" , |
318 | "" , |
319 | WEBKIT_PARAM_READWRITE)); |
320 | |
321 | g_object_class_install_property( |
322 | gobjectClass, |
323 | DOM_HTML_IMAGE_ELEMENT_PROP_SRC, |
324 | g_param_spec_string( |
325 | "src" , |
326 | "HTMLImageElement:src" , |
327 | "read-write gchar* HTMLImageElement:src" , |
328 | "" , |
329 | WEBKIT_PARAM_READWRITE)); |
330 | |
331 | g_object_class_install_property( |
332 | gobjectClass, |
333 | DOM_HTML_IMAGE_ELEMENT_PROP_USE_MAP, |
334 | g_param_spec_string( |
335 | "use-map" , |
336 | "HTMLImageElement:use-map" , |
337 | "read-write gchar* HTMLImageElement:use-map" , |
338 | "" , |
339 | WEBKIT_PARAM_READWRITE)); |
340 | |
341 | g_object_class_install_property( |
342 | gobjectClass, |
343 | DOM_HTML_IMAGE_ELEMENT_PROP_VSPACE, |
344 | g_param_spec_long( |
345 | "vspace" , |
346 | "HTMLImageElement:vspace" , |
347 | "read-write glong HTMLImageElement:vspace" , |
348 | G_MINLONG, G_MAXLONG, 0, |
349 | WEBKIT_PARAM_READWRITE)); |
350 | |
351 | g_object_class_install_property( |
352 | gobjectClass, |
353 | DOM_HTML_IMAGE_ELEMENT_PROP_WIDTH, |
354 | g_param_spec_long( |
355 | "width" , |
356 | "HTMLImageElement:width" , |
357 | "read-write glong HTMLImageElement:width" , |
358 | G_MINLONG, G_MAXLONG, 0, |
359 | WEBKIT_PARAM_READWRITE)); |
360 | |
361 | g_object_class_install_property( |
362 | gobjectClass, |
363 | DOM_HTML_IMAGE_ELEMENT_PROP_COMPLETE, |
364 | g_param_spec_boolean( |
365 | "complete" , |
366 | "HTMLImageElement:complete" , |
367 | "read-only gboolean HTMLImageElement:complete" , |
368 | FALSE, |
369 | WEBKIT_PARAM_READABLE)); |
370 | |
371 | g_object_class_install_property( |
372 | gobjectClass, |
373 | DOM_HTML_IMAGE_ELEMENT_PROP_LOWSRC, |
374 | g_param_spec_string( |
375 | "lowsrc" , |
376 | "HTMLImageElement:lowsrc" , |
377 | "read-write gchar* HTMLImageElement:lowsrc" , |
378 | "" , |
379 | WEBKIT_PARAM_READWRITE)); |
380 | |
381 | g_object_class_install_property( |
382 | gobjectClass, |
383 | DOM_HTML_IMAGE_ELEMENT_PROP_NATURAL_HEIGHT, |
384 | g_param_spec_long( |
385 | "natural-height" , |
386 | "HTMLImageElement:natural-height" , |
387 | "read-only glong HTMLImageElement:natural-height" , |
388 | G_MINLONG, G_MAXLONG, 0, |
389 | WEBKIT_PARAM_READABLE)); |
390 | |
391 | g_object_class_install_property( |
392 | gobjectClass, |
393 | DOM_HTML_IMAGE_ELEMENT_PROP_NATURAL_WIDTH, |
394 | g_param_spec_long( |
395 | "natural-width" , |
396 | "HTMLImageElement:natural-width" , |
397 | "read-only glong HTMLImageElement:natural-width" , |
398 | G_MINLONG, G_MAXLONG, 0, |
399 | WEBKIT_PARAM_READABLE)); |
400 | |
401 | g_object_class_install_property( |
402 | gobjectClass, |
403 | DOM_HTML_IMAGE_ELEMENT_PROP_X, |
404 | g_param_spec_long( |
405 | "x" , |
406 | "HTMLImageElement:x" , |
407 | "read-only glong HTMLImageElement:x" , |
408 | G_MINLONG, G_MAXLONG, 0, |
409 | WEBKIT_PARAM_READABLE)); |
410 | |
411 | g_object_class_install_property( |
412 | gobjectClass, |
413 | DOM_HTML_IMAGE_ELEMENT_PROP_Y, |
414 | g_param_spec_long( |
415 | "y" , |
416 | "HTMLImageElement:y" , |
417 | "read-only glong HTMLImageElement:y" , |
418 | G_MINLONG, G_MAXLONG, 0, |
419 | WEBKIT_PARAM_READABLE)); |
420 | |
421 | } |
422 | |
423 | static void webkit_dom_html_image_element_init(WebKitDOMHTMLImageElement* request) |
424 | { |
425 | UNUSED_PARAM(request); |
426 | } |
427 | |
428 | gchar* webkit_dom_html_image_element_get_name(WebKitDOMHTMLImageElement* self) |
429 | { |
430 | WebCore::JSMainThreadNullState state; |
431 | g_return_val_if_fail(WEBKIT_DOM_IS_HTML_IMAGE_ELEMENT(self), 0); |
432 | WebCore::HTMLImageElement* item = WebKit::core(self); |
433 | gchar* result = convertToUTF8String(item->getNameAttribute()); |
434 | return result; |
435 | } |
436 | |
437 | void webkit_dom_html_image_element_set_name(WebKitDOMHTMLImageElement* self, const gchar* value) |
438 | { |
439 | WebCore::JSMainThreadNullState state; |
440 | g_return_if_fail(WEBKIT_DOM_IS_HTML_IMAGE_ELEMENT(self)); |
441 | g_return_if_fail(value); |
442 | WebCore::HTMLImageElement* item = WebKit::core(self); |
443 | WTF::String convertedValue = WTF::String::fromUTF8(value); |
444 | item->setAttributeWithoutSynchronization(WebCore::HTMLNames::nameAttr, convertedValue); |
445 | } |
446 | |
447 | gchar* webkit_dom_html_image_element_get_align(WebKitDOMHTMLImageElement* self) |
448 | { |
449 | WebCore::JSMainThreadNullState state; |
450 | g_return_val_if_fail(WEBKIT_DOM_IS_HTML_IMAGE_ELEMENT(self), 0); |
451 | WebCore::HTMLImageElement* item = WebKit::core(self); |
452 | gchar* result = convertToUTF8String(item->attributeWithoutSynchronization(WebCore::HTMLNames::alignAttr)); |
453 | return result; |
454 | } |
455 | |
456 | void webkit_dom_html_image_element_set_align(WebKitDOMHTMLImageElement* self, const gchar* value) |
457 | { |
458 | WebCore::JSMainThreadNullState state; |
459 | g_return_if_fail(WEBKIT_DOM_IS_HTML_IMAGE_ELEMENT(self)); |
460 | g_return_if_fail(value); |
461 | WebCore::HTMLImageElement* item = WebKit::core(self); |
462 | WTF::String convertedValue = WTF::String::fromUTF8(value); |
463 | item->setAttributeWithoutSynchronization(WebCore::HTMLNames::alignAttr, convertedValue); |
464 | } |
465 | |
466 | gchar* webkit_dom_html_image_element_get_alt(WebKitDOMHTMLImageElement* self) |
467 | { |
468 | WebCore::JSMainThreadNullState state; |
469 | g_return_val_if_fail(WEBKIT_DOM_IS_HTML_IMAGE_ELEMENT(self), 0); |
470 | WebCore::HTMLImageElement* item = WebKit::core(self); |
471 | gchar* result = convertToUTF8String(item->attributeWithoutSynchronization(WebCore::HTMLNames::altAttr)); |
472 | return result; |
473 | } |
474 | |
475 | void webkit_dom_html_image_element_set_alt(WebKitDOMHTMLImageElement* self, const gchar* value) |
476 | { |
477 | WebCore::JSMainThreadNullState state; |
478 | g_return_if_fail(WEBKIT_DOM_IS_HTML_IMAGE_ELEMENT(self)); |
479 | g_return_if_fail(value); |
480 | WebCore::HTMLImageElement* item = WebKit::core(self); |
481 | WTF::String convertedValue = WTF::String::fromUTF8(value); |
482 | item->setAttributeWithoutSynchronization(WebCore::HTMLNames::altAttr, convertedValue); |
483 | } |
484 | |
485 | gchar* webkit_dom_html_image_element_get_border(WebKitDOMHTMLImageElement* self) |
486 | { |
487 | WebCore::JSMainThreadNullState state; |
488 | g_return_val_if_fail(WEBKIT_DOM_IS_HTML_IMAGE_ELEMENT(self), 0); |
489 | WebCore::HTMLImageElement* item = WebKit::core(self); |
490 | gchar* result = convertToUTF8String(item->attributeWithoutSynchronization(WebCore::HTMLNames::borderAttr)); |
491 | return result; |
492 | } |
493 | |
494 | void webkit_dom_html_image_element_set_border(WebKitDOMHTMLImageElement* self, const gchar* value) |
495 | { |
496 | WebCore::JSMainThreadNullState state; |
497 | g_return_if_fail(WEBKIT_DOM_IS_HTML_IMAGE_ELEMENT(self)); |
498 | g_return_if_fail(value); |
499 | WebCore::HTMLImageElement* item = WebKit::core(self); |
500 | WTF::String convertedValue = WTF::String::fromUTF8(value); |
501 | item->setAttributeWithoutSynchronization(WebCore::HTMLNames::borderAttr, convertedValue); |
502 | } |
503 | |
504 | glong webkit_dom_html_image_element_get_height(WebKitDOMHTMLImageElement* self) |
505 | { |
506 | WebCore::JSMainThreadNullState state; |
507 | g_return_val_if_fail(WEBKIT_DOM_IS_HTML_IMAGE_ELEMENT(self), 0); |
508 | WebCore::HTMLImageElement* item = WebKit::core(self); |
509 | glong result = item->height(); |
510 | return result; |
511 | } |
512 | |
513 | void webkit_dom_html_image_element_set_height(WebKitDOMHTMLImageElement* self, glong value) |
514 | { |
515 | WebCore::JSMainThreadNullState state; |
516 | g_return_if_fail(WEBKIT_DOM_IS_HTML_IMAGE_ELEMENT(self)); |
517 | WebCore::HTMLImageElement* item = WebKit::core(self); |
518 | item->setHeight(value); |
519 | } |
520 | |
521 | glong webkit_dom_html_image_element_get_hspace(WebKitDOMHTMLImageElement* self) |
522 | { |
523 | WebCore::JSMainThreadNullState state; |
524 | g_return_val_if_fail(WEBKIT_DOM_IS_HTML_IMAGE_ELEMENT(self), 0); |
525 | WebCore::HTMLImageElement* item = WebKit::core(self); |
526 | glong result = item->getIntegralAttribute(WebCore::HTMLNames::hspaceAttr); |
527 | return result; |
528 | } |
529 | |
530 | void webkit_dom_html_image_element_set_hspace(WebKitDOMHTMLImageElement* self, glong value) |
531 | { |
532 | WebCore::JSMainThreadNullState state; |
533 | g_return_if_fail(WEBKIT_DOM_IS_HTML_IMAGE_ELEMENT(self)); |
534 | WebCore::HTMLImageElement* item = WebKit::core(self); |
535 | item->setIntegralAttribute(WebCore::HTMLNames::hspaceAttr, value); |
536 | } |
537 | |
538 | gboolean webkit_dom_html_image_element_get_is_map(WebKitDOMHTMLImageElement* self) |
539 | { |
540 | WebCore::JSMainThreadNullState state; |
541 | g_return_val_if_fail(WEBKIT_DOM_IS_HTML_IMAGE_ELEMENT(self), FALSE); |
542 | WebCore::HTMLImageElement* item = WebKit::core(self); |
543 | gboolean result = item->hasAttributeWithoutSynchronization(WebCore::HTMLNames::ismapAttr); |
544 | return result; |
545 | } |
546 | |
547 | void webkit_dom_html_image_element_set_is_map(WebKitDOMHTMLImageElement* self, gboolean value) |
548 | { |
549 | WebCore::JSMainThreadNullState state; |
550 | g_return_if_fail(WEBKIT_DOM_IS_HTML_IMAGE_ELEMENT(self)); |
551 | WebCore::HTMLImageElement* item = WebKit::core(self); |
552 | item->setBooleanAttribute(WebCore::HTMLNames::ismapAttr, value); |
553 | } |
554 | |
555 | gchar* webkit_dom_html_image_element_get_long_desc(WebKitDOMHTMLImageElement* self) |
556 | { |
557 | WebCore::JSMainThreadNullState state; |
558 | g_return_val_if_fail(WEBKIT_DOM_IS_HTML_IMAGE_ELEMENT(self), 0); |
559 | WebCore::HTMLImageElement* item = WebKit::core(self); |
560 | gchar* result = convertToUTF8String(item->getURLAttribute(WebCore::HTMLNames::longdescAttr)); |
561 | return result; |
562 | } |
563 | |
564 | void webkit_dom_html_image_element_set_long_desc(WebKitDOMHTMLImageElement* self, const gchar* value) |
565 | { |
566 | WebCore::JSMainThreadNullState state; |
567 | g_return_if_fail(WEBKIT_DOM_IS_HTML_IMAGE_ELEMENT(self)); |
568 | g_return_if_fail(value); |
569 | WebCore::HTMLImageElement* item = WebKit::core(self); |
570 | WTF::String convertedValue = WTF::String::fromUTF8(value); |
571 | item->setAttributeWithoutSynchronization(WebCore::HTMLNames::longdescAttr, convertedValue); |
572 | } |
573 | |
574 | gchar* webkit_dom_html_image_element_get_src(WebKitDOMHTMLImageElement* self) |
575 | { |
576 | WebCore::JSMainThreadNullState state; |
577 | g_return_val_if_fail(WEBKIT_DOM_IS_HTML_IMAGE_ELEMENT(self), 0); |
578 | WebCore::HTMLImageElement* item = WebKit::core(self); |
579 | gchar* result = convertToUTF8String(item->getURLAttribute(WebCore::HTMLNames::srcAttr)); |
580 | return result; |
581 | } |
582 | |
583 | void webkit_dom_html_image_element_set_src(WebKitDOMHTMLImageElement* self, const gchar* value) |
584 | { |
585 | WebCore::JSMainThreadNullState state; |
586 | g_return_if_fail(WEBKIT_DOM_IS_HTML_IMAGE_ELEMENT(self)); |
587 | g_return_if_fail(value); |
588 | WebCore::HTMLImageElement* item = WebKit::core(self); |
589 | WTF::String convertedValue = WTF::String::fromUTF8(value); |
590 | item->setAttributeWithoutSynchronization(WebCore::HTMLNames::srcAttr, convertedValue); |
591 | } |
592 | |
593 | gchar* webkit_dom_html_image_element_get_use_map(WebKitDOMHTMLImageElement* self) |
594 | { |
595 | WebCore::JSMainThreadNullState state; |
596 | g_return_val_if_fail(WEBKIT_DOM_IS_HTML_IMAGE_ELEMENT(self), 0); |
597 | WebCore::HTMLImageElement* item = WebKit::core(self); |
598 | gchar* result = convertToUTF8String(item->attributeWithoutSynchronization(WebCore::HTMLNames::usemapAttr)); |
599 | return result; |
600 | } |
601 | |
602 | void webkit_dom_html_image_element_set_use_map(WebKitDOMHTMLImageElement* self, const gchar* value) |
603 | { |
604 | WebCore::JSMainThreadNullState state; |
605 | g_return_if_fail(WEBKIT_DOM_IS_HTML_IMAGE_ELEMENT(self)); |
606 | g_return_if_fail(value); |
607 | WebCore::HTMLImageElement* item = WebKit::core(self); |
608 | WTF::String convertedValue = WTF::String::fromUTF8(value); |
609 | item->setAttributeWithoutSynchronization(WebCore::HTMLNames::usemapAttr, convertedValue); |
610 | } |
611 | |
612 | glong webkit_dom_html_image_element_get_vspace(WebKitDOMHTMLImageElement* self) |
613 | { |
614 | WebCore::JSMainThreadNullState state; |
615 | g_return_val_if_fail(WEBKIT_DOM_IS_HTML_IMAGE_ELEMENT(self), 0); |
616 | WebCore::HTMLImageElement* item = WebKit::core(self); |
617 | glong result = item->getIntegralAttribute(WebCore::HTMLNames::vspaceAttr); |
618 | return result; |
619 | } |
620 | |
621 | void webkit_dom_html_image_element_set_vspace(WebKitDOMHTMLImageElement* self, glong value) |
622 | { |
623 | WebCore::JSMainThreadNullState state; |
624 | g_return_if_fail(WEBKIT_DOM_IS_HTML_IMAGE_ELEMENT(self)); |
625 | WebCore::HTMLImageElement* item = WebKit::core(self); |
626 | item->setIntegralAttribute(WebCore::HTMLNames::vspaceAttr, value); |
627 | } |
628 | |
629 | glong webkit_dom_html_image_element_get_width(WebKitDOMHTMLImageElement* self) |
630 | { |
631 | WebCore::JSMainThreadNullState state; |
632 | g_return_val_if_fail(WEBKIT_DOM_IS_HTML_IMAGE_ELEMENT(self), 0); |
633 | WebCore::HTMLImageElement* item = WebKit::core(self); |
634 | glong result = item->width(); |
635 | return result; |
636 | } |
637 | |
638 | void webkit_dom_html_image_element_set_width(WebKitDOMHTMLImageElement* self, glong value) |
639 | { |
640 | WebCore::JSMainThreadNullState state; |
641 | g_return_if_fail(WEBKIT_DOM_IS_HTML_IMAGE_ELEMENT(self)); |
642 | WebCore::HTMLImageElement* item = WebKit::core(self); |
643 | item->setWidth(value); |
644 | } |
645 | |
646 | gboolean webkit_dom_html_image_element_get_complete(WebKitDOMHTMLImageElement* self) |
647 | { |
648 | WebCore::JSMainThreadNullState state; |
649 | g_return_val_if_fail(WEBKIT_DOM_IS_HTML_IMAGE_ELEMENT(self), FALSE); |
650 | WebCore::HTMLImageElement* item = WebKit::core(self); |
651 | gboolean result = item->complete(); |
652 | return result; |
653 | } |
654 | |
655 | gchar* webkit_dom_html_image_element_get_lowsrc(WebKitDOMHTMLImageElement* self) |
656 | { |
657 | WebCore::JSMainThreadNullState state; |
658 | g_return_val_if_fail(WEBKIT_DOM_IS_HTML_IMAGE_ELEMENT(self), 0); |
659 | WebCore::HTMLImageElement* item = WebKit::core(self); |
660 | gchar* result = convertToUTF8String(item->getURLAttribute(WebCore::HTMLNames::lowsrcAttr)); |
661 | return result; |
662 | } |
663 | |
664 | void webkit_dom_html_image_element_set_lowsrc(WebKitDOMHTMLImageElement* self, const gchar* value) |
665 | { |
666 | WebCore::JSMainThreadNullState state; |
667 | g_return_if_fail(WEBKIT_DOM_IS_HTML_IMAGE_ELEMENT(self)); |
668 | g_return_if_fail(value); |
669 | WebCore::HTMLImageElement* item = WebKit::core(self); |
670 | WTF::String convertedValue = WTF::String::fromUTF8(value); |
671 | item->setAttributeWithoutSynchronization(WebCore::HTMLNames::lowsrcAttr, convertedValue); |
672 | } |
673 | |
674 | glong webkit_dom_html_image_element_get_natural_height(WebKitDOMHTMLImageElement* self) |
675 | { |
676 | WebCore::JSMainThreadNullState state; |
677 | g_return_val_if_fail(WEBKIT_DOM_IS_HTML_IMAGE_ELEMENT(self), 0); |
678 | WebCore::HTMLImageElement* item = WebKit::core(self); |
679 | glong result = item->naturalHeight(); |
680 | return result; |
681 | } |
682 | |
683 | glong webkit_dom_html_image_element_get_natural_width(WebKitDOMHTMLImageElement* self) |
684 | { |
685 | WebCore::JSMainThreadNullState state; |
686 | g_return_val_if_fail(WEBKIT_DOM_IS_HTML_IMAGE_ELEMENT(self), 0); |
687 | WebCore::HTMLImageElement* item = WebKit::core(self); |
688 | glong result = item->naturalWidth(); |
689 | return result; |
690 | } |
691 | |
692 | glong webkit_dom_html_image_element_get_x(WebKitDOMHTMLImageElement* self) |
693 | { |
694 | WebCore::JSMainThreadNullState state; |
695 | g_return_val_if_fail(WEBKIT_DOM_IS_HTML_IMAGE_ELEMENT(self), 0); |
696 | WebCore::HTMLImageElement* item = WebKit::core(self); |
697 | glong result = item->x(); |
698 | return result; |
699 | } |
700 | |
701 | glong webkit_dom_html_image_element_get_y(WebKitDOMHTMLImageElement* self) |
702 | { |
703 | WebCore::JSMainThreadNullState state; |
704 | g_return_val_if_fail(WEBKIT_DOM_IS_HTML_IMAGE_ELEMENT(self), 0); |
705 | WebCore::HTMLImageElement* item = WebKit::core(self); |
706 | glong result = item->y(); |
707 | return result; |
708 | } |
709 | |
710 | G_GNUC_END_IGNORE_DEPRECATIONS; |
711 | |