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 "WebKitDOMHTMLLinkElement.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 "WebKitDOMDOMTokenListPrivate.h" |
31 | #include "WebKitDOMEventPrivate.h" |
32 | #include "WebKitDOMEventTarget.h" |
33 | #include "WebKitDOMHTMLLinkElementPrivate.h" |
34 | #include "WebKitDOMNodePrivate.h" |
35 | #include "WebKitDOMPrivate.h" |
36 | #include "WebKitDOMStyleSheetPrivate.h" |
37 | #include "ConvertToUTF8String.h" |
38 | #include <wtf/GetPtr.h> |
39 | #include <wtf/RefPtr.h> |
40 | |
41 | G_GNUC_BEGIN_IGNORE_DEPRECATIONS; |
42 | |
43 | namespace WebKit { |
44 | |
45 | WebKitDOMHTMLLinkElement* kit(WebCore::HTMLLinkElement* obj) |
46 | { |
47 | return WEBKIT_DOM_HTML_LINK_ELEMENT(kit(static_cast<WebCore::Node*>(obj))); |
48 | } |
49 | |
50 | WebCore::HTMLLinkElement* core(WebKitDOMHTMLLinkElement* request) |
51 | { |
52 | return request ? static_cast<WebCore::HTMLLinkElement*>(WEBKIT_DOM_OBJECT(request)->coreObject) : 0; |
53 | } |
54 | |
55 | WebKitDOMHTMLLinkElement* wrapHTMLLinkElement(WebCore::HTMLLinkElement* coreObject) |
56 | { |
57 | ASSERT(coreObject); |
58 | return WEBKIT_DOM_HTML_LINK_ELEMENT(g_object_new(WEBKIT_DOM_TYPE_HTML_LINK_ELEMENT, "core-object" , coreObject, nullptr)); |
59 | } |
60 | |
61 | } // namespace WebKit |
62 | |
63 | static gboolean webkit_dom_html_link_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::HTMLLinkElement* coreTarget = static_cast<WebCore::HTMLLinkElement*>(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_link_element_add_event_listener(WebKitDOMEventTarget* target, const char* eventName, GClosure* handler, gboolean useCapture) |
80 | { |
81 | WebCore::HTMLLinkElement* coreTarget = static_cast<WebCore::HTMLLinkElement*>(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_link_element_remove_event_listener(WebKitDOMEventTarget* target, const char* eventName, GClosure* handler, gboolean useCapture) |
86 | { |
87 | WebCore::HTMLLinkElement* coreTarget = static_cast<WebCore::HTMLLinkElement*>(WEBKIT_DOM_OBJECT(target)->coreObject); |
88 | return WebKit::GObjectEventListener::removeEventListener(G_OBJECT(target), coreTarget, eventName, handler, useCapture); |
89 | } |
90 | |
91 | static void webkit_dom_html_link_element_dom_event_target_init(WebKitDOMEventTargetIface* iface) |
92 | { |
93 | iface->dispatch_event = webkit_dom_html_link_element_dispatch_event; |
94 | iface->add_event_listener = webkit_dom_html_link_element_add_event_listener; |
95 | iface->remove_event_listener = webkit_dom_html_link_element_remove_event_listener; |
96 | } |
97 | |
98 | G_DEFINE_TYPE_WITH_CODE(WebKitDOMHTMLLinkElement, webkit_dom_html_link_element, WEBKIT_DOM_TYPE_HTML_ELEMENT, G_IMPLEMENT_INTERFACE(WEBKIT_DOM_TYPE_EVENT_TARGET, webkit_dom_html_link_element_dom_event_target_init)) |
99 | |
100 | enum { |
101 | DOM_HTML_LINK_ELEMENT_PROP_0, |
102 | DOM_HTML_LINK_ELEMENT_PROP_DISABLED, |
103 | DOM_HTML_LINK_ELEMENT_PROP_CHARSET, |
104 | DOM_HTML_LINK_ELEMENT_PROP_HREF, |
105 | DOM_HTML_LINK_ELEMENT_PROP_HREFLANG, |
106 | DOM_HTML_LINK_ELEMENT_PROP_MEDIA, |
107 | DOM_HTML_LINK_ELEMENT_PROP_REL, |
108 | DOM_HTML_LINK_ELEMENT_PROP_REV, |
109 | DOM_HTML_LINK_ELEMENT_PROP_SIZES, |
110 | DOM_HTML_LINK_ELEMENT_PROP_TARGET, |
111 | DOM_HTML_LINK_ELEMENT_PROP_TYPE, |
112 | DOM_HTML_LINK_ELEMENT_PROP_SHEET, |
113 | }; |
114 | |
115 | static void webkit_dom_html_link_element_set_property(GObject* object, guint propertyId, const GValue* value, GParamSpec* pspec) |
116 | { |
117 | WebKitDOMHTMLLinkElement* self = WEBKIT_DOM_HTML_LINK_ELEMENT(object); |
118 | |
119 | switch (propertyId) { |
120 | case DOM_HTML_LINK_ELEMENT_PROP_DISABLED: |
121 | webkit_dom_html_link_element_set_disabled(self, g_value_get_boolean(value)); |
122 | break; |
123 | case DOM_HTML_LINK_ELEMENT_PROP_CHARSET: |
124 | webkit_dom_html_link_element_set_charset(self, g_value_get_string(value)); |
125 | break; |
126 | case DOM_HTML_LINK_ELEMENT_PROP_HREF: |
127 | webkit_dom_html_link_element_set_href(self, g_value_get_string(value)); |
128 | break; |
129 | case DOM_HTML_LINK_ELEMENT_PROP_HREFLANG: |
130 | webkit_dom_html_link_element_set_hreflang(self, g_value_get_string(value)); |
131 | break; |
132 | case DOM_HTML_LINK_ELEMENT_PROP_MEDIA: |
133 | webkit_dom_html_link_element_set_media(self, g_value_get_string(value)); |
134 | break; |
135 | case DOM_HTML_LINK_ELEMENT_PROP_REL: |
136 | webkit_dom_html_link_element_set_rel(self, g_value_get_string(value)); |
137 | break; |
138 | case DOM_HTML_LINK_ELEMENT_PROP_REV: |
139 | webkit_dom_html_link_element_set_rev(self, g_value_get_string(value)); |
140 | break; |
141 | case DOM_HTML_LINK_ELEMENT_PROP_TARGET: |
142 | webkit_dom_html_link_element_set_target(self, g_value_get_string(value)); |
143 | break; |
144 | case DOM_HTML_LINK_ELEMENT_PROP_TYPE: |
145 | webkit_dom_html_link_element_set_type_attr(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_link_element_get_property(GObject* object, guint propertyId, GValue* value, GParamSpec* pspec) |
154 | { |
155 | WebKitDOMHTMLLinkElement* self = WEBKIT_DOM_HTML_LINK_ELEMENT(object); |
156 | |
157 | switch (propertyId) { |
158 | case DOM_HTML_LINK_ELEMENT_PROP_DISABLED: |
159 | g_value_set_boolean(value, webkit_dom_html_link_element_get_disabled(self)); |
160 | break; |
161 | case DOM_HTML_LINK_ELEMENT_PROP_CHARSET: |
162 | g_value_take_string(value, webkit_dom_html_link_element_get_charset(self)); |
163 | break; |
164 | case DOM_HTML_LINK_ELEMENT_PROP_HREF: |
165 | g_value_take_string(value, webkit_dom_html_link_element_get_href(self)); |
166 | break; |
167 | case DOM_HTML_LINK_ELEMENT_PROP_HREFLANG: |
168 | g_value_take_string(value, webkit_dom_html_link_element_get_hreflang(self)); |
169 | break; |
170 | case DOM_HTML_LINK_ELEMENT_PROP_MEDIA: |
171 | g_value_take_string(value, webkit_dom_html_link_element_get_media(self)); |
172 | break; |
173 | case DOM_HTML_LINK_ELEMENT_PROP_REL: |
174 | g_value_take_string(value, webkit_dom_html_link_element_get_rel(self)); |
175 | break; |
176 | case DOM_HTML_LINK_ELEMENT_PROP_REV: |
177 | g_value_take_string(value, webkit_dom_html_link_element_get_rev(self)); |
178 | break; |
179 | case DOM_HTML_LINK_ELEMENT_PROP_SIZES: |
180 | g_value_set_object(value, webkit_dom_html_link_element_get_sizes(self)); |
181 | break; |
182 | case DOM_HTML_LINK_ELEMENT_PROP_TARGET: |
183 | g_value_take_string(value, webkit_dom_html_link_element_get_target(self)); |
184 | break; |
185 | case DOM_HTML_LINK_ELEMENT_PROP_TYPE: |
186 | g_value_take_string(value, webkit_dom_html_link_element_get_type_attr(self)); |
187 | break; |
188 | case DOM_HTML_LINK_ELEMENT_PROP_SHEET: |
189 | g_value_set_object(value, webkit_dom_html_link_element_get_sheet(self)); |
190 | break; |
191 | default: |
192 | G_OBJECT_WARN_INVALID_PROPERTY_ID(object, propertyId, pspec); |
193 | break; |
194 | } |
195 | } |
196 | |
197 | static void webkit_dom_html_link_element_class_init(WebKitDOMHTMLLinkElementClass* requestClass) |
198 | { |
199 | GObjectClass* gobjectClass = G_OBJECT_CLASS(requestClass); |
200 | gobjectClass->set_property = webkit_dom_html_link_element_set_property; |
201 | gobjectClass->get_property = webkit_dom_html_link_element_get_property; |
202 | |
203 | g_object_class_install_property( |
204 | gobjectClass, |
205 | DOM_HTML_LINK_ELEMENT_PROP_DISABLED, |
206 | g_param_spec_boolean( |
207 | "disabled" , |
208 | "HTMLLinkElement:disabled" , |
209 | "read-write gboolean HTMLLinkElement:disabled" , |
210 | FALSE, |
211 | WEBKIT_PARAM_READWRITE)); |
212 | |
213 | g_object_class_install_property( |
214 | gobjectClass, |
215 | DOM_HTML_LINK_ELEMENT_PROP_CHARSET, |
216 | g_param_spec_string( |
217 | "charset" , |
218 | "HTMLLinkElement:charset" , |
219 | "read-write gchar* HTMLLinkElement:charset" , |
220 | "" , |
221 | WEBKIT_PARAM_READWRITE)); |
222 | |
223 | g_object_class_install_property( |
224 | gobjectClass, |
225 | DOM_HTML_LINK_ELEMENT_PROP_HREF, |
226 | g_param_spec_string( |
227 | "href" , |
228 | "HTMLLinkElement:href" , |
229 | "read-write gchar* HTMLLinkElement:href" , |
230 | "" , |
231 | WEBKIT_PARAM_READWRITE)); |
232 | |
233 | g_object_class_install_property( |
234 | gobjectClass, |
235 | DOM_HTML_LINK_ELEMENT_PROP_HREFLANG, |
236 | g_param_spec_string( |
237 | "hreflang" , |
238 | "HTMLLinkElement:hreflang" , |
239 | "read-write gchar* HTMLLinkElement:hreflang" , |
240 | "" , |
241 | WEBKIT_PARAM_READWRITE)); |
242 | |
243 | g_object_class_install_property( |
244 | gobjectClass, |
245 | DOM_HTML_LINK_ELEMENT_PROP_MEDIA, |
246 | g_param_spec_string( |
247 | "media" , |
248 | "HTMLLinkElement:media" , |
249 | "read-write gchar* HTMLLinkElement:media" , |
250 | "" , |
251 | WEBKIT_PARAM_READWRITE)); |
252 | |
253 | g_object_class_install_property( |
254 | gobjectClass, |
255 | DOM_HTML_LINK_ELEMENT_PROP_REL, |
256 | g_param_spec_string( |
257 | "rel" , |
258 | "HTMLLinkElement:rel" , |
259 | "read-write gchar* HTMLLinkElement:rel" , |
260 | "" , |
261 | WEBKIT_PARAM_READWRITE)); |
262 | |
263 | g_object_class_install_property( |
264 | gobjectClass, |
265 | DOM_HTML_LINK_ELEMENT_PROP_REV, |
266 | g_param_spec_string( |
267 | "rev" , |
268 | "HTMLLinkElement:rev" , |
269 | "read-write gchar* HTMLLinkElement:rev" , |
270 | "" , |
271 | WEBKIT_PARAM_READWRITE)); |
272 | |
273 | g_object_class_install_property( |
274 | gobjectClass, |
275 | DOM_HTML_LINK_ELEMENT_PROP_SIZES, |
276 | g_param_spec_object( |
277 | "sizes" , |
278 | "HTMLLinkElement:sizes" , |
279 | "read-only WebKitDOMDOMTokenList* HTMLLinkElement:sizes" , |
280 | WEBKIT_DOM_TYPE_DOM_TOKEN_LIST, |
281 | WEBKIT_PARAM_READABLE)); |
282 | |
283 | g_object_class_install_property( |
284 | gobjectClass, |
285 | DOM_HTML_LINK_ELEMENT_PROP_TARGET, |
286 | g_param_spec_string( |
287 | "target" , |
288 | "HTMLLinkElement:target" , |
289 | "read-write gchar* HTMLLinkElement:target" , |
290 | "" , |
291 | WEBKIT_PARAM_READWRITE)); |
292 | |
293 | g_object_class_install_property( |
294 | gobjectClass, |
295 | DOM_HTML_LINK_ELEMENT_PROP_TYPE, |
296 | g_param_spec_string( |
297 | "type" , |
298 | "HTMLLinkElement:type" , |
299 | "read-write gchar* HTMLLinkElement:type" , |
300 | "" , |
301 | WEBKIT_PARAM_READWRITE)); |
302 | |
303 | g_object_class_install_property( |
304 | gobjectClass, |
305 | DOM_HTML_LINK_ELEMENT_PROP_SHEET, |
306 | g_param_spec_object( |
307 | "sheet" , |
308 | "HTMLLinkElement:sheet" , |
309 | "read-only WebKitDOMStyleSheet* HTMLLinkElement:sheet" , |
310 | WEBKIT_DOM_TYPE_STYLE_SHEET, |
311 | WEBKIT_PARAM_READABLE)); |
312 | } |
313 | |
314 | static void webkit_dom_html_link_element_init(WebKitDOMHTMLLinkElement* request) |
315 | { |
316 | UNUSED_PARAM(request); |
317 | } |
318 | |
319 | gboolean webkit_dom_html_link_element_get_disabled(WebKitDOMHTMLLinkElement* self) |
320 | { |
321 | WebCore::JSMainThreadNullState state; |
322 | g_return_val_if_fail(WEBKIT_DOM_IS_HTML_LINK_ELEMENT(self), FALSE); |
323 | WebCore::HTMLLinkElement* item = WebKit::core(self); |
324 | gboolean result = item->hasAttributeWithoutSynchronization(WebCore::HTMLNames::disabledAttr); |
325 | return result; |
326 | } |
327 | |
328 | void webkit_dom_html_link_element_set_disabled(WebKitDOMHTMLLinkElement* self, gboolean value) |
329 | { |
330 | WebCore::JSMainThreadNullState state; |
331 | g_return_if_fail(WEBKIT_DOM_IS_HTML_LINK_ELEMENT(self)); |
332 | WebCore::HTMLLinkElement* item = WebKit::core(self); |
333 | item->setBooleanAttribute(WebCore::HTMLNames::disabledAttr, value); |
334 | } |
335 | |
336 | gchar* webkit_dom_html_link_element_get_charset(WebKitDOMHTMLLinkElement* self) |
337 | { |
338 | WebCore::JSMainThreadNullState state; |
339 | g_return_val_if_fail(WEBKIT_DOM_IS_HTML_LINK_ELEMENT(self), 0); |
340 | WebCore::HTMLLinkElement* item = WebKit::core(self); |
341 | gchar* result = convertToUTF8String(item->attributeWithoutSynchronization(WebCore::HTMLNames::charsetAttr)); |
342 | return result; |
343 | } |
344 | |
345 | void webkit_dom_html_link_element_set_charset(WebKitDOMHTMLLinkElement* self, const gchar* value) |
346 | { |
347 | WebCore::JSMainThreadNullState state; |
348 | g_return_if_fail(WEBKIT_DOM_IS_HTML_LINK_ELEMENT(self)); |
349 | g_return_if_fail(value); |
350 | WebCore::HTMLLinkElement* item = WebKit::core(self); |
351 | WTF::String convertedValue = WTF::String::fromUTF8(value); |
352 | item->setAttributeWithoutSynchronization(WebCore::HTMLNames::charsetAttr, convertedValue); |
353 | } |
354 | |
355 | gchar* webkit_dom_html_link_element_get_href(WebKitDOMHTMLLinkElement* self) |
356 | { |
357 | WebCore::JSMainThreadNullState state; |
358 | g_return_val_if_fail(WEBKIT_DOM_IS_HTML_LINK_ELEMENT(self), 0); |
359 | WebCore::HTMLLinkElement* item = WebKit::core(self); |
360 | gchar* result = convertToUTF8String(item->getURLAttribute(WebCore::HTMLNames::hrefAttr)); |
361 | return result; |
362 | } |
363 | |
364 | void webkit_dom_html_link_element_set_href(WebKitDOMHTMLLinkElement* self, const gchar* value) |
365 | { |
366 | WebCore::JSMainThreadNullState state; |
367 | g_return_if_fail(WEBKIT_DOM_IS_HTML_LINK_ELEMENT(self)); |
368 | g_return_if_fail(value); |
369 | WebCore::HTMLLinkElement* item = WebKit::core(self); |
370 | WTF::String convertedValue = WTF::String::fromUTF8(value); |
371 | item->setAttributeWithoutSynchronization(WebCore::HTMLNames::hrefAttr, convertedValue); |
372 | } |
373 | |
374 | gchar* webkit_dom_html_link_element_get_hreflang(WebKitDOMHTMLLinkElement* self) |
375 | { |
376 | WebCore::JSMainThreadNullState state; |
377 | g_return_val_if_fail(WEBKIT_DOM_IS_HTML_LINK_ELEMENT(self), 0); |
378 | WebCore::HTMLLinkElement* item = WebKit::core(self); |
379 | gchar* result = convertToUTF8String(item->attributeWithoutSynchronization(WebCore::HTMLNames::hreflangAttr)); |
380 | return result; |
381 | } |
382 | |
383 | void webkit_dom_html_link_element_set_hreflang(WebKitDOMHTMLLinkElement* self, const gchar* value) |
384 | { |
385 | WebCore::JSMainThreadNullState state; |
386 | g_return_if_fail(WEBKIT_DOM_IS_HTML_LINK_ELEMENT(self)); |
387 | g_return_if_fail(value); |
388 | WebCore::HTMLLinkElement* item = WebKit::core(self); |
389 | WTF::String convertedValue = WTF::String::fromUTF8(value); |
390 | item->setAttributeWithoutSynchronization(WebCore::HTMLNames::hreflangAttr, convertedValue); |
391 | } |
392 | |
393 | gchar* webkit_dom_html_link_element_get_media(WebKitDOMHTMLLinkElement* self) |
394 | { |
395 | WebCore::JSMainThreadNullState state; |
396 | g_return_val_if_fail(WEBKIT_DOM_IS_HTML_LINK_ELEMENT(self), 0); |
397 | WebCore::HTMLLinkElement* item = WebKit::core(self); |
398 | gchar* result = convertToUTF8String(item->attributeWithoutSynchronization(WebCore::HTMLNames::mediaAttr)); |
399 | return result; |
400 | } |
401 | |
402 | void webkit_dom_html_link_element_set_media(WebKitDOMHTMLLinkElement* self, const gchar* value) |
403 | { |
404 | WebCore::JSMainThreadNullState state; |
405 | g_return_if_fail(WEBKIT_DOM_IS_HTML_LINK_ELEMENT(self)); |
406 | g_return_if_fail(value); |
407 | WebCore::HTMLLinkElement* item = WebKit::core(self); |
408 | WTF::String convertedValue = WTF::String::fromUTF8(value); |
409 | item->setAttributeWithoutSynchronization(WebCore::HTMLNames::mediaAttr, convertedValue); |
410 | } |
411 | |
412 | gchar* webkit_dom_html_link_element_get_rel(WebKitDOMHTMLLinkElement* self) |
413 | { |
414 | WebCore::JSMainThreadNullState state; |
415 | g_return_val_if_fail(WEBKIT_DOM_IS_HTML_LINK_ELEMENT(self), 0); |
416 | WebCore::HTMLLinkElement* item = WebKit::core(self); |
417 | gchar* result = convertToUTF8String(item->attributeWithoutSynchronization(WebCore::HTMLNames::relAttr)); |
418 | return result; |
419 | } |
420 | |
421 | void webkit_dom_html_link_element_set_rel(WebKitDOMHTMLLinkElement* self, const gchar* value) |
422 | { |
423 | WebCore::JSMainThreadNullState state; |
424 | g_return_if_fail(WEBKIT_DOM_IS_HTML_LINK_ELEMENT(self)); |
425 | g_return_if_fail(value); |
426 | WebCore::HTMLLinkElement* item = WebKit::core(self); |
427 | WTF::String convertedValue = WTF::String::fromUTF8(value); |
428 | item->setAttributeWithoutSynchronization(WebCore::HTMLNames::relAttr, convertedValue); |
429 | } |
430 | |
431 | gchar* webkit_dom_html_link_element_get_rev(WebKitDOMHTMLLinkElement* self) |
432 | { |
433 | WebCore::JSMainThreadNullState state; |
434 | g_return_val_if_fail(WEBKIT_DOM_IS_HTML_LINK_ELEMENT(self), 0); |
435 | WebCore::HTMLLinkElement* item = WebKit::core(self); |
436 | gchar* result = convertToUTF8String(item->attributeWithoutSynchronization(WebCore::HTMLNames::revAttr)); |
437 | return result; |
438 | } |
439 | |
440 | void webkit_dom_html_link_element_set_rev(WebKitDOMHTMLLinkElement* self, const gchar* value) |
441 | { |
442 | WebCore::JSMainThreadNullState state; |
443 | g_return_if_fail(WEBKIT_DOM_IS_HTML_LINK_ELEMENT(self)); |
444 | g_return_if_fail(value); |
445 | WebCore::HTMLLinkElement* item = WebKit::core(self); |
446 | WTF::String convertedValue = WTF::String::fromUTF8(value); |
447 | item->setAttributeWithoutSynchronization(WebCore::HTMLNames::revAttr, convertedValue); |
448 | } |
449 | |
450 | WebKitDOMDOMTokenList* webkit_dom_html_link_element_get_sizes(WebKitDOMHTMLLinkElement* self) |
451 | { |
452 | WebCore::JSMainThreadNullState state; |
453 | g_return_val_if_fail(WEBKIT_DOM_IS_HTML_LINK_ELEMENT(self), 0); |
454 | WebCore::HTMLLinkElement* item = WebKit::core(self); |
455 | RefPtr<WebCore::DOMTokenList> gobjectResult = WTF::getPtr(item->sizes()); |
456 | return WebKit::kit(gobjectResult.get()); |
457 | } |
458 | |
459 | gchar* webkit_dom_html_link_element_get_target(WebKitDOMHTMLLinkElement* self) |
460 | { |
461 | WebCore::JSMainThreadNullState state; |
462 | g_return_val_if_fail(WEBKIT_DOM_IS_HTML_LINK_ELEMENT(self), 0); |
463 | WebCore::HTMLLinkElement* item = WebKit::core(self); |
464 | gchar* result = convertToUTF8String(item->attributeWithoutSynchronization(WebCore::HTMLNames::targetAttr)); |
465 | return result; |
466 | } |
467 | |
468 | void webkit_dom_html_link_element_set_target(WebKitDOMHTMLLinkElement* self, const gchar* value) |
469 | { |
470 | WebCore::JSMainThreadNullState state; |
471 | g_return_if_fail(WEBKIT_DOM_IS_HTML_LINK_ELEMENT(self)); |
472 | g_return_if_fail(value); |
473 | WebCore::HTMLLinkElement* item = WebKit::core(self); |
474 | WTF::String convertedValue = WTF::String::fromUTF8(value); |
475 | item->setAttributeWithoutSynchronization(WebCore::HTMLNames::targetAttr, convertedValue); |
476 | } |
477 | |
478 | gchar* webkit_dom_html_link_element_get_type_attr(WebKitDOMHTMLLinkElement* self) |
479 | { |
480 | WebCore::JSMainThreadNullState state; |
481 | g_return_val_if_fail(WEBKIT_DOM_IS_HTML_LINK_ELEMENT(self), 0); |
482 | WebCore::HTMLLinkElement* item = WebKit::core(self); |
483 | gchar* result = convertToUTF8String(item->attributeWithoutSynchronization(WebCore::HTMLNames::typeAttr)); |
484 | return result; |
485 | } |
486 | |
487 | void webkit_dom_html_link_element_set_type_attr(WebKitDOMHTMLLinkElement* self, const gchar* value) |
488 | { |
489 | WebCore::JSMainThreadNullState state; |
490 | g_return_if_fail(WEBKIT_DOM_IS_HTML_LINK_ELEMENT(self)); |
491 | g_return_if_fail(value); |
492 | WebCore::HTMLLinkElement* item = WebKit::core(self); |
493 | WTF::String convertedValue = WTF::String::fromUTF8(value); |
494 | item->setAttributeWithoutSynchronization(WebCore::HTMLNames::typeAttr, convertedValue); |
495 | } |
496 | |
497 | WebKitDOMStyleSheet* webkit_dom_html_link_element_get_sheet(WebKitDOMHTMLLinkElement* self) |
498 | { |
499 | WebCore::JSMainThreadNullState state; |
500 | g_return_val_if_fail(WEBKIT_DOM_IS_HTML_LINK_ELEMENT(self), 0); |
501 | WebCore::HTMLLinkElement* item = WebKit::core(self); |
502 | RefPtr<WebCore::StyleSheet> gobjectResult = WTF::getPtr(item->sheet()); |
503 | return WebKit::kit(gobjectResult.get()); |
504 | } |
505 | |
506 | void webkit_dom_html_link_element_set_sizes(WebKitDOMHTMLLinkElement* linkElement, const gchar* value) |
507 | { |
508 | g_return_if_fail(WEBKIT_DOM_IS_HTML_LINK_ELEMENT(linkElement)); |
509 | g_return_if_fail(value); |
510 | |
511 | WebKit::core(linkElement)->sizes().setValue(String::fromUTF8(value)); |
512 | } |
513 | G_GNUC_END_IGNORE_DEPRECATIONS; |
514 | |