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 "WebKitDOMDocument.h" |
22 | |
23 | #include "ConvertToUTF8String.h" |
24 | #include "GObjectEventListener.h" |
25 | #include "WebKitDOMAttrPrivate.h" |
26 | #include "WebKitDOMCDATASectionPrivate.h" |
27 | #include "WebKitDOMCSSStyleDeclarationPrivate.h" |
28 | #include "WebKitDOMCommentPrivate.h" |
29 | #include "WebKitDOMDOMImplementationPrivate.h" |
30 | #include "WebKitDOMDOMWindowPrivate.h" |
31 | #include "WebKitDOMDocumentFragmentPrivate.h" |
32 | #include "WebKitDOMDocumentPrivate.h" |
33 | #include "WebKitDOMDocumentTypePrivate.h" |
34 | #include "WebKitDOMDocumentUnstable.h" |
35 | #include "WebKitDOMElementPrivate.h" |
36 | #include "WebKitDOMEventPrivate.h" |
37 | #include "WebKitDOMEventTarget.h" |
38 | #include "WebKitDOMHTMLCollectionPrivate.h" |
39 | #include "WebKitDOMHTMLElementPrivate.h" |
40 | #include "WebKitDOMHTMLHeadElementPrivate.h" |
41 | #include "WebKitDOMHTMLScriptElementPrivate.h" |
42 | #include "WebKitDOMNodeFilterPrivate.h" |
43 | #include "WebKitDOMNodeIteratorPrivate.h" |
44 | #include "WebKitDOMNodeListPrivate.h" |
45 | #include "WebKitDOMNodePrivate.h" |
46 | #include "WebKitDOMPrivate.h" |
47 | #include "WebKitDOMProcessingInstructionPrivate.h" |
48 | #include "WebKitDOMRangePrivate.h" |
49 | #include "WebKitDOMStyleSheetListPrivate.h" |
50 | #include "WebKitDOMTextPrivate.h" |
51 | #include "WebKitDOMTreeWalkerPrivate.h" |
52 | #include "WebKitDOMXPathExpressionPrivate.h" |
53 | #include "WebKitDOMXPathNSResolverPrivate.h" |
54 | #include "WebKitDOMXPathResultPrivate.h" |
55 | #include <WebCore/CSSImportRule.h> |
56 | #include <WebCore/DOMException.h> |
57 | #include <WebCore/Document.h> |
58 | #include <WebCore/FullscreenManager.h> |
59 | #include <WebCore/JSExecState.h> |
60 | #include <wtf/GetPtr.h> |
61 | #include <wtf/RefPtr.h> |
62 | |
63 | G_GNUC_BEGIN_IGNORE_DEPRECATIONS; |
64 | |
65 | static gboolean webkit_dom_document_dispatch_event(WebKitDOMEventTarget* target, WebKitDOMEvent* event, GError** error) |
66 | { |
67 | WebCore::Event* coreEvent = WebKit::core(event); |
68 | if (!coreEvent) |
69 | return false; |
70 | WebCore::Document* coreTarget = static_cast<WebCore::Document*>(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_document_add_event_listener(WebKitDOMEventTarget* target, const char* eventName, GClosure* handler, gboolean useCapture) |
82 | { |
83 | WebCore::Document* coreTarget = static_cast<WebCore::Document*>(WEBKIT_DOM_OBJECT(target)->coreObject); |
84 | return WebKit::GObjectEventListener::addEventListener(G_OBJECT(target), coreTarget, eventName, handler, useCapture); |
85 | } |
86 | |
87 | static gboolean webkit_dom_document_remove_event_listener(WebKitDOMEventTarget* target, const char* eventName, GClosure* handler, gboolean useCapture) |
88 | { |
89 | WebCore::Document* coreTarget = static_cast<WebCore::Document*>(WEBKIT_DOM_OBJECT(target)->coreObject); |
90 | return WebKit::GObjectEventListener::removeEventListener(G_OBJECT(target), coreTarget, eventName, handler, useCapture); |
91 | } |
92 | |
93 | void webkitDOMDocumentDOMEventTargetInit(WebKitDOMEventTargetIface* iface) |
94 | { |
95 | iface->dispatch_event = webkit_dom_document_dispatch_event; |
96 | iface->add_event_listener = webkit_dom_document_add_event_listener; |
97 | iface->remove_event_listener = webkit_dom_document_remove_event_listener; |
98 | } |
99 | |
100 | enum { |
101 | DOM_DOCUMENT_PROP_0, |
102 | DOM_DOCUMENT_PROP_DOCTYPE, |
103 | DOM_DOCUMENT_PROP_IMPLEMENTATION, |
104 | DOM_DOCUMENT_PROP_DOCUMENT_ELEMENT, |
105 | DOM_DOCUMENT_PROP_INPUT_ENCODING, |
106 | DOM_DOCUMENT_PROP_XML_ENCODING, |
107 | DOM_DOCUMENT_PROP_XML_VERSION, |
108 | DOM_DOCUMENT_PROP_XML_STANDALONE, |
109 | DOM_DOCUMENT_PROP_DOCUMENT_URI, |
110 | DOM_DOCUMENT_PROP_DEFAULT_VIEW, |
111 | DOM_DOCUMENT_PROP_STYLE_SHEETS, |
112 | DOM_DOCUMENT_PROP_CONTENT_TYPE, |
113 | DOM_DOCUMENT_PROP_TITLE, |
114 | DOM_DOCUMENT_PROP_DIR, |
115 | DOM_DOCUMENT_PROP_DESIGN_MODE, |
116 | DOM_DOCUMENT_PROP_REFERRER, |
117 | DOM_DOCUMENT_PROP_DOMAIN, |
118 | DOM_DOCUMENT_PROP_URL, |
119 | DOM_DOCUMENT_PROP_COOKIE, |
120 | DOM_DOCUMENT_PROP_BODY, |
121 | DOM_DOCUMENT_PROP_HEAD, |
122 | DOM_DOCUMENT_PROP_IMAGES, |
123 | DOM_DOCUMENT_PROP_APPLETS, |
124 | DOM_DOCUMENT_PROP_LINKS, |
125 | DOM_DOCUMENT_PROP_FORMS, |
126 | DOM_DOCUMENT_PROP_ANCHORS, |
127 | DOM_DOCUMENT_PROP_EMBEDS, |
128 | DOM_DOCUMENT_PROP_PLUGINS, |
129 | DOM_DOCUMENT_PROP_SCRIPTS, |
130 | DOM_DOCUMENT_PROP_LAST_MODIFIED, |
131 | DOM_DOCUMENT_PROP_CHARSET, |
132 | DOM_DOCUMENT_PROP_READY_STATE, |
133 | DOM_DOCUMENT_PROP_CHARACTER_SET, |
134 | DOM_DOCUMENT_PROP_PREFERRED_STYLESHEET_SET, |
135 | DOM_DOCUMENT_PROP_SELECTED_STYLESHEET_SET, |
136 | DOM_DOCUMENT_PROP_ACTIVE_ELEMENT, |
137 | DOM_DOCUMENT_PROP_COMPAT_MODE, |
138 | DOM_DOCUMENT_PROP_WEBKIT_IS_FULL_SCREEN, |
139 | DOM_DOCUMENT_PROP_WEBKIT_FULL_SCREEN_KEYBOARD_INPUT_ALLOWED, |
140 | DOM_DOCUMENT_PROP_WEBKIT_CURRENT_FULL_SCREEN_ELEMENT, |
141 | DOM_DOCUMENT_PROP_WEBKIT_FULLSCREEN_ENABLED, |
142 | DOM_DOCUMENT_PROP_WEBKIT_FULLSCREEN_ELEMENT, |
143 | DOM_DOCUMENT_PROP_POINTER_LOCK_ELEMENT, |
144 | DOM_DOCUMENT_PROP_VISIBILITY_STATE, |
145 | DOM_DOCUMENT_PROP_HIDDEN, |
146 | DOM_DOCUMENT_PROP_CURRENT_SCRIPT, |
147 | DOM_DOCUMENT_PROP_ORIGIN, |
148 | DOM_DOCUMENT_PROP_SCROLLING_ELEMENT, |
149 | DOM_DOCUMENT_PROP_CHILDREN, |
150 | DOM_DOCUMENT_PROP_FIRST_ELEMENT_CHILD, |
151 | DOM_DOCUMENT_PROP_LAST_ELEMENT_CHILD, |
152 | DOM_DOCUMENT_PROP_CHILD_ELEMENT_COUNT, |
153 | }; |
154 | |
155 | static void webkit_dom_document_set_property(GObject* object, guint propertyId, const GValue* value, GParamSpec* pspec) |
156 | { |
157 | WebKitDOMDocument* self = WEBKIT_DOM_DOCUMENT(object); |
158 | |
159 | switch (propertyId) { |
160 | case DOM_DOCUMENT_PROP_XML_VERSION: |
161 | webkit_dom_document_set_xml_version(self, g_value_get_string(value), nullptr); |
162 | break; |
163 | case DOM_DOCUMENT_PROP_XML_STANDALONE: |
164 | webkit_dom_document_set_xml_standalone(self, g_value_get_boolean(value), nullptr); |
165 | break; |
166 | case DOM_DOCUMENT_PROP_DOCUMENT_URI: |
167 | webkit_dom_document_set_document_uri(self, g_value_get_string(value)); |
168 | break; |
169 | case DOM_DOCUMENT_PROP_TITLE: |
170 | webkit_dom_document_set_title(self, g_value_get_string(value)); |
171 | break; |
172 | case DOM_DOCUMENT_PROP_DIR: |
173 | webkit_dom_document_set_dir(self, g_value_get_string(value)); |
174 | break; |
175 | case DOM_DOCUMENT_PROP_DESIGN_MODE: |
176 | webkit_dom_document_set_design_mode(self, g_value_get_string(value)); |
177 | break; |
178 | case DOM_DOCUMENT_PROP_COOKIE: |
179 | webkit_dom_document_set_cookie(self, g_value_get_string(value), nullptr); |
180 | break; |
181 | case DOM_DOCUMENT_PROP_CHARSET: |
182 | webkit_dom_document_set_charset(self, g_value_get_string(value)); |
183 | break; |
184 | case DOM_DOCUMENT_PROP_SELECTED_STYLESHEET_SET: |
185 | g_warning("%s: The selected-stylesheet-set property has been removed and no longer works." , __func__); |
186 | break; |
187 | default: |
188 | G_OBJECT_WARN_INVALID_PROPERTY_ID(object, propertyId, pspec); |
189 | break; |
190 | } |
191 | } |
192 | |
193 | static void webkit_dom_document_get_property(GObject* object, guint propertyId, GValue* value, GParamSpec* pspec) |
194 | { |
195 | WebKitDOMDocument* self = WEBKIT_DOM_DOCUMENT(object); |
196 | |
197 | switch (propertyId) { |
198 | case DOM_DOCUMENT_PROP_DOCTYPE: |
199 | g_value_set_object(value, webkit_dom_document_get_doctype(self)); |
200 | break; |
201 | case DOM_DOCUMENT_PROP_IMPLEMENTATION: |
202 | g_value_set_object(value, webkit_dom_document_get_implementation(self)); |
203 | break; |
204 | case DOM_DOCUMENT_PROP_DOCUMENT_ELEMENT: |
205 | g_value_set_object(value, webkit_dom_document_get_document_element(self)); |
206 | break; |
207 | case DOM_DOCUMENT_PROP_INPUT_ENCODING: |
208 | g_value_take_string(value, webkit_dom_document_get_input_encoding(self)); |
209 | break; |
210 | case DOM_DOCUMENT_PROP_XML_ENCODING: |
211 | g_value_take_string(value, webkit_dom_document_get_xml_encoding(self)); |
212 | break; |
213 | case DOM_DOCUMENT_PROP_XML_VERSION: |
214 | g_value_take_string(value, webkit_dom_document_get_xml_version(self)); |
215 | break; |
216 | case DOM_DOCUMENT_PROP_XML_STANDALONE: |
217 | g_value_set_boolean(value, webkit_dom_document_get_xml_standalone(self)); |
218 | break; |
219 | case DOM_DOCUMENT_PROP_DOCUMENT_URI: |
220 | g_value_take_string(value, webkit_dom_document_get_document_uri(self)); |
221 | break; |
222 | case DOM_DOCUMENT_PROP_DEFAULT_VIEW: |
223 | g_value_set_object(value, webkit_dom_document_get_default_view(self)); |
224 | break; |
225 | case DOM_DOCUMENT_PROP_STYLE_SHEETS: |
226 | g_value_set_object(value, webkit_dom_document_get_style_sheets(self)); |
227 | break; |
228 | case DOM_DOCUMENT_PROP_CONTENT_TYPE: |
229 | g_value_take_string(value, webkit_dom_document_get_content_type(self)); |
230 | break; |
231 | case DOM_DOCUMENT_PROP_TITLE: |
232 | g_value_take_string(value, webkit_dom_document_get_title(self)); |
233 | break; |
234 | case DOM_DOCUMENT_PROP_DIR: |
235 | g_value_take_string(value, webkit_dom_document_get_dir(self)); |
236 | break; |
237 | case DOM_DOCUMENT_PROP_DESIGN_MODE: |
238 | g_value_take_string(value, webkit_dom_document_get_design_mode(self)); |
239 | break; |
240 | case DOM_DOCUMENT_PROP_REFERRER: |
241 | g_value_take_string(value, webkit_dom_document_get_referrer(self)); |
242 | break; |
243 | case DOM_DOCUMENT_PROP_DOMAIN: |
244 | g_value_take_string(value, webkit_dom_document_get_domain(self)); |
245 | break; |
246 | case DOM_DOCUMENT_PROP_URL: |
247 | g_value_take_string(value, webkit_dom_document_get_url(self)); |
248 | break; |
249 | case DOM_DOCUMENT_PROP_COOKIE: |
250 | g_value_take_string(value, webkit_dom_document_get_cookie(self, nullptr)); |
251 | break; |
252 | case DOM_DOCUMENT_PROP_BODY: |
253 | g_value_set_object(value, webkit_dom_document_get_body(self)); |
254 | break; |
255 | case DOM_DOCUMENT_PROP_HEAD: |
256 | g_value_set_object(value, webkit_dom_document_get_head(self)); |
257 | break; |
258 | case DOM_DOCUMENT_PROP_IMAGES: |
259 | g_value_set_object(value, webkit_dom_document_get_images(self)); |
260 | break; |
261 | case DOM_DOCUMENT_PROP_APPLETS: |
262 | g_value_set_object(value, webkit_dom_document_get_applets(self)); |
263 | break; |
264 | case DOM_DOCUMENT_PROP_LINKS: |
265 | g_value_set_object(value, webkit_dom_document_get_links(self)); |
266 | break; |
267 | case DOM_DOCUMENT_PROP_FORMS: |
268 | g_value_set_object(value, webkit_dom_document_get_forms(self)); |
269 | break; |
270 | case DOM_DOCUMENT_PROP_ANCHORS: |
271 | g_value_set_object(value, webkit_dom_document_get_anchors(self)); |
272 | break; |
273 | case DOM_DOCUMENT_PROP_EMBEDS: |
274 | g_value_set_object(value, webkit_dom_document_get_embeds(self)); |
275 | break; |
276 | case DOM_DOCUMENT_PROP_PLUGINS: |
277 | g_value_set_object(value, webkit_dom_document_get_plugins(self)); |
278 | break; |
279 | case DOM_DOCUMENT_PROP_SCRIPTS: |
280 | g_value_set_object(value, webkit_dom_document_get_scripts(self)); |
281 | break; |
282 | case DOM_DOCUMENT_PROP_LAST_MODIFIED: |
283 | g_value_take_string(value, webkit_dom_document_get_last_modified(self)); |
284 | break; |
285 | case DOM_DOCUMENT_PROP_CHARSET: |
286 | g_value_take_string(value, webkit_dom_document_get_charset(self)); |
287 | break; |
288 | case DOM_DOCUMENT_PROP_READY_STATE: |
289 | g_value_take_string(value, webkit_dom_document_get_ready_state(self)); |
290 | break; |
291 | case DOM_DOCUMENT_PROP_CHARACTER_SET: |
292 | g_value_take_string(value, webkit_dom_document_get_character_set(self)); |
293 | break; |
294 | case DOM_DOCUMENT_PROP_PREFERRED_STYLESHEET_SET: |
295 | g_warning("%s: The preferred-stylesheet-set property has been removed and no longer works." , __func__); |
296 | break; |
297 | case DOM_DOCUMENT_PROP_SELECTED_STYLESHEET_SET: |
298 | g_warning("%s: The selected-stylesheet-set property has been removed and no longer works." , __func__); |
299 | break; |
300 | case DOM_DOCUMENT_PROP_ACTIVE_ELEMENT: |
301 | g_value_set_object(value, webkit_dom_document_get_active_element(self)); |
302 | break; |
303 | case DOM_DOCUMENT_PROP_COMPAT_MODE: |
304 | g_value_take_string(value, webkit_dom_document_get_compat_mode(self)); |
305 | break; |
306 | case DOM_DOCUMENT_PROP_WEBKIT_IS_FULL_SCREEN: |
307 | g_value_set_boolean(value, webkit_dom_document_get_webkit_is_fullscreen(self)); |
308 | break; |
309 | case DOM_DOCUMENT_PROP_WEBKIT_FULL_SCREEN_KEYBOARD_INPUT_ALLOWED: |
310 | g_value_set_boolean(value, webkit_dom_document_get_webkit_fullscreen_keyboard_input_allowed(self)); |
311 | break; |
312 | case DOM_DOCUMENT_PROP_WEBKIT_CURRENT_FULL_SCREEN_ELEMENT: |
313 | g_value_set_object(value, webkit_dom_document_get_webkit_current_fullscreen_element(self)); |
314 | break; |
315 | case DOM_DOCUMENT_PROP_WEBKIT_FULLSCREEN_ENABLED: |
316 | g_value_set_boolean(value, webkit_dom_document_get_webkit_fullscreen_enabled(self)); |
317 | break; |
318 | case DOM_DOCUMENT_PROP_WEBKIT_FULLSCREEN_ELEMENT: |
319 | g_value_set_object(value, webkit_dom_document_get_webkit_fullscreen_element(self)); |
320 | break; |
321 | case DOM_DOCUMENT_PROP_POINTER_LOCK_ELEMENT: |
322 | g_value_set_object(value, webkit_dom_document_get_pointer_lock_element(self)); |
323 | break; |
324 | case DOM_DOCUMENT_PROP_VISIBILITY_STATE: |
325 | g_value_take_string(value, webkit_dom_document_get_visibility_state(self)); |
326 | break; |
327 | case DOM_DOCUMENT_PROP_HIDDEN: |
328 | g_value_set_boolean(value, webkit_dom_document_get_hidden(self)); |
329 | break; |
330 | case DOM_DOCUMENT_PROP_CURRENT_SCRIPT: |
331 | g_value_set_object(value, webkit_dom_document_get_current_script(self)); |
332 | break; |
333 | case DOM_DOCUMENT_PROP_ORIGIN: |
334 | g_value_take_string(value, webkit_dom_document_get_origin(self)); |
335 | break; |
336 | case DOM_DOCUMENT_PROP_SCROLLING_ELEMENT: |
337 | g_value_set_object(value, webkit_dom_document_get_scrolling_element(self)); |
338 | break; |
339 | case DOM_DOCUMENT_PROP_CHILDREN: |
340 | g_value_set_object(value, webkit_dom_document_get_children(self)); |
341 | break; |
342 | case DOM_DOCUMENT_PROP_FIRST_ELEMENT_CHILD: |
343 | g_value_set_object(value, webkit_dom_document_get_first_element_child(self)); |
344 | break; |
345 | case DOM_DOCUMENT_PROP_LAST_ELEMENT_CHILD: |
346 | g_value_set_object(value, webkit_dom_document_get_last_element_child(self)); |
347 | break; |
348 | case DOM_DOCUMENT_PROP_CHILD_ELEMENT_COUNT: |
349 | g_value_set_ulong(value, webkit_dom_document_get_child_element_count(self)); |
350 | break; |
351 | default: |
352 | G_OBJECT_WARN_INVALID_PROPERTY_ID(object, propertyId, pspec); |
353 | break; |
354 | } |
355 | } |
356 | |
357 | void webkitDOMDocumentInstallProperties(GObjectClass* gobjectClass) |
358 | { |
359 | gobjectClass->set_property = webkit_dom_document_set_property; |
360 | gobjectClass->get_property = webkit_dom_document_get_property; |
361 | |
362 | g_object_class_install_property( |
363 | gobjectClass, |
364 | DOM_DOCUMENT_PROP_DOCTYPE, |
365 | g_param_spec_object( |
366 | "doctype" , |
367 | "Document:doctype" , |
368 | "read-only WebKitDOMDocumentType* Document:doctype" , |
369 | WEBKIT_DOM_TYPE_DOCUMENT_TYPE, |
370 | WEBKIT_PARAM_READABLE)); |
371 | |
372 | g_object_class_install_property( |
373 | gobjectClass, |
374 | DOM_DOCUMENT_PROP_IMPLEMENTATION, |
375 | g_param_spec_object( |
376 | "implementation" , |
377 | "Document:implementation" , |
378 | "read-only WebKitDOMDOMImplementation* Document:implementation" , |
379 | WEBKIT_DOM_TYPE_DOM_IMPLEMENTATION, |
380 | WEBKIT_PARAM_READABLE)); |
381 | |
382 | g_object_class_install_property( |
383 | gobjectClass, |
384 | DOM_DOCUMENT_PROP_DOCUMENT_ELEMENT, |
385 | g_param_spec_object( |
386 | "document-element" , |
387 | "Document:document-element" , |
388 | "read-only WebKitDOMElement* Document:document-element" , |
389 | WEBKIT_DOM_TYPE_ELEMENT, |
390 | WEBKIT_PARAM_READABLE)); |
391 | |
392 | g_object_class_install_property( |
393 | gobjectClass, |
394 | DOM_DOCUMENT_PROP_INPUT_ENCODING, |
395 | g_param_spec_string( |
396 | "input-encoding" , |
397 | "Document:input-encoding" , |
398 | "read-only gchar* Document:input-encoding" , |
399 | "" , |
400 | WEBKIT_PARAM_READABLE)); |
401 | |
402 | g_object_class_install_property( |
403 | gobjectClass, |
404 | DOM_DOCUMENT_PROP_XML_ENCODING, |
405 | g_param_spec_string( |
406 | "xml-encoding" , |
407 | "Document:xml-encoding" , |
408 | "read-only gchar* Document:xml-encoding" , |
409 | "" , |
410 | WEBKIT_PARAM_READABLE)); |
411 | |
412 | g_object_class_install_property( |
413 | gobjectClass, |
414 | DOM_DOCUMENT_PROP_XML_VERSION, |
415 | g_param_spec_string( |
416 | "xml-version" , |
417 | "Document:xml-version" , |
418 | "read-write gchar* Document:xml-version" , |
419 | "" , |
420 | WEBKIT_PARAM_READWRITE)); |
421 | |
422 | g_object_class_install_property( |
423 | gobjectClass, |
424 | DOM_DOCUMENT_PROP_XML_STANDALONE, |
425 | g_param_spec_boolean( |
426 | "xml-standalone" , |
427 | "Document:xml-standalone" , |
428 | "read-write gboolean Document:xml-standalone" , |
429 | FALSE, |
430 | WEBKIT_PARAM_READWRITE)); |
431 | |
432 | g_object_class_install_property( |
433 | gobjectClass, |
434 | DOM_DOCUMENT_PROP_DOCUMENT_URI, |
435 | g_param_spec_string( |
436 | "document-uri" , |
437 | "Document:document-uri" , |
438 | "read-write gchar* Document:document-uri" , |
439 | "" , |
440 | WEBKIT_PARAM_READWRITE)); |
441 | |
442 | g_object_class_install_property( |
443 | gobjectClass, |
444 | DOM_DOCUMENT_PROP_DEFAULT_VIEW, |
445 | g_param_spec_object( |
446 | "default-view" , |
447 | "Document:default-view" , |
448 | "read-only WebKitDOMDOMWindow* Document:default-view" , |
449 | WEBKIT_DOM_TYPE_DOM_WINDOW, |
450 | WEBKIT_PARAM_READABLE)); |
451 | |
452 | g_object_class_install_property( |
453 | gobjectClass, |
454 | DOM_DOCUMENT_PROP_STYLE_SHEETS, |
455 | g_param_spec_object( |
456 | "style-sheets" , |
457 | "Document:style-sheets" , |
458 | "read-only WebKitDOMStyleSheetList* Document:style-sheets" , |
459 | WEBKIT_DOM_TYPE_STYLE_SHEET_LIST, |
460 | WEBKIT_PARAM_READABLE)); |
461 | |
462 | g_object_class_install_property( |
463 | gobjectClass, |
464 | DOM_DOCUMENT_PROP_CONTENT_TYPE, |
465 | g_param_spec_string( |
466 | "content-type" , |
467 | "Document:content-type" , |
468 | "read-only gchar* Document:content-type" , |
469 | "" , |
470 | WEBKIT_PARAM_READABLE)); |
471 | |
472 | g_object_class_install_property( |
473 | gobjectClass, |
474 | DOM_DOCUMENT_PROP_TITLE, |
475 | g_param_spec_string( |
476 | "title" , |
477 | "Document:title" , |
478 | "read-write gchar* Document:title" , |
479 | "" , |
480 | WEBKIT_PARAM_READWRITE)); |
481 | |
482 | g_object_class_install_property( |
483 | gobjectClass, |
484 | DOM_DOCUMENT_PROP_DIR, |
485 | g_param_spec_string( |
486 | "dir" , |
487 | "Document:dir" , |
488 | "read-write gchar* Document:dir" , |
489 | "" , |
490 | WEBKIT_PARAM_READWRITE)); |
491 | |
492 | g_object_class_install_property( |
493 | gobjectClass, |
494 | DOM_DOCUMENT_PROP_DESIGN_MODE, |
495 | g_param_spec_string( |
496 | "design-mode" , |
497 | "Document:design-mode" , |
498 | "read-write gchar* Document:design-mode" , |
499 | "" , |
500 | WEBKIT_PARAM_READWRITE)); |
501 | |
502 | g_object_class_install_property( |
503 | gobjectClass, |
504 | DOM_DOCUMENT_PROP_REFERRER, |
505 | g_param_spec_string( |
506 | "referrer" , |
507 | "Document:referrer" , |
508 | "read-only gchar* Document:referrer" , |
509 | "" , |
510 | WEBKIT_PARAM_READABLE)); |
511 | |
512 | g_object_class_install_property( |
513 | gobjectClass, |
514 | DOM_DOCUMENT_PROP_DOMAIN, |
515 | g_param_spec_string( |
516 | "domain" , |
517 | "Document:domain" , |
518 | "read-only gchar* Document:domain" , |
519 | "" , |
520 | WEBKIT_PARAM_READABLE)); |
521 | |
522 | g_object_class_install_property( |
523 | gobjectClass, |
524 | DOM_DOCUMENT_PROP_URL, |
525 | g_param_spec_string( |
526 | "url" , |
527 | "Document:url" , |
528 | "read-only gchar* Document:url" , |
529 | "" , |
530 | WEBKIT_PARAM_READABLE)); |
531 | |
532 | g_object_class_install_property( |
533 | gobjectClass, |
534 | DOM_DOCUMENT_PROP_COOKIE, |
535 | g_param_spec_string( |
536 | "cookie" , |
537 | "Document:cookie" , |
538 | "read-write gchar* Document:cookie" , |
539 | "" , |
540 | WEBKIT_PARAM_READWRITE)); |
541 | |
542 | g_object_class_install_property( |
543 | gobjectClass, |
544 | DOM_DOCUMENT_PROP_BODY, |
545 | g_param_spec_object( |
546 | "body" , |
547 | "Document:body" , |
548 | "read-only WebKitDOMHTMLElement* Document:body" , |
549 | WEBKIT_DOM_TYPE_HTML_ELEMENT, |
550 | WEBKIT_PARAM_READABLE)); |
551 | |
552 | g_object_class_install_property( |
553 | gobjectClass, |
554 | DOM_DOCUMENT_PROP_HEAD, |
555 | g_param_spec_object( |
556 | "head" , |
557 | "Document:head" , |
558 | "read-only WebKitDOMHTMLHeadElement* Document:head" , |
559 | WEBKIT_DOM_TYPE_HTML_HEAD_ELEMENT, |
560 | WEBKIT_PARAM_READABLE)); |
561 | |
562 | g_object_class_install_property( |
563 | gobjectClass, |
564 | DOM_DOCUMENT_PROP_IMAGES, |
565 | g_param_spec_object( |
566 | "images" , |
567 | "Document:images" , |
568 | "read-only WebKitDOMHTMLCollection* Document:images" , |
569 | WEBKIT_DOM_TYPE_HTML_COLLECTION, |
570 | WEBKIT_PARAM_READABLE)); |
571 | |
572 | g_object_class_install_property( |
573 | gobjectClass, |
574 | DOM_DOCUMENT_PROP_APPLETS, |
575 | g_param_spec_object( |
576 | "applets" , |
577 | "Document:applets" , |
578 | "read-only WebKitDOMHTMLCollection* Document:applets" , |
579 | WEBKIT_DOM_TYPE_HTML_COLLECTION, |
580 | WEBKIT_PARAM_READABLE)); |
581 | |
582 | g_object_class_install_property( |
583 | gobjectClass, |
584 | DOM_DOCUMENT_PROP_LINKS, |
585 | g_param_spec_object( |
586 | "links" , |
587 | "Document:links" , |
588 | "read-only WebKitDOMHTMLCollection* Document:links" , |
589 | WEBKIT_DOM_TYPE_HTML_COLLECTION, |
590 | WEBKIT_PARAM_READABLE)); |
591 | |
592 | g_object_class_install_property( |
593 | gobjectClass, |
594 | DOM_DOCUMENT_PROP_FORMS, |
595 | g_param_spec_object( |
596 | "forms" , |
597 | "Document:forms" , |
598 | "read-only WebKitDOMHTMLCollection* Document:forms" , |
599 | WEBKIT_DOM_TYPE_HTML_COLLECTION, |
600 | WEBKIT_PARAM_READABLE)); |
601 | |
602 | g_object_class_install_property( |
603 | gobjectClass, |
604 | DOM_DOCUMENT_PROP_ANCHORS, |
605 | g_param_spec_object( |
606 | "anchors" , |
607 | "Document:anchors" , |
608 | "read-only WebKitDOMHTMLCollection* Document:anchors" , |
609 | WEBKIT_DOM_TYPE_HTML_COLLECTION, |
610 | WEBKIT_PARAM_READABLE)); |
611 | |
612 | g_object_class_install_property( |
613 | gobjectClass, |
614 | DOM_DOCUMENT_PROP_EMBEDS, |
615 | g_param_spec_object( |
616 | "embeds" , |
617 | "Document:embeds" , |
618 | "read-only WebKitDOMHTMLCollection* Document:embeds" , |
619 | WEBKIT_DOM_TYPE_HTML_COLLECTION, |
620 | WEBKIT_PARAM_READABLE)); |
621 | |
622 | g_object_class_install_property( |
623 | gobjectClass, |
624 | DOM_DOCUMENT_PROP_PLUGINS, |
625 | g_param_spec_object( |
626 | "plugins" , |
627 | "Document:plugins" , |
628 | "read-only WebKitDOMHTMLCollection* Document:plugins" , |
629 | WEBKIT_DOM_TYPE_HTML_COLLECTION, |
630 | WEBKIT_PARAM_READABLE)); |
631 | |
632 | g_object_class_install_property( |
633 | gobjectClass, |
634 | DOM_DOCUMENT_PROP_SCRIPTS, |
635 | g_param_spec_object( |
636 | "scripts" , |
637 | "Document:scripts" , |
638 | "read-only WebKitDOMHTMLCollection* Document:scripts" , |
639 | WEBKIT_DOM_TYPE_HTML_COLLECTION, |
640 | WEBKIT_PARAM_READABLE)); |
641 | |
642 | g_object_class_install_property( |
643 | gobjectClass, |
644 | DOM_DOCUMENT_PROP_LAST_MODIFIED, |
645 | g_param_spec_string( |
646 | "last-modified" , |
647 | "Document:last-modified" , |
648 | "read-only gchar* Document:last-modified" , |
649 | "" , |
650 | WEBKIT_PARAM_READABLE)); |
651 | |
652 | g_object_class_install_property( |
653 | gobjectClass, |
654 | DOM_DOCUMENT_PROP_CHARSET, |
655 | g_param_spec_string( |
656 | "charset" , |
657 | "Document:charset" , |
658 | "read-write gchar* Document:charset" , |
659 | "" , |
660 | WEBKIT_PARAM_READWRITE)); |
661 | |
662 | g_object_class_install_property( |
663 | gobjectClass, |
664 | DOM_DOCUMENT_PROP_READY_STATE, |
665 | g_param_spec_string( |
666 | "ready-state" , |
667 | "Document:ready-state" , |
668 | "read-only gchar* Document:ready-state" , |
669 | "" , |
670 | WEBKIT_PARAM_READABLE)); |
671 | |
672 | g_object_class_install_property( |
673 | gobjectClass, |
674 | DOM_DOCUMENT_PROP_CHARACTER_SET, |
675 | g_param_spec_string( |
676 | "character-set" , |
677 | "Document:character-set" , |
678 | "read-only gchar* Document:character-set" , |
679 | "" , |
680 | WEBKIT_PARAM_READABLE)); |
681 | |
682 | g_object_class_install_property( |
683 | gobjectClass, |
684 | DOM_DOCUMENT_PROP_PREFERRED_STYLESHEET_SET, |
685 | g_param_spec_string( |
686 | "preferred-stylesheet-set" , |
687 | "Document:preferred-stylesheet-set" , |
688 | "read-only gchar* Document:preferred-stylesheet-set" , |
689 | "" , |
690 | WEBKIT_PARAM_READABLE)); |
691 | |
692 | g_object_class_install_property( |
693 | gobjectClass, |
694 | DOM_DOCUMENT_PROP_SELECTED_STYLESHEET_SET, |
695 | g_param_spec_string( |
696 | "selected-stylesheet-set" , |
697 | "Document:selected-stylesheet-set" , |
698 | "read-write gchar* Document:selected-stylesheet-set" , |
699 | "" , |
700 | WEBKIT_PARAM_READWRITE)); |
701 | |
702 | g_object_class_install_property( |
703 | gobjectClass, |
704 | DOM_DOCUMENT_PROP_ACTIVE_ELEMENT, |
705 | g_param_spec_object( |
706 | "active-element" , |
707 | "Document:active-element" , |
708 | "read-only WebKitDOMElement* Document:active-element" , |
709 | WEBKIT_DOM_TYPE_ELEMENT, |
710 | WEBKIT_PARAM_READABLE)); |
711 | |
712 | g_object_class_install_property( |
713 | gobjectClass, |
714 | DOM_DOCUMENT_PROP_COMPAT_MODE, |
715 | g_param_spec_string( |
716 | "compat-mode" , |
717 | "Document:compat-mode" , |
718 | "read-only gchar* Document:compat-mode" , |
719 | "" , |
720 | WEBKIT_PARAM_READABLE)); |
721 | |
722 | g_object_class_install_property( |
723 | gobjectClass, |
724 | DOM_DOCUMENT_PROP_WEBKIT_IS_FULL_SCREEN, |
725 | g_param_spec_boolean( |
726 | "webkit-is-full-screen" , |
727 | "Document:webkit-is-full-screen" , |
728 | "read-only gboolean Document:webkit-is-full-screen" , |
729 | FALSE, |
730 | WEBKIT_PARAM_READABLE)); |
731 | |
732 | g_object_class_install_property( |
733 | gobjectClass, |
734 | DOM_DOCUMENT_PROP_WEBKIT_FULL_SCREEN_KEYBOARD_INPUT_ALLOWED, |
735 | g_param_spec_boolean( |
736 | "webkit-full-screen-keyboard-input-allowed" , |
737 | "Document:webkit-full-screen-keyboard-input-allowed" , |
738 | "read-only gboolean Document:webkit-full-screen-keyboard-input-allowed" , |
739 | FALSE, |
740 | WEBKIT_PARAM_READABLE)); |
741 | |
742 | g_object_class_install_property( |
743 | gobjectClass, |
744 | DOM_DOCUMENT_PROP_WEBKIT_CURRENT_FULL_SCREEN_ELEMENT, |
745 | g_param_spec_object( |
746 | "webkit-current-full-screen-element" , |
747 | "Document:webkit-current-full-screen-element" , |
748 | "read-only WebKitDOMElement* Document:webkit-current-full-screen-element" , |
749 | WEBKIT_DOM_TYPE_ELEMENT, |
750 | WEBKIT_PARAM_READABLE)); |
751 | |
752 | g_object_class_install_property( |
753 | gobjectClass, |
754 | DOM_DOCUMENT_PROP_WEBKIT_FULLSCREEN_ENABLED, |
755 | g_param_spec_boolean( |
756 | "webkit-fullscreen-enabled" , |
757 | "Document:webkit-fullscreen-enabled" , |
758 | "read-only gboolean Document:webkit-fullscreen-enabled" , |
759 | FALSE, |
760 | WEBKIT_PARAM_READABLE)); |
761 | |
762 | g_object_class_install_property( |
763 | gobjectClass, |
764 | DOM_DOCUMENT_PROP_WEBKIT_FULLSCREEN_ELEMENT, |
765 | g_param_spec_object( |
766 | "webkit-fullscreen-element" , |
767 | "Document:webkit-fullscreen-element" , |
768 | "read-only WebKitDOMElement* Document:webkit-fullscreen-element" , |
769 | WEBKIT_DOM_TYPE_ELEMENT, |
770 | WEBKIT_PARAM_READABLE)); |
771 | |
772 | g_object_class_install_property( |
773 | gobjectClass, |
774 | DOM_DOCUMENT_PROP_POINTER_LOCK_ELEMENT, |
775 | g_param_spec_object( |
776 | "pointer-lock-element" , |
777 | "Document:pointer-lock-element" , |
778 | "read-only WebKitDOMElement* Document:pointer-lock-element" , |
779 | WEBKIT_DOM_TYPE_ELEMENT, |
780 | WEBKIT_PARAM_READABLE)); |
781 | |
782 | g_object_class_install_property( |
783 | gobjectClass, |
784 | DOM_DOCUMENT_PROP_VISIBILITY_STATE, |
785 | g_param_spec_string( |
786 | "visibility-state" , |
787 | "Document:visibility-state" , |
788 | "read-only gchar* Document:visibility-state" , |
789 | "" , |
790 | WEBKIT_PARAM_READABLE)); |
791 | |
792 | g_object_class_install_property( |
793 | gobjectClass, |
794 | DOM_DOCUMENT_PROP_HIDDEN, |
795 | g_param_spec_boolean( |
796 | "hidden" , |
797 | "Document:hidden" , |
798 | "read-only gboolean Document:hidden" , |
799 | FALSE, |
800 | WEBKIT_PARAM_READABLE)); |
801 | |
802 | g_object_class_install_property( |
803 | gobjectClass, |
804 | DOM_DOCUMENT_PROP_CURRENT_SCRIPT, |
805 | g_param_spec_object( |
806 | "current-script" , |
807 | "Document:current-script" , |
808 | "read-only WebKitDOMHTMLScriptElement* Document:current-script" , |
809 | WEBKIT_DOM_TYPE_HTML_SCRIPT_ELEMENT, |
810 | WEBKIT_PARAM_READABLE)); |
811 | |
812 | g_object_class_install_property( |
813 | gobjectClass, |
814 | DOM_DOCUMENT_PROP_ORIGIN, |
815 | g_param_spec_string( |
816 | "origin" , |
817 | "Document:origin" , |
818 | "read-only gchar* Document:origin" , |
819 | "" , |
820 | WEBKIT_PARAM_READABLE)); |
821 | |
822 | g_object_class_install_property( |
823 | gobjectClass, |
824 | DOM_DOCUMENT_PROP_SCROLLING_ELEMENT, |
825 | g_param_spec_object( |
826 | "scrolling-element" , |
827 | "Document:scrolling-element" , |
828 | "read-only WebKitDOMElement* Document:scrolling-element" , |
829 | WEBKIT_DOM_TYPE_ELEMENT, |
830 | WEBKIT_PARAM_READABLE)); |
831 | |
832 | g_object_class_install_property( |
833 | gobjectClass, |
834 | DOM_DOCUMENT_PROP_CHILDREN, |
835 | g_param_spec_object( |
836 | "children" , |
837 | "Document:children" , |
838 | "read-only WebKitDOMHTMLCollection* Document:children" , |
839 | WEBKIT_DOM_TYPE_HTML_COLLECTION, |
840 | WEBKIT_PARAM_READABLE)); |
841 | |
842 | g_object_class_install_property( |
843 | gobjectClass, |
844 | DOM_DOCUMENT_PROP_FIRST_ELEMENT_CHILD, |
845 | g_param_spec_object( |
846 | "first-element-child" , |
847 | "Document:first-element-child" , |
848 | "read-only WebKitDOMElement* Document:first-element-child" , |
849 | WEBKIT_DOM_TYPE_ELEMENT, |
850 | WEBKIT_PARAM_READABLE)); |
851 | |
852 | g_object_class_install_property( |
853 | gobjectClass, |
854 | DOM_DOCUMENT_PROP_LAST_ELEMENT_CHILD, |
855 | g_param_spec_object( |
856 | "last-element-child" , |
857 | "Document:last-element-child" , |
858 | "read-only WebKitDOMElement* Document:last-element-child" , |
859 | WEBKIT_DOM_TYPE_ELEMENT, |
860 | WEBKIT_PARAM_READABLE)); |
861 | |
862 | g_object_class_install_property( |
863 | gobjectClass, |
864 | DOM_DOCUMENT_PROP_CHILD_ELEMENT_COUNT, |
865 | g_param_spec_ulong( |
866 | "child-element-count" , |
867 | "Document:child-element-count" , |
868 | "read-only gulong Document:child-element-count" , |
869 | 0, G_MAXULONG, 0, |
870 | WEBKIT_PARAM_READABLE)); |
871 | |
872 | } |
873 | |
874 | WebKitDOMElement* webkit_dom_document_create_element(WebKitDOMDocument* self, const gchar* tagName, GError** error) |
875 | { |
876 | WebCore::JSMainThreadNullState state; |
877 | g_return_val_if_fail(WEBKIT_DOM_IS_DOCUMENT(self), 0); |
878 | g_return_val_if_fail(tagName, 0); |
879 | g_return_val_if_fail(!error || !*error, 0); |
880 | WebCore::Document* item = WebKit::core(self); |
881 | WTF::String convertedTagName = WTF::String::fromUTF8(tagName); |
882 | auto result = item->createElementForBindings(convertedTagName); |
883 | if (result.hasException()) { |
884 | auto description = WebCore::DOMException::description(result.releaseException().code()); |
885 | g_set_error_literal(error, g_quark_from_string("WEBKIT_DOM" ), description.legacyCode, description.name); |
886 | return nullptr; |
887 | } |
888 | return WebKit::kit(result.releaseReturnValue().ptr()); |
889 | } |
890 | |
891 | WebKitDOMDocumentFragment* webkit_dom_document_create_document_fragment(WebKitDOMDocument* self) |
892 | { |
893 | WebCore::JSMainThreadNullState state; |
894 | g_return_val_if_fail(WEBKIT_DOM_IS_DOCUMENT(self), 0); |
895 | WebCore::Document* item = WebKit::core(self); |
896 | RefPtr<WebCore::DocumentFragment> gobjectResult = WTF::getPtr(item->createDocumentFragment()); |
897 | return WebKit::kit(gobjectResult.get()); |
898 | } |
899 | |
900 | WebKitDOMText* webkit_dom_document_create_text_node(WebKitDOMDocument* self, const gchar* data) |
901 | { |
902 | WebCore::JSMainThreadNullState state; |
903 | g_return_val_if_fail(WEBKIT_DOM_IS_DOCUMENT(self), 0); |
904 | g_return_val_if_fail(data, 0); |
905 | WebCore::Document* item = WebKit::core(self); |
906 | WTF::String convertedData = WTF::String::fromUTF8(data); |
907 | RefPtr<WebCore::Text> gobjectResult = WTF::getPtr(item->createTextNode(convertedData)); |
908 | return WebKit::kit(gobjectResult.get()); |
909 | } |
910 | |
911 | WebKitDOMComment* (WebKitDOMDocument* self, const gchar* data) |
912 | { |
913 | WebCore::JSMainThreadNullState state; |
914 | g_return_val_if_fail(WEBKIT_DOM_IS_DOCUMENT(self), 0); |
915 | g_return_val_if_fail(data, 0); |
916 | WebCore::Document* item = WebKit::core(self); |
917 | WTF::String convertedData = WTF::String::fromUTF8(data); |
918 | RefPtr<WebCore::Comment> gobjectResult = WTF::getPtr(item->createComment(convertedData)); |
919 | return WebKit::kit(gobjectResult.get()); |
920 | } |
921 | |
922 | WebKitDOMCDATASection* webkit_dom_document_create_cdata_section(WebKitDOMDocument* self, const gchar* data, GError** error) |
923 | { |
924 | WebCore::JSMainThreadNullState state; |
925 | g_return_val_if_fail(WEBKIT_DOM_IS_DOCUMENT(self), 0); |
926 | g_return_val_if_fail(data, 0); |
927 | g_return_val_if_fail(!error || !*error, 0); |
928 | WebCore::Document* item = WebKit::core(self); |
929 | WTF::String convertedData = WTF::String::fromUTF8(data); |
930 | auto result = item->createCDATASection(convertedData); |
931 | if (result.hasException()) { |
932 | auto description = WebCore::DOMException::description(result.releaseException().code()); |
933 | g_set_error_literal(error, g_quark_from_string("WEBKIT_DOM" ), description.legacyCode, description.name); |
934 | return nullptr; |
935 | } |
936 | return WebKit::kit(result.releaseReturnValue().ptr()); |
937 | } |
938 | |
939 | WebKitDOMProcessingInstruction* webkit_dom_document_create_processing_instruction(WebKitDOMDocument* self, const gchar* target, const gchar* data, GError** error) |
940 | { |
941 | WebCore::JSMainThreadNullState state; |
942 | g_return_val_if_fail(WEBKIT_DOM_IS_DOCUMENT(self), 0); |
943 | g_return_val_if_fail(target, 0); |
944 | g_return_val_if_fail(data, 0); |
945 | g_return_val_if_fail(!error || !*error, 0); |
946 | WebCore::Document* item = WebKit::core(self); |
947 | WTF::String convertedTarget = WTF::String::fromUTF8(target); |
948 | WTF::String convertedData = WTF::String::fromUTF8(data); |
949 | auto result = item->createProcessingInstruction(convertedTarget, convertedData); |
950 | if (result.hasException()) { |
951 | auto description = WebCore::DOMException::description(result.releaseException().code()); |
952 | g_set_error_literal(error, g_quark_from_string("WEBKIT_DOM" ), description.legacyCode, description.name); |
953 | return nullptr; |
954 | } |
955 | return WebKit::kit(result.releaseReturnValue().ptr()); |
956 | } |
957 | |
958 | WebKitDOMAttr* webkit_dom_document_create_attribute(WebKitDOMDocument* self, const gchar* name, GError** error) |
959 | { |
960 | WebCore::JSMainThreadNullState state; |
961 | g_return_val_if_fail(WEBKIT_DOM_IS_DOCUMENT(self), 0); |
962 | g_return_val_if_fail(name, 0); |
963 | g_return_val_if_fail(!error || !*error, 0); |
964 | WebCore::Document* item = WebKit::core(self); |
965 | WTF::String convertedName = WTF::String::fromUTF8(name); |
966 | auto result = item->createAttribute(convertedName); |
967 | if (result.hasException()) { |
968 | auto description = WebCore::DOMException::description(result.releaseException().code()); |
969 | g_set_error_literal(error, g_quark_from_string("WEBKIT_DOM" ), description.legacyCode, description.name); |
970 | return nullptr; |
971 | } |
972 | return WebKit::kit(result.releaseReturnValue().ptr()); |
973 | } |
974 | |
975 | WebKitDOMHTMLCollection* webkit_dom_document_get_elements_by_tag_name_as_html_collection(WebKitDOMDocument* self, const gchar* tagname) |
976 | { |
977 | WebCore::JSMainThreadNullState state; |
978 | g_return_val_if_fail(WEBKIT_DOM_IS_DOCUMENT(self), 0); |
979 | g_return_val_if_fail(tagname, 0); |
980 | WebCore::Document* item = WebKit::core(self); |
981 | WTF::String convertedTagname = WTF::String::fromUTF8(tagname); |
982 | RefPtr<WebCore::HTMLCollection> gobjectResult = WTF::getPtr(item->getElementsByTagName(convertedTagname)); |
983 | return WebKit::kit(gobjectResult.get()); |
984 | } |
985 | |
986 | WebKitDOMNode* webkit_dom_document_import_node(WebKitDOMDocument* self, WebKitDOMNode* importedNode, gboolean deep, GError** error) |
987 | { |
988 | WebCore::JSMainThreadNullState state; |
989 | g_return_val_if_fail(WEBKIT_DOM_IS_DOCUMENT(self), 0); |
990 | g_return_val_if_fail(WEBKIT_DOM_IS_NODE(importedNode), 0); |
991 | g_return_val_if_fail(!error || !*error, 0); |
992 | WebCore::Document* item = WebKit::core(self); |
993 | WebCore::Node* convertedImportedNode = WebKit::core(importedNode); |
994 | auto result = item->importNode(*convertedImportedNode, deep); |
995 | if (result.hasException()) { |
996 | auto description = WebCore::DOMException::description(result.releaseException().code()); |
997 | g_set_error_literal(error, g_quark_from_string("WEBKIT_DOM" ), description.legacyCode, description.name); |
998 | return nullptr; |
999 | } |
1000 | return WebKit::kit(result.releaseReturnValue().ptr()); |
1001 | } |
1002 | |
1003 | WebKitDOMElement* webkit_dom_document_create_element_ns(WebKitDOMDocument* self, const gchar* namespaceURI, const gchar* qualifiedName, GError** error) |
1004 | { |
1005 | WebCore::JSMainThreadNullState state; |
1006 | g_return_val_if_fail(WEBKIT_DOM_IS_DOCUMENT(self), 0); |
1007 | g_return_val_if_fail(qualifiedName, 0); |
1008 | g_return_val_if_fail(!error || !*error, 0); |
1009 | WebCore::Document* item = WebKit::core(self); |
1010 | WTF::String convertedNamespaceURI = WTF::String::fromUTF8(namespaceURI); |
1011 | WTF::String convertedQualifiedName = WTF::String::fromUTF8(qualifiedName); |
1012 | auto result = item->createElementNS(convertedNamespaceURI, convertedQualifiedName); |
1013 | if (result.hasException()) { |
1014 | auto description = WebCore::DOMException::description(result.releaseException().code()); |
1015 | g_set_error_literal(error, g_quark_from_string("WEBKIT_DOM" ), description.legacyCode, description.name); |
1016 | return nullptr; |
1017 | } |
1018 | return WebKit::kit(result.releaseReturnValue().ptr()); |
1019 | } |
1020 | |
1021 | WebKitDOMAttr* webkit_dom_document_create_attribute_ns(WebKitDOMDocument* self, const gchar* namespaceURI, const gchar* qualifiedName, GError** error) |
1022 | { |
1023 | WebCore::JSMainThreadNullState state; |
1024 | g_return_val_if_fail(WEBKIT_DOM_IS_DOCUMENT(self), 0); |
1025 | g_return_val_if_fail(qualifiedName, 0); |
1026 | g_return_val_if_fail(!error || !*error, 0); |
1027 | WebCore::Document* item = WebKit::core(self); |
1028 | WTF::String convertedNamespaceURI = WTF::String::fromUTF8(namespaceURI); |
1029 | WTF::String convertedQualifiedName = WTF::String::fromUTF8(qualifiedName); |
1030 | auto result = item->createAttributeNS(convertedNamespaceURI, convertedQualifiedName); |
1031 | if (result.hasException()) { |
1032 | auto description = WebCore::DOMException::description(result.releaseException().code()); |
1033 | g_set_error_literal(error, g_quark_from_string("WEBKIT_DOM" ), description.legacyCode, description.name); |
1034 | return nullptr; |
1035 | } |
1036 | return WebKit::kit(result.releaseReturnValue().ptr()); |
1037 | } |
1038 | |
1039 | WebKitDOMHTMLCollection* webkit_dom_document_get_elements_by_tag_name_ns_as_html_collection(WebKitDOMDocument* self, const gchar* namespaceURI, const gchar* localName) |
1040 | { |
1041 | WebCore::JSMainThreadNullState state; |
1042 | g_return_val_if_fail(WEBKIT_DOM_IS_DOCUMENT(self), 0); |
1043 | g_return_val_if_fail(namespaceURI, 0); |
1044 | g_return_val_if_fail(localName, 0); |
1045 | WebCore::Document* item = WebKit::core(self); |
1046 | WTF::String convertedNamespaceURI = WTF::String::fromUTF8(namespaceURI); |
1047 | WTF::String convertedLocalName = WTF::String::fromUTF8(localName); |
1048 | RefPtr<WebCore::HTMLCollection> gobjectResult = WTF::getPtr(item->getElementsByTagNameNS(convertedNamespaceURI, convertedLocalName)); |
1049 | return WebKit::kit(gobjectResult.get()); |
1050 | } |
1051 | |
1052 | WebKitDOMNode* webkit_dom_document_adopt_node(WebKitDOMDocument* self, WebKitDOMNode* source, GError** error) |
1053 | { |
1054 | WebCore::JSMainThreadNullState state; |
1055 | g_return_val_if_fail(WEBKIT_DOM_IS_DOCUMENT(self), 0); |
1056 | g_return_val_if_fail(WEBKIT_DOM_IS_NODE(source), 0); |
1057 | g_return_val_if_fail(!error || !*error, 0); |
1058 | WebCore::Document* item = WebKit::core(self); |
1059 | WebCore::Node* convertedSource = WebKit::core(source); |
1060 | auto result = item->adoptNode(*convertedSource); |
1061 | if (result.hasException()) { |
1062 | auto description = WebCore::DOMException::description(result.releaseException().code()); |
1063 | g_set_error_literal(error, g_quark_from_string("WEBKIT_DOM" ), description.legacyCode, description.name); |
1064 | return nullptr; |
1065 | } |
1066 | return WebKit::kit(result.releaseReturnValue().ptr()); |
1067 | } |
1068 | |
1069 | WebKitDOMEvent* webkit_dom_document_create_event(WebKitDOMDocument* self, const gchar* eventType, GError** error) |
1070 | { |
1071 | WebCore::JSMainThreadNullState state; |
1072 | g_return_val_if_fail(WEBKIT_DOM_IS_DOCUMENT(self), 0); |
1073 | g_return_val_if_fail(eventType, 0); |
1074 | g_return_val_if_fail(!error || !*error, 0); |
1075 | WebCore::Document* item = WebKit::core(self); |
1076 | WTF::String convertedEventType = WTF::String::fromUTF8(eventType); |
1077 | auto result = item->createEvent(convertedEventType); |
1078 | if (result.hasException()) { |
1079 | auto description = WebCore::DOMException::description(result.releaseException().code()); |
1080 | g_set_error_literal(error, g_quark_from_string("WEBKIT_DOM" ), description.legacyCode, description.name); |
1081 | return nullptr; |
1082 | } |
1083 | return WebKit::kit(result.releaseReturnValue().ptr()); |
1084 | } |
1085 | |
1086 | WebKitDOMRange* webkit_dom_document_create_range(WebKitDOMDocument* self) |
1087 | { |
1088 | WebCore::JSMainThreadNullState state; |
1089 | g_return_val_if_fail(WEBKIT_DOM_IS_DOCUMENT(self), 0); |
1090 | WebCore::Document* item = WebKit::core(self); |
1091 | RefPtr<WebCore::Range> gobjectResult = WTF::getPtr(item->createRange()); |
1092 | return WebKit::kit(gobjectResult.get()); |
1093 | } |
1094 | |
1095 | WebKitDOMNodeIterator* webkit_dom_document_create_node_iterator(WebKitDOMDocument* self, WebKitDOMNode* root, gulong whatToShow, WebKitDOMNodeFilter* filter, gboolean expandEntityReferences, GError** error) |
1096 | { |
1097 | WebCore::JSMainThreadNullState state; |
1098 | g_return_val_if_fail(WEBKIT_DOM_IS_DOCUMENT(self), 0); |
1099 | g_return_val_if_fail(WEBKIT_DOM_IS_NODE(root), 0); |
1100 | g_return_val_if_fail(!filter || WEBKIT_DOM_IS_NODE_FILTER(filter), 0); |
1101 | UNUSED_PARAM(error); |
1102 | WebCore::Document* item = WebKit::core(self); |
1103 | WebCore::Node* convertedRoot = WebKit::core(root); |
1104 | RefPtr<WebCore::NodeFilter> convertedFilter = WebKit::core(item, filter); |
1105 | RefPtr<WebCore::NodeIterator> gobjectResult = WTF::getPtr(item->createNodeIterator(*convertedRoot, whatToShow, WTF::getPtr(convertedFilter), expandEntityReferences)); |
1106 | return WebKit::kit(gobjectResult.get()); |
1107 | } |
1108 | |
1109 | WebKitDOMTreeWalker* webkit_dom_document_create_tree_walker(WebKitDOMDocument* self, WebKitDOMNode* root, gulong whatToShow, WebKitDOMNodeFilter* filter, gboolean expandEntityReferences, GError** error) |
1110 | { |
1111 | WebCore::JSMainThreadNullState state; |
1112 | g_return_val_if_fail(WEBKIT_DOM_IS_DOCUMENT(self), 0); |
1113 | g_return_val_if_fail(WEBKIT_DOM_IS_NODE(root), 0); |
1114 | g_return_val_if_fail(!filter || WEBKIT_DOM_IS_NODE_FILTER(filter), 0); |
1115 | UNUSED_PARAM(error); |
1116 | WebCore::Document* item = WebKit::core(self); |
1117 | WebCore::Node* convertedRoot = WebKit::core(root); |
1118 | RefPtr<WebCore::NodeFilter> convertedFilter = WebKit::core(item, filter); |
1119 | RefPtr<WebCore::TreeWalker> gobjectResult = WTF::getPtr(item->createTreeWalker(*convertedRoot, whatToShow, WTF::getPtr(convertedFilter), expandEntityReferences)); |
1120 | return WebKit::kit(gobjectResult.get()); |
1121 | } |
1122 | |
1123 | WebKitDOMCSSStyleDeclaration* webkit_dom_document_get_override_style(WebKitDOMDocument*, WebKitDOMElement*, const gchar*) |
1124 | { |
1125 | return nullptr; |
1126 | } |
1127 | |
1128 | WebKitDOMXPathExpression* webkit_dom_document_create_expression(WebKitDOMDocument* self, const gchar* expression, WebKitDOMXPathNSResolver* resolver, GError** error) |
1129 | { |
1130 | WebCore::JSMainThreadNullState state; |
1131 | g_return_val_if_fail(WEBKIT_DOM_IS_DOCUMENT(self), 0); |
1132 | g_return_val_if_fail(expression, 0); |
1133 | g_return_val_if_fail(WEBKIT_DOM_IS_XPATH_NS_RESOLVER(resolver), 0); |
1134 | g_return_val_if_fail(!error || !*error, 0); |
1135 | WebCore::Document* item = WebKit::core(self); |
1136 | WTF::String convertedExpression = WTF::String::fromUTF8(expression); |
1137 | RefPtr<WebCore::XPathNSResolver> convertedResolver = WebKit::core(resolver); |
1138 | auto result = item->createExpression(convertedExpression, WTFMove(convertedResolver)); |
1139 | if (result.hasException()) { |
1140 | auto description = WebCore::DOMException::description(result.releaseException().code()); |
1141 | g_set_error_literal(error, g_quark_from_string("WEBKIT_DOM" ), description.legacyCode, description.name); |
1142 | return nullptr; |
1143 | } |
1144 | return WebKit::kit(result.releaseReturnValue().ptr()); |
1145 | } |
1146 | |
1147 | WebKitDOMXPathNSResolver* webkit_dom_document_create_ns_resolver(WebKitDOMDocument* self, WebKitDOMNode* nodeResolver) |
1148 | { |
1149 | WebCore::JSMainThreadNullState state; |
1150 | g_return_val_if_fail(WEBKIT_DOM_IS_DOCUMENT(self), 0); |
1151 | g_return_val_if_fail(WEBKIT_DOM_IS_NODE(nodeResolver), 0); |
1152 | WebCore::Document* item = WebKit::core(self); |
1153 | WebCore::Node* convertedNodeResolver = WebKit::core(nodeResolver); |
1154 | RefPtr<WebCore::XPathNSResolver> gobjectResult = WTF::getPtr(item->createNSResolver(convertedNodeResolver)); |
1155 | return WebKit::kit(gobjectResult.get()); |
1156 | } |
1157 | |
1158 | WebKitDOMXPathResult* webkit_dom_document_evaluate(WebKitDOMDocument* self, const gchar* expression, WebKitDOMNode* contextNode, WebKitDOMXPathNSResolver* resolver, gushort type, WebKitDOMXPathResult* inResult, GError** error) |
1159 | { |
1160 | WebCore::JSMainThreadNullState state; |
1161 | g_return_val_if_fail(WEBKIT_DOM_IS_DOCUMENT(self), 0); |
1162 | g_return_val_if_fail(expression, 0); |
1163 | g_return_val_if_fail(WEBKIT_DOM_IS_NODE(contextNode), 0); |
1164 | g_return_val_if_fail(!resolver || WEBKIT_DOM_IS_XPATH_NS_RESOLVER(resolver), 0); |
1165 | g_return_val_if_fail(!inResult || WEBKIT_DOM_IS_XPATH_RESULT(inResult), 0); |
1166 | g_return_val_if_fail(!error || !*error, 0); |
1167 | WebCore::Document* item = WebKit::core(self); |
1168 | WTF::String convertedExpression = WTF::String::fromUTF8(expression); |
1169 | WebCore::Node* convertedContextNode = WebKit::core(contextNode); |
1170 | RefPtr<WebCore::XPathNSResolver> convertedResolver = WebKit::core(resolver); |
1171 | WebCore::XPathResult* convertedInResult = WebKit::core(inResult); |
1172 | auto result = item->evaluate(convertedExpression, convertedContextNode, WTFMove(convertedResolver), type, convertedInResult); |
1173 | if (result.hasException()) { |
1174 | auto description = WebCore::DOMException::description(result.releaseException().code()); |
1175 | g_set_error_literal(error, g_quark_from_string("WEBKIT_DOM" ), description.legacyCode, description.name); |
1176 | return nullptr; |
1177 | } |
1178 | return WebKit::kit(result.releaseReturnValue().ptr()); |
1179 | } |
1180 | |
1181 | gboolean webkit_dom_document_exec_command(WebKitDOMDocument* self, const gchar* command, gboolean userInterface, const gchar* value) |
1182 | { |
1183 | WebCore::JSMainThreadNullState state; |
1184 | g_return_val_if_fail(WEBKIT_DOM_IS_DOCUMENT(self), FALSE); |
1185 | g_return_val_if_fail(command, FALSE); |
1186 | g_return_val_if_fail(value, FALSE); |
1187 | WebCore::Document* item = WebKit::core(self); |
1188 | WTF::String convertedCommand = WTF::String::fromUTF8(command); |
1189 | WTF::String convertedValue = WTF::String::fromUTF8(value); |
1190 | gboolean result = item->execCommand(convertedCommand, userInterface, convertedValue); |
1191 | return result; |
1192 | } |
1193 | |
1194 | gboolean webkit_dom_document_query_command_enabled(WebKitDOMDocument* self, const gchar* command) |
1195 | { |
1196 | WebCore::JSMainThreadNullState state; |
1197 | g_return_val_if_fail(WEBKIT_DOM_IS_DOCUMENT(self), FALSE); |
1198 | g_return_val_if_fail(command, FALSE); |
1199 | WebCore::Document* item = WebKit::core(self); |
1200 | WTF::String convertedCommand = WTF::String::fromUTF8(command); |
1201 | gboolean result = item->queryCommandEnabled(convertedCommand); |
1202 | return result; |
1203 | } |
1204 | |
1205 | gboolean webkit_dom_document_query_command_indeterm(WebKitDOMDocument* self, const gchar* command) |
1206 | { |
1207 | WebCore::JSMainThreadNullState state; |
1208 | g_return_val_if_fail(WEBKIT_DOM_IS_DOCUMENT(self), FALSE); |
1209 | g_return_val_if_fail(command, FALSE); |
1210 | WebCore::Document* item = WebKit::core(self); |
1211 | WTF::String convertedCommand = WTF::String::fromUTF8(command); |
1212 | gboolean result = item->queryCommandIndeterm(convertedCommand); |
1213 | return result; |
1214 | } |
1215 | |
1216 | gboolean webkit_dom_document_query_command_state(WebKitDOMDocument* self, const gchar* command) |
1217 | { |
1218 | WebCore::JSMainThreadNullState state; |
1219 | g_return_val_if_fail(WEBKIT_DOM_IS_DOCUMENT(self), FALSE); |
1220 | g_return_val_if_fail(command, FALSE); |
1221 | WebCore::Document* item = WebKit::core(self); |
1222 | WTF::String convertedCommand = WTF::String::fromUTF8(command); |
1223 | gboolean result = item->queryCommandState(convertedCommand); |
1224 | return result; |
1225 | } |
1226 | |
1227 | gboolean webkit_dom_document_query_command_supported(WebKitDOMDocument* self, const gchar* command) |
1228 | { |
1229 | WebCore::JSMainThreadNullState state; |
1230 | g_return_val_if_fail(WEBKIT_DOM_IS_DOCUMENT(self), FALSE); |
1231 | g_return_val_if_fail(command, FALSE); |
1232 | WebCore::Document* item = WebKit::core(self); |
1233 | WTF::String convertedCommand = WTF::String::fromUTF8(command); |
1234 | gboolean result = item->queryCommandSupported(convertedCommand); |
1235 | return result; |
1236 | } |
1237 | |
1238 | gchar* webkit_dom_document_query_command_value(WebKitDOMDocument* self, const gchar* command) |
1239 | { |
1240 | WebCore::JSMainThreadNullState state; |
1241 | g_return_val_if_fail(WEBKIT_DOM_IS_DOCUMENT(self), 0); |
1242 | g_return_val_if_fail(command, 0); |
1243 | WebCore::Document* item = WebKit::core(self); |
1244 | WTF::String convertedCommand = WTF::String::fromUTF8(command); |
1245 | gchar* result = convertToUTF8String(item->queryCommandValue(convertedCommand)); |
1246 | return result; |
1247 | } |
1248 | |
1249 | WebKitDOMNodeList* webkit_dom_document_get_elements_by_name(WebKitDOMDocument* self, const gchar* elementName) |
1250 | { |
1251 | WebCore::JSMainThreadNullState state; |
1252 | g_return_val_if_fail(WEBKIT_DOM_IS_DOCUMENT(self), 0); |
1253 | g_return_val_if_fail(elementName, 0); |
1254 | WebCore::Document* item = WebKit::core(self); |
1255 | WTF::String convertedElementName = WTF::String::fromUTF8(elementName); |
1256 | RefPtr<WebCore::NodeList> gobjectResult = WTF::getPtr(item->getElementsByName(convertedElementName)); |
1257 | return WebKit::kit(gobjectResult.get()); |
1258 | } |
1259 | |
1260 | WebKitDOMElement* webkit_dom_document_element_from_point(WebKitDOMDocument* self, glong x, glong y) |
1261 | { |
1262 | WebCore::JSMainThreadNullState state; |
1263 | g_return_val_if_fail(WEBKIT_DOM_IS_DOCUMENT(self), 0); |
1264 | WebCore::Document* item = WebKit::core(self); |
1265 | RefPtr<WebCore::Element> gobjectResult = WTF::getPtr(item->elementFromPoint(x, y)); |
1266 | return WebKit::kit(gobjectResult.get()); |
1267 | } |
1268 | |
1269 | WebKitDOMRange* webkit_dom_document_caret_range_from_point(WebKitDOMDocument* self, glong x, glong y) |
1270 | { |
1271 | WebCore::JSMainThreadNullState state; |
1272 | g_return_val_if_fail(WEBKIT_DOM_IS_DOCUMENT(self), 0); |
1273 | WebCore::Document* item = WebKit::core(self); |
1274 | RefPtr<WebCore::Range> gobjectResult = WTF::getPtr(item->caretRangeFromPoint(x, y)); |
1275 | return WebKit::kit(gobjectResult.get()); |
1276 | } |
1277 | |
1278 | WebKitDOMCSSStyleDeclaration* webkit_dom_document_create_css_style_declaration(WebKitDOMDocument* self) |
1279 | { |
1280 | WebCore::JSMainThreadNullState state; |
1281 | g_return_val_if_fail(WEBKIT_DOM_IS_DOCUMENT(self), 0); |
1282 | WebCore::Document* item = WebKit::core(self); |
1283 | RefPtr<WebCore::CSSStyleDeclaration> gobjectResult = WTF::getPtr(item->createCSSStyleDeclaration()); |
1284 | return WebKit::kit(gobjectResult.get()); |
1285 | } |
1286 | |
1287 | WebKitDOMHTMLCollection* webkit_dom_document_get_elements_by_class_name_as_html_collection(WebKitDOMDocument* self, const gchar* classNames) |
1288 | { |
1289 | WebCore::JSMainThreadNullState state; |
1290 | g_return_val_if_fail(WEBKIT_DOM_IS_DOCUMENT(self), 0); |
1291 | g_return_val_if_fail(classNames, 0); |
1292 | WebCore::Document* item = WebKit::core(self); |
1293 | WTF::String convertedClassNames = WTF::String::fromUTF8(classNames); |
1294 | RefPtr<WebCore::HTMLCollection> gobjectResult = WTF::getPtr(item->getElementsByClassName(convertedClassNames)); |
1295 | return WebKit::kit(gobjectResult.get()); |
1296 | } |
1297 | |
1298 | gboolean webkit_dom_document_has_focus(WebKitDOMDocument* self) |
1299 | { |
1300 | WebCore::JSMainThreadNullState state; |
1301 | g_return_val_if_fail(WEBKIT_DOM_IS_DOCUMENT(self), FALSE); |
1302 | WebCore::Document* item = WebKit::core(self); |
1303 | gboolean result = item->hasFocus(); |
1304 | return result; |
1305 | } |
1306 | |
1307 | void webkit_dom_document_webkit_cancel_fullscreen(WebKitDOMDocument* self) |
1308 | { |
1309 | WebCore::JSMainThreadNullState state; |
1310 | g_return_if_fail(WEBKIT_DOM_IS_DOCUMENT(self)); |
1311 | WebCore::Document* item = WebKit::core(self); |
1312 | item->fullscreenManager().cancelFullscreen(); |
1313 | } |
1314 | |
1315 | void webkit_dom_document_webkit_exit_fullscreen(WebKitDOMDocument* self) |
1316 | { |
1317 | WebCore::JSMainThreadNullState state; |
1318 | g_return_if_fail(WEBKIT_DOM_IS_DOCUMENT(self)); |
1319 | WebCore::Document* item = WebKit::core(self); |
1320 | item->fullscreenManager().exitFullscreen(); |
1321 | } |
1322 | |
1323 | void webkit_dom_document_exit_pointer_lock(WebKitDOMDocument* self) |
1324 | { |
1325 | #if ENABLE(POINTER_LOCK) |
1326 | WebCore::JSMainThreadNullState state; |
1327 | g_return_if_fail(WEBKIT_DOM_IS_DOCUMENT(self)); |
1328 | WebCore::Document* item = WebKit::core(self); |
1329 | item->exitPointerLock(); |
1330 | #else |
1331 | UNUSED_PARAM(self); |
1332 | WEBKIT_WARN_FEATURE_NOT_PRESENT("Pointer Lock" ) |
1333 | #endif /* ENABLE(POINTER_LOCK) */ |
1334 | } |
1335 | |
1336 | WebKitDOMElement* webkit_dom_document_get_element_by_id(WebKitDOMDocument* self, const gchar* elementId) |
1337 | { |
1338 | WebCore::JSMainThreadNullState state; |
1339 | g_return_val_if_fail(WEBKIT_DOM_IS_DOCUMENT(self), 0); |
1340 | g_return_val_if_fail(elementId, 0); |
1341 | WebCore::Document* item = WebKit::core(self); |
1342 | WTF::String convertedElementId = WTF::String::fromUTF8(elementId); |
1343 | RefPtr<WebCore::Element> gobjectResult = WTF::getPtr(item->getElementById(convertedElementId)); |
1344 | return WebKit::kit(gobjectResult.get()); |
1345 | } |
1346 | |
1347 | WebKitDOMElement* webkit_dom_document_query_selector(WebKitDOMDocument* self, const gchar* selectors, GError** error) |
1348 | { |
1349 | WebCore::JSMainThreadNullState state; |
1350 | g_return_val_if_fail(WEBKIT_DOM_IS_DOCUMENT(self), 0); |
1351 | g_return_val_if_fail(selectors, 0); |
1352 | g_return_val_if_fail(!error || !*error, 0); |
1353 | WebCore::Document* item = WebKit::core(self); |
1354 | WTF::String convertedSelectors = WTF::String::fromUTF8(selectors); |
1355 | auto result = item->querySelector(convertedSelectors); |
1356 | if (result.hasException()) { |
1357 | auto description = WebCore::DOMException::description(result.releaseException().code()); |
1358 | g_set_error_literal(error, g_quark_from_string("WEBKIT_DOM" ), description.legacyCode, description.name); |
1359 | return nullptr; |
1360 | } |
1361 | return WebKit::kit(result.releaseReturnValue()); |
1362 | } |
1363 | |
1364 | WebKitDOMNodeList* webkit_dom_document_query_selector_all(WebKitDOMDocument* self, const gchar* selectors, GError** error) |
1365 | { |
1366 | WebCore::JSMainThreadNullState state; |
1367 | g_return_val_if_fail(WEBKIT_DOM_IS_DOCUMENT(self), 0); |
1368 | g_return_val_if_fail(selectors, 0); |
1369 | g_return_val_if_fail(!error || !*error, 0); |
1370 | WebCore::Document* item = WebKit::core(self); |
1371 | WTF::String convertedSelectors = WTF::String::fromUTF8(selectors); |
1372 | auto result = item->querySelectorAll(convertedSelectors); |
1373 | if (result.hasException()) { |
1374 | auto description = WebCore::DOMException::description(result.releaseException().code()); |
1375 | g_set_error_literal(error, g_quark_from_string("WEBKIT_DOM" ), description.legacyCode, description.name); |
1376 | return nullptr; |
1377 | } |
1378 | return WebKit::kit(result.releaseReturnValue().ptr()); |
1379 | } |
1380 | |
1381 | WebKitDOMDocumentType* webkit_dom_document_get_doctype(WebKitDOMDocument* self) |
1382 | { |
1383 | WebCore::JSMainThreadNullState state; |
1384 | g_return_val_if_fail(WEBKIT_DOM_IS_DOCUMENT(self), 0); |
1385 | WebCore::Document* item = WebKit::core(self); |
1386 | RefPtr<WebCore::DocumentType> gobjectResult = WTF::getPtr(item->doctype()); |
1387 | return WebKit::kit(gobjectResult.get()); |
1388 | } |
1389 | |
1390 | WebKitDOMDOMImplementation* webkit_dom_document_get_implementation(WebKitDOMDocument* self) |
1391 | { |
1392 | WebCore::JSMainThreadNullState state; |
1393 | g_return_val_if_fail(WEBKIT_DOM_IS_DOCUMENT(self), 0); |
1394 | WebCore::Document* item = WebKit::core(self); |
1395 | RefPtr<WebCore::DOMImplementation> gobjectResult = WTF::getPtr(item->implementation()); |
1396 | return WebKit::kit(gobjectResult.get()); |
1397 | } |
1398 | |
1399 | WebKitDOMElement* webkit_dom_document_get_document_element(WebKitDOMDocument* self) |
1400 | { |
1401 | WebCore::JSMainThreadNullState state; |
1402 | g_return_val_if_fail(WEBKIT_DOM_IS_DOCUMENT(self), 0); |
1403 | WebCore::Document* item = WebKit::core(self); |
1404 | RefPtr<WebCore::Element> gobjectResult = WTF::getPtr(item->documentElement()); |
1405 | return WebKit::kit(gobjectResult.get()); |
1406 | } |
1407 | |
1408 | gchar* webkit_dom_document_get_input_encoding(WebKitDOMDocument* self) |
1409 | { |
1410 | WebCore::JSMainThreadNullState state; |
1411 | g_return_val_if_fail(WEBKIT_DOM_IS_DOCUMENT(self), 0); |
1412 | WebCore::Document* item = WebKit::core(self); |
1413 | gchar* result = convertToUTF8String(item->characterSetWithUTF8Fallback()); |
1414 | return result; |
1415 | } |
1416 | |
1417 | gchar* webkit_dom_document_get_xml_encoding(WebKitDOMDocument* self) |
1418 | { |
1419 | WebCore::JSMainThreadNullState state; |
1420 | g_return_val_if_fail(WEBKIT_DOM_IS_DOCUMENT(self), 0); |
1421 | WebCore::Document* item = WebKit::core(self); |
1422 | gchar* result = convertToUTF8String(item->xmlEncoding()); |
1423 | return result; |
1424 | } |
1425 | |
1426 | gchar* webkit_dom_document_get_xml_version(WebKitDOMDocument* self) |
1427 | { |
1428 | WebCore::JSMainThreadNullState state; |
1429 | g_return_val_if_fail(WEBKIT_DOM_IS_DOCUMENT(self), 0); |
1430 | WebCore::Document* item = WebKit::core(self); |
1431 | gchar* result = convertToUTF8String(item->xmlVersion()); |
1432 | return result; |
1433 | } |
1434 | |
1435 | void webkit_dom_document_set_xml_version(WebKitDOMDocument* self, const gchar* value, GError** error) |
1436 | { |
1437 | WebCore::JSMainThreadNullState state; |
1438 | g_return_if_fail(WEBKIT_DOM_IS_DOCUMENT(self)); |
1439 | g_return_if_fail(value); |
1440 | g_return_if_fail(!error || !*error); |
1441 | WebCore::Document* item = WebKit::core(self); |
1442 | WTF::String convertedValue = WTF::String::fromUTF8(value); |
1443 | auto result = item->setXMLVersion(convertedValue); |
1444 | if (result.hasException()) { |
1445 | auto description = WebCore::DOMException::description(result.releaseException().code()); |
1446 | g_set_error_literal(error, g_quark_from_string("WEBKIT_DOM" ), description.legacyCode, description.name); |
1447 | } |
1448 | } |
1449 | |
1450 | gboolean webkit_dom_document_get_xml_standalone(WebKitDOMDocument* self) |
1451 | { |
1452 | WebCore::JSMainThreadNullState state; |
1453 | g_return_val_if_fail(WEBKIT_DOM_IS_DOCUMENT(self), FALSE); |
1454 | WebCore::Document* item = WebKit::core(self); |
1455 | gboolean result = item->xmlStandalone(); |
1456 | return result; |
1457 | } |
1458 | |
1459 | void webkit_dom_document_set_xml_standalone(WebKitDOMDocument* self, gboolean value, GError** error) |
1460 | { |
1461 | WebCore::JSMainThreadNullState state; |
1462 | g_return_if_fail(WEBKIT_DOM_IS_DOCUMENT(self)); |
1463 | g_return_if_fail(!error || !*error); |
1464 | WebKit::core(self)->setXMLStandalone(value); |
1465 | } |
1466 | |
1467 | gchar* webkit_dom_document_get_document_uri(WebKitDOMDocument* self) |
1468 | { |
1469 | WebCore::JSMainThreadNullState state; |
1470 | g_return_val_if_fail(WEBKIT_DOM_IS_DOCUMENT(self), 0); |
1471 | WebCore::Document* item = WebKit::core(self); |
1472 | gchar* result = convertToUTF8String(item->documentURI()); |
1473 | return result; |
1474 | } |
1475 | |
1476 | void webkit_dom_document_set_document_uri(WebKitDOMDocument* self, const gchar* value) |
1477 | { |
1478 | WebCore::JSMainThreadNullState state; |
1479 | g_return_if_fail(WEBKIT_DOM_IS_DOCUMENT(self)); |
1480 | g_return_if_fail(value); |
1481 | WebCore::Document* item = WebKit::core(self); |
1482 | WTF::String convertedValue = WTF::String::fromUTF8(value); |
1483 | item->setDocumentURI(convertedValue); |
1484 | } |
1485 | |
1486 | WebKitDOMDOMWindow* webkit_dom_document_get_default_view(WebKitDOMDocument* self) |
1487 | { |
1488 | WebCore::JSMainThreadNullState state; |
1489 | g_return_val_if_fail(WEBKIT_DOM_IS_DOCUMENT(self), 0); |
1490 | WebCore::Document* item = WebKit::core(self); |
1491 | return WebKit::kit(item->windowProxy()); |
1492 | } |
1493 | |
1494 | WebKitDOMStyleSheetList* webkit_dom_document_get_style_sheets(WebKitDOMDocument* self) |
1495 | { |
1496 | WebCore::JSMainThreadNullState state; |
1497 | g_return_val_if_fail(WEBKIT_DOM_IS_DOCUMENT(self), 0); |
1498 | WebCore::Document* item = WebKit::core(self); |
1499 | RefPtr<WebCore::StyleSheetList> gobjectResult = WTF::getPtr(item->styleSheets()); |
1500 | return WebKit::kit(gobjectResult.get()); |
1501 | } |
1502 | |
1503 | gchar* webkit_dom_document_get_content_type(WebKitDOMDocument* self) |
1504 | { |
1505 | WebCore::JSMainThreadNullState state; |
1506 | g_return_val_if_fail(WEBKIT_DOM_IS_DOCUMENT(self), 0); |
1507 | WebCore::Document* item = WebKit::core(self); |
1508 | gchar* result = convertToUTF8String(item->contentType()); |
1509 | return result; |
1510 | } |
1511 | |
1512 | gchar* webkit_dom_document_get_title(WebKitDOMDocument* self) |
1513 | { |
1514 | WebCore::JSMainThreadNullState state; |
1515 | g_return_val_if_fail(WEBKIT_DOM_IS_DOCUMENT(self), 0); |
1516 | WebCore::Document* item = WebKit::core(self); |
1517 | gchar* result = convertToUTF8String(item->title()); |
1518 | return result; |
1519 | } |
1520 | |
1521 | void webkit_dom_document_set_title(WebKitDOMDocument* self, const gchar* value) |
1522 | { |
1523 | WebCore::JSMainThreadNullState state; |
1524 | g_return_if_fail(WEBKIT_DOM_IS_DOCUMENT(self)); |
1525 | g_return_if_fail(value); |
1526 | WebCore::Document* item = WebKit::core(self); |
1527 | WTF::String convertedValue = WTF::String::fromUTF8(value); |
1528 | item->setTitle(convertedValue); |
1529 | } |
1530 | |
1531 | gchar* webkit_dom_document_get_dir(WebKitDOMDocument* self) |
1532 | { |
1533 | WebCore::JSMainThreadNullState state; |
1534 | g_return_val_if_fail(WEBKIT_DOM_IS_DOCUMENT(self), 0); |
1535 | WebCore::Document* item = WebKit::core(self); |
1536 | gchar* result = convertToUTF8String(item->dir()); |
1537 | return result; |
1538 | } |
1539 | |
1540 | void webkit_dom_document_set_dir(WebKitDOMDocument* self, const gchar* value) |
1541 | { |
1542 | WebCore::JSMainThreadNullState state; |
1543 | g_return_if_fail(WEBKIT_DOM_IS_DOCUMENT(self)); |
1544 | g_return_if_fail(value); |
1545 | WebCore::Document* item = WebKit::core(self); |
1546 | WTF::String convertedValue = WTF::String::fromUTF8(value); |
1547 | item->setDir(convertedValue); |
1548 | } |
1549 | |
1550 | gchar* webkit_dom_document_get_design_mode(WebKitDOMDocument* self) |
1551 | { |
1552 | WebCore::JSMainThreadNullState state; |
1553 | g_return_val_if_fail(WEBKIT_DOM_IS_DOCUMENT(self), 0); |
1554 | WebCore::Document* item = WebKit::core(self); |
1555 | gchar* result = convertToUTF8String(item->designMode()); |
1556 | return result; |
1557 | } |
1558 | |
1559 | void webkit_dom_document_set_design_mode(WebKitDOMDocument* self, const gchar* value) |
1560 | { |
1561 | WebCore::JSMainThreadNullState state; |
1562 | g_return_if_fail(WEBKIT_DOM_IS_DOCUMENT(self)); |
1563 | g_return_if_fail(value); |
1564 | WebCore::Document* item = WebKit::core(self); |
1565 | WTF::String convertedValue = WTF::String::fromUTF8(value); |
1566 | item->setDesignMode(convertedValue); |
1567 | } |
1568 | |
1569 | gchar* webkit_dom_document_get_referrer(WebKitDOMDocument* self) |
1570 | { |
1571 | WebCore::JSMainThreadNullState state; |
1572 | g_return_val_if_fail(WEBKIT_DOM_IS_DOCUMENT(self), 0); |
1573 | WebCore::Document* item = WebKit::core(self); |
1574 | gchar* result = convertToUTF8String(item->referrer()); |
1575 | return result; |
1576 | } |
1577 | |
1578 | gchar* webkit_dom_document_get_domain(WebKitDOMDocument* self) |
1579 | { |
1580 | WebCore::JSMainThreadNullState state; |
1581 | g_return_val_if_fail(WEBKIT_DOM_IS_DOCUMENT(self), 0); |
1582 | WebCore::Document* item = WebKit::core(self); |
1583 | gchar* result = convertToUTF8String(item->domain()); |
1584 | return result; |
1585 | } |
1586 | |
1587 | gchar* webkit_dom_document_get_url(WebKitDOMDocument* self) |
1588 | { |
1589 | WebCore::JSMainThreadNullState state; |
1590 | g_return_val_if_fail(WEBKIT_DOM_IS_DOCUMENT(self), 0); |
1591 | WebCore::Document* item = WebKit::core(self); |
1592 | gchar* result = convertToUTF8String(item->urlForBindings()); |
1593 | return result; |
1594 | } |
1595 | |
1596 | gchar* webkit_dom_document_get_cookie(WebKitDOMDocument* self, GError** error) |
1597 | { |
1598 | WebCore::JSMainThreadNullState state; |
1599 | g_return_val_if_fail(WEBKIT_DOM_IS_DOCUMENT(self), 0); |
1600 | g_return_val_if_fail(!error || !*error, 0); |
1601 | WebCore::Document* item = WebKit::core(self); |
1602 | auto result = item->cookie(); |
1603 | if (result.hasException()) |
1604 | return nullptr; |
1605 | return convertToUTF8String(result.releaseReturnValue()); |
1606 | } |
1607 | |
1608 | void webkit_dom_document_set_cookie(WebKitDOMDocument* self, const gchar* value, GError** error) |
1609 | { |
1610 | WebCore::JSMainThreadNullState state; |
1611 | g_return_if_fail(WEBKIT_DOM_IS_DOCUMENT(self)); |
1612 | g_return_if_fail(value); |
1613 | g_return_if_fail(!error || !*error); |
1614 | WebCore::Document* item = WebKit::core(self); |
1615 | WTF::String convertedValue = WTF::String::fromUTF8(value); |
1616 | auto result = item->setCookie(convertedValue); |
1617 | if (result.hasException()) { |
1618 | auto description = WebCore::DOMException::description(result.releaseException().code()); |
1619 | g_set_error_literal(error, g_quark_from_string("WEBKIT_DOM" ), description.legacyCode, description.name); |
1620 | } |
1621 | } |
1622 | |
1623 | WebKitDOMHTMLElement* webkit_dom_document_get_body(WebKitDOMDocument* self) |
1624 | { |
1625 | WebCore::JSMainThreadNullState state; |
1626 | g_return_val_if_fail(WEBKIT_DOM_IS_DOCUMENT(self), 0); |
1627 | WebCore::Document* item = WebKit::core(self); |
1628 | RefPtr<WebCore::HTMLElement> gobjectResult = WTF::getPtr(item->bodyOrFrameset()); |
1629 | return WebKit::kit(gobjectResult.get()); |
1630 | } |
1631 | |
1632 | void webkit_dom_document_set_body(WebKitDOMDocument* self, WebKitDOMHTMLElement* value, GError** error) |
1633 | { |
1634 | WebCore::JSMainThreadNullState state; |
1635 | g_return_if_fail(WEBKIT_DOM_IS_DOCUMENT(self)); |
1636 | g_return_if_fail(WEBKIT_DOM_IS_HTML_ELEMENT(value)); |
1637 | g_return_if_fail(!error || !*error); |
1638 | WebCore::Document* item = WebKit::core(self); |
1639 | WebCore::HTMLElement* convertedValue = WebKit::core(value); |
1640 | auto result = item->setBodyOrFrameset(convertedValue); |
1641 | if (result.hasException()) { |
1642 | auto description = WebCore::DOMException::description(result.releaseException().code()); |
1643 | g_set_error_literal(error, g_quark_from_string("WEBKIT_DOM" ), description.legacyCode, description.name); |
1644 | } |
1645 | } |
1646 | |
1647 | WebKitDOMHTMLHeadElement* webkit_dom_document_get_head(WebKitDOMDocument* self) |
1648 | { |
1649 | WebCore::JSMainThreadNullState state; |
1650 | g_return_val_if_fail(WEBKIT_DOM_IS_DOCUMENT(self), 0); |
1651 | WebCore::Document* item = WebKit::core(self); |
1652 | RefPtr<WebCore::HTMLHeadElement> gobjectResult = WTF::getPtr(item->head()); |
1653 | return WebKit::kit(gobjectResult.get()); |
1654 | } |
1655 | |
1656 | WebKitDOMHTMLCollection* webkit_dom_document_get_images(WebKitDOMDocument* self) |
1657 | { |
1658 | WebCore::JSMainThreadNullState state; |
1659 | g_return_val_if_fail(WEBKIT_DOM_IS_DOCUMENT(self), 0); |
1660 | WebCore::Document* item = WebKit::core(self); |
1661 | RefPtr<WebCore::HTMLCollection> gobjectResult = WTF::getPtr(item->images()); |
1662 | return WebKit::kit(gobjectResult.get()); |
1663 | } |
1664 | |
1665 | WebKitDOMHTMLCollection* webkit_dom_document_get_applets(WebKitDOMDocument* self) |
1666 | { |
1667 | WebCore::JSMainThreadNullState state; |
1668 | g_return_val_if_fail(WEBKIT_DOM_IS_DOCUMENT(self), 0); |
1669 | WebCore::Document* item = WebKit::core(self); |
1670 | RefPtr<WebCore::HTMLCollection> gobjectResult = WTF::getPtr(item->applets()); |
1671 | return WebKit::kit(gobjectResult.get()); |
1672 | } |
1673 | |
1674 | WebKitDOMHTMLCollection* webkit_dom_document_get_links(WebKitDOMDocument* self) |
1675 | { |
1676 | WebCore::JSMainThreadNullState state; |
1677 | g_return_val_if_fail(WEBKIT_DOM_IS_DOCUMENT(self), 0); |
1678 | WebCore::Document* item = WebKit::core(self); |
1679 | RefPtr<WebCore::HTMLCollection> gobjectResult = WTF::getPtr(item->links()); |
1680 | return WebKit::kit(gobjectResult.get()); |
1681 | } |
1682 | |
1683 | WebKitDOMHTMLCollection* webkit_dom_document_get_forms(WebKitDOMDocument* self) |
1684 | { |
1685 | WebCore::JSMainThreadNullState state; |
1686 | g_return_val_if_fail(WEBKIT_DOM_IS_DOCUMENT(self), 0); |
1687 | WebCore::Document* item = WebKit::core(self); |
1688 | RefPtr<WebCore::HTMLCollection> gobjectResult = WTF::getPtr(item->forms()); |
1689 | return WebKit::kit(gobjectResult.get()); |
1690 | } |
1691 | |
1692 | WebKitDOMHTMLCollection* webkit_dom_document_get_anchors(WebKitDOMDocument* self) |
1693 | { |
1694 | WebCore::JSMainThreadNullState state; |
1695 | g_return_val_if_fail(WEBKIT_DOM_IS_DOCUMENT(self), 0); |
1696 | WebCore::Document* item = WebKit::core(self); |
1697 | RefPtr<WebCore::HTMLCollection> gobjectResult = WTF::getPtr(item->anchors()); |
1698 | return WebKit::kit(gobjectResult.get()); |
1699 | } |
1700 | |
1701 | WebKitDOMHTMLCollection* webkit_dom_document_get_embeds(WebKitDOMDocument* self) |
1702 | { |
1703 | WebCore::JSMainThreadNullState state; |
1704 | g_return_val_if_fail(WEBKIT_DOM_IS_DOCUMENT(self), 0); |
1705 | WebCore::Document* item = WebKit::core(self); |
1706 | RefPtr<WebCore::HTMLCollection> gobjectResult = WTF::getPtr(item->embeds()); |
1707 | return WebKit::kit(gobjectResult.get()); |
1708 | } |
1709 | |
1710 | WebKitDOMHTMLCollection* webkit_dom_document_get_plugins(WebKitDOMDocument* self) |
1711 | { |
1712 | WebCore::JSMainThreadNullState state; |
1713 | g_return_val_if_fail(WEBKIT_DOM_IS_DOCUMENT(self), 0); |
1714 | WebCore::Document* item = WebKit::core(self); |
1715 | RefPtr<WebCore::HTMLCollection> gobjectResult = WTF::getPtr(item->plugins()); |
1716 | return WebKit::kit(gobjectResult.get()); |
1717 | } |
1718 | |
1719 | WebKitDOMHTMLCollection* webkit_dom_document_get_scripts(WebKitDOMDocument* self) |
1720 | { |
1721 | WebCore::JSMainThreadNullState state; |
1722 | g_return_val_if_fail(WEBKIT_DOM_IS_DOCUMENT(self), 0); |
1723 | WebCore::Document* item = WebKit::core(self); |
1724 | RefPtr<WebCore::HTMLCollection> gobjectResult = WTF::getPtr(item->scripts()); |
1725 | return WebKit::kit(gobjectResult.get()); |
1726 | } |
1727 | |
1728 | gchar* webkit_dom_document_get_last_modified(WebKitDOMDocument* self) |
1729 | { |
1730 | WebCore::JSMainThreadNullState state; |
1731 | g_return_val_if_fail(WEBKIT_DOM_IS_DOCUMENT(self), 0); |
1732 | WebCore::Document* item = WebKit::core(self); |
1733 | gchar* result = convertToUTF8String(item->lastModified()); |
1734 | return result; |
1735 | } |
1736 | |
1737 | gchar* webkit_dom_document_get_charset(WebKitDOMDocument* self) |
1738 | { |
1739 | WebCore::JSMainThreadNullState state; |
1740 | g_return_val_if_fail(WEBKIT_DOM_IS_DOCUMENT(self), 0); |
1741 | WebCore::Document* item = WebKit::core(self); |
1742 | gchar* result = convertToUTF8String(item->charset()); |
1743 | return result; |
1744 | } |
1745 | |
1746 | void webkit_dom_document_set_charset(WebKitDOMDocument* self, const gchar* value) |
1747 | { |
1748 | WebCore::JSMainThreadNullState state; |
1749 | g_return_if_fail(WEBKIT_DOM_IS_DOCUMENT(self)); |
1750 | g_return_if_fail(value); |
1751 | WebCore::Document* item = WebKit::core(self); |
1752 | WTF::String convertedValue = WTF::String::fromUTF8(value); |
1753 | item->setCharset(convertedValue); |
1754 | } |
1755 | |
1756 | gchar* webkit_dom_document_get_ready_state(WebKitDOMDocument* self) |
1757 | { |
1758 | WebCore::JSMainThreadNullState state; |
1759 | g_return_val_if_fail(WEBKIT_DOM_IS_DOCUMENT(self), 0); |
1760 | |
1761 | auto readyState = WebKit::core(self)->readyState(); |
1762 | switch (readyState) { |
1763 | case WebCore::Document::Loading: |
1764 | return convertToUTF8String("loading"_s ); |
1765 | case WebCore::Document::Interactive: |
1766 | return convertToUTF8String("interactive"_s ); |
1767 | case WebCore::Document::Complete: |
1768 | return convertToUTF8String("complete"_s ); |
1769 | } |
1770 | return 0; |
1771 | } |
1772 | |
1773 | gchar* webkit_dom_document_get_character_set(WebKitDOMDocument* self) |
1774 | { |
1775 | WebCore::JSMainThreadNullState state; |
1776 | g_return_val_if_fail(WEBKIT_DOM_IS_DOCUMENT(self), 0); |
1777 | WebCore::Document* item = WebKit::core(self); |
1778 | gchar* result = convertToUTF8String(item->characterSetWithUTF8Fallback()); |
1779 | return result; |
1780 | } |
1781 | |
1782 | gchar* webkit_dom_document_get_preferred_stylesheet_set(WebKitDOMDocument* self) |
1783 | { |
1784 | g_warning("%s: this function has been removed and does nothing" , __func__); |
1785 | return nullptr; |
1786 | } |
1787 | |
1788 | gchar* webkit_dom_document_get_selected_stylesheet_set(WebKitDOMDocument* self) |
1789 | { |
1790 | g_warning("%s: this function has been removed and does nothing" , __func__); |
1791 | return nullptr; |
1792 | } |
1793 | |
1794 | void webkit_dom_document_set_selected_stylesheet_set(WebKitDOMDocument* self, const gchar* value) |
1795 | { |
1796 | g_warning("%s: this function has been removed and does nothing" , __func__); |
1797 | } |
1798 | |
1799 | WebKitDOMElement* webkit_dom_document_get_active_element(WebKitDOMDocument* self) |
1800 | { |
1801 | WebCore::JSMainThreadNullState state; |
1802 | g_return_val_if_fail(WEBKIT_DOM_IS_DOCUMENT(self), 0); |
1803 | WebCore::Document* item = WebKit::core(self); |
1804 | RefPtr<WebCore::Element> gobjectResult = WTF::getPtr(item->activeElement()); |
1805 | return WebKit::kit(gobjectResult.get()); |
1806 | } |
1807 | |
1808 | gchar* webkit_dom_document_get_compat_mode(WebKitDOMDocument* self) |
1809 | { |
1810 | WebCore::JSMainThreadNullState state; |
1811 | g_return_val_if_fail(WEBKIT_DOM_IS_DOCUMENT(self), 0); |
1812 | WebCore::Document* item = WebKit::core(self); |
1813 | gchar* result = convertToUTF8String(item->compatMode()); |
1814 | return result; |
1815 | } |
1816 | |
1817 | gboolean webkit_dom_document_get_webkit_is_fullscreen(WebKitDOMDocument* self) |
1818 | { |
1819 | WebCore::JSMainThreadNullState state; |
1820 | g_return_val_if_fail(WEBKIT_DOM_IS_DOCUMENT(self), FALSE); |
1821 | WebCore::Document* item = WebKit::core(self); |
1822 | gboolean result = item->fullscreenManager().isFullscreen(); |
1823 | return result; |
1824 | } |
1825 | |
1826 | gboolean webkit_dom_document_get_webkit_fullscreen_keyboard_input_allowed(WebKitDOMDocument* self) |
1827 | { |
1828 | WebCore::JSMainThreadNullState state; |
1829 | g_return_val_if_fail(WEBKIT_DOM_IS_DOCUMENT(self), FALSE); |
1830 | WebCore::Document* item = WebKit::core(self); |
1831 | gboolean result = item->fullscreenManager().isFullscreenKeyboardInputAllowed(); |
1832 | return result; |
1833 | } |
1834 | |
1835 | WebKitDOMElement* webkit_dom_document_get_webkit_current_fullscreen_element(WebKitDOMDocument* self) |
1836 | { |
1837 | WebCore::JSMainThreadNullState state; |
1838 | g_return_val_if_fail(WEBKIT_DOM_IS_DOCUMENT(self), 0); |
1839 | WebCore::Document* item = WebKit::core(self); |
1840 | RefPtr<WebCore::Element> gobjectResult = WTF::getPtr(item->fullscreenManager().currentFullscreenElement()); |
1841 | return WebKit::kit(gobjectResult.get()); |
1842 | } |
1843 | |
1844 | gboolean webkit_dom_document_get_webkit_fullscreen_enabled(WebKitDOMDocument* self) |
1845 | { |
1846 | WebCore::JSMainThreadNullState state; |
1847 | g_return_val_if_fail(WEBKIT_DOM_IS_DOCUMENT(self), FALSE); |
1848 | WebCore::Document* item = WebKit::core(self); |
1849 | gboolean result = item->fullscreenManager().isFullscreenEnabled(); |
1850 | return result; |
1851 | } |
1852 | |
1853 | WebKitDOMElement* webkit_dom_document_get_webkit_fullscreen_element(WebKitDOMDocument* self) |
1854 | { |
1855 | WebCore::JSMainThreadNullState state; |
1856 | g_return_val_if_fail(WEBKIT_DOM_IS_DOCUMENT(self), 0); |
1857 | WebCore::Document* item = WebKit::core(self); |
1858 | RefPtr<WebCore::Element> gobjectResult = WTF::getPtr(item->fullscreenManager().fullscreenElement()); |
1859 | return WebKit::kit(gobjectResult.get()); |
1860 | } |
1861 | |
1862 | WebKitDOMElement* webkit_dom_document_get_pointer_lock_element(WebKitDOMDocument* self) |
1863 | { |
1864 | #if ENABLE(POINTER_LOCK) |
1865 | WebCore::JSMainThreadNullState state; |
1866 | g_return_val_if_fail(WEBKIT_DOM_IS_DOCUMENT(self), 0); |
1867 | WebCore::Document* item = WebKit::core(self); |
1868 | RefPtr<WebCore::Element> gobjectResult = WTF::getPtr(item->pointerLockElement()); |
1869 | return WebKit::kit(gobjectResult.get()); |
1870 | #else |
1871 | UNUSED_PARAM(self); |
1872 | WEBKIT_WARN_FEATURE_NOT_PRESENT("Pointer Lock" ) |
1873 | return 0; |
1874 | #endif /* ENABLE(POINTER_LOCK) */ |
1875 | } |
1876 | |
1877 | gchar* webkit_dom_document_get_visibility_state(WebKitDOMDocument* self) |
1878 | { |
1879 | WebCore::JSMainThreadNullState state; |
1880 | g_return_val_if_fail(WEBKIT_DOM_IS_DOCUMENT(self), 0); |
1881 | WebCore::Document* item = WebKit::core(self); |
1882 | switch (item->visibilityState()) { |
1883 | case WebCore::VisibilityState::Hidden: |
1884 | return convertToUTF8String("hidden" ); |
1885 | case WebCore::VisibilityState::Visible: |
1886 | return convertToUTF8String("visible" ); |
1887 | case WebCore::VisibilityState::Prerender: |
1888 | return convertToUTF8String("prerender" ); |
1889 | } |
1890 | ASSERT_NOT_REACHED(); |
1891 | return nullptr; |
1892 | } |
1893 | |
1894 | gboolean webkit_dom_document_get_hidden(WebKitDOMDocument* self) |
1895 | { |
1896 | WebCore::JSMainThreadNullState state; |
1897 | g_return_val_if_fail(WEBKIT_DOM_IS_DOCUMENT(self), FALSE); |
1898 | WebCore::Document* item = WebKit::core(self); |
1899 | gboolean result = item->hidden(); |
1900 | return result; |
1901 | } |
1902 | |
1903 | WebKitDOMHTMLScriptElement* webkit_dom_document_get_current_script(WebKitDOMDocument* self) |
1904 | { |
1905 | WebCore::JSMainThreadNullState state; |
1906 | g_return_val_if_fail(WEBKIT_DOM_IS_DOCUMENT(self), 0); |
1907 | WebCore::Document* item = WebKit::core(self); |
1908 | RefPtr<WebCore::HTMLScriptElement> gobjectResult = WTF::getPtr(item->currentScript()); |
1909 | return WebKit::kit(gobjectResult.get()); |
1910 | } |
1911 | |
1912 | gchar* webkit_dom_document_get_origin(WebKitDOMDocument* self) |
1913 | { |
1914 | WebCore::JSMainThreadNullState state; |
1915 | g_return_val_if_fail(WEBKIT_DOM_IS_DOCUMENT(self), 0); |
1916 | WebCore::Document* item = WebKit::core(self); |
1917 | gchar* result = convertToUTF8String(item->origin()); |
1918 | return result; |
1919 | } |
1920 | |
1921 | WebKitDOMElement* webkit_dom_document_get_scrolling_element(WebKitDOMDocument* self) |
1922 | { |
1923 | WebCore::JSMainThreadNullState state; |
1924 | g_return_val_if_fail(WEBKIT_DOM_IS_DOCUMENT(self), 0); |
1925 | WebCore::Document* item = WebKit::core(self); |
1926 | RefPtr<WebCore::Element> gobjectResult = WTF::getPtr(item->scrollingElementForAPI()); |
1927 | return WebKit::kit(gobjectResult.get()); |
1928 | } |
1929 | |
1930 | WebKitDOMHTMLCollection* webkit_dom_document_get_children(WebKitDOMDocument* self) |
1931 | { |
1932 | WebCore::JSMainThreadNullState state; |
1933 | g_return_val_if_fail(WEBKIT_DOM_IS_DOCUMENT(self), 0); |
1934 | WebCore::Document* item = WebKit::core(self); |
1935 | RefPtr<WebCore::HTMLCollection> gobjectResult = WTF::getPtr(item->children()); |
1936 | return WebKit::kit(gobjectResult.get()); |
1937 | } |
1938 | |
1939 | WebKitDOMElement* webkit_dom_document_get_first_element_child(WebKitDOMDocument* self) |
1940 | { |
1941 | WebCore::JSMainThreadNullState state; |
1942 | g_return_val_if_fail(WEBKIT_DOM_IS_DOCUMENT(self), 0); |
1943 | WebCore::Document* item = WebKit::core(self); |
1944 | RefPtr<WebCore::Element> gobjectResult = WTF::getPtr(item->firstElementChild()); |
1945 | return WebKit::kit(gobjectResult.get()); |
1946 | } |
1947 | |
1948 | WebKitDOMElement* webkit_dom_document_get_last_element_child(WebKitDOMDocument* self) |
1949 | { |
1950 | WebCore::JSMainThreadNullState state; |
1951 | g_return_val_if_fail(WEBKIT_DOM_IS_DOCUMENT(self), 0); |
1952 | WebCore::Document* item = WebKit::core(self); |
1953 | RefPtr<WebCore::Element> gobjectResult = WTF::getPtr(item->lastElementChild()); |
1954 | return WebKit::kit(gobjectResult.get()); |
1955 | } |
1956 | |
1957 | gulong webkit_dom_document_get_child_element_count(WebKitDOMDocument* self) |
1958 | { |
1959 | WebCore::JSMainThreadNullState state; |
1960 | g_return_val_if_fail(WEBKIT_DOM_IS_DOCUMENT(self), 0); |
1961 | WebCore::Document* item = WebKit::core(self); |
1962 | gulong result = item->childElementCount(); |
1963 | return result; |
1964 | } |
1965 | |
1966 | G_GNUC_END_IGNORE_DEPRECATIONS; |
1967 | |