1 // Copyright (c) 2022 The Chromium Embedded Framework Authors. All rights
2 // reserved. Use of this source code is governed by a BSD-style license that
3 // can be found in the LICENSE file.
4 //
5 // ---------------------------------------------------------------------------
6 //
7 // This file was generated by the CEF translator tool. If making changes by
8 // hand only do so within the body of existing method and function
9 // implementations. See the translator.README.txt file in the tools directory
10 // for more information.
11 //
12 // $hash=d352693e8728b1ed586dc62d69a91dd92667760a$
13 //
14
15 #include "libcef_dll/cpptoc/domnode_cpptoc.h"
16 #include "libcef_dll/cpptoc/domdocument_cpptoc.h"
17 #include "libcef_dll/shutdown_checker.h"
18 #include "libcef_dll/transfer_util.h"
19
20 namespace {
21
22 // MEMBER FUNCTIONS - Body may be edited by hand.
23
domnode_get_type(struct _cef_domnode_t * self)24 cef_dom_node_type_t CEF_CALLBACK domnode_get_type(struct _cef_domnode_t* self) {
25 shutdown_checker::AssertNotShutdown();
26
27 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
28
29 DCHECK(self);
30 if (!self)
31 return DOM_NODE_TYPE_UNSUPPORTED;
32
33 // Execute
34 cef_dom_node_type_t _retval = CefDOMNodeCppToC::Get(self)->GetType();
35
36 // Return type: simple
37 return _retval;
38 }
39
domnode_is_text(struct _cef_domnode_t * self)40 int CEF_CALLBACK domnode_is_text(struct _cef_domnode_t* self) {
41 shutdown_checker::AssertNotShutdown();
42
43 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
44
45 DCHECK(self);
46 if (!self)
47 return 0;
48
49 // Execute
50 bool _retval = CefDOMNodeCppToC::Get(self)->IsText();
51
52 // Return type: bool
53 return _retval;
54 }
55
domnode_is_element(struct _cef_domnode_t * self)56 int CEF_CALLBACK domnode_is_element(struct _cef_domnode_t* self) {
57 shutdown_checker::AssertNotShutdown();
58
59 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
60
61 DCHECK(self);
62 if (!self)
63 return 0;
64
65 // Execute
66 bool _retval = CefDOMNodeCppToC::Get(self)->IsElement();
67
68 // Return type: bool
69 return _retval;
70 }
71
domnode_is_editable(struct _cef_domnode_t * self)72 int CEF_CALLBACK domnode_is_editable(struct _cef_domnode_t* self) {
73 shutdown_checker::AssertNotShutdown();
74
75 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
76
77 DCHECK(self);
78 if (!self)
79 return 0;
80
81 // Execute
82 bool _retval = CefDOMNodeCppToC::Get(self)->IsEditable();
83
84 // Return type: bool
85 return _retval;
86 }
87
domnode_is_form_control_element(struct _cef_domnode_t * self)88 int CEF_CALLBACK domnode_is_form_control_element(struct _cef_domnode_t* self) {
89 shutdown_checker::AssertNotShutdown();
90
91 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
92
93 DCHECK(self);
94 if (!self)
95 return 0;
96
97 // Execute
98 bool _retval = CefDOMNodeCppToC::Get(self)->IsFormControlElement();
99
100 // Return type: bool
101 return _retval;
102 }
103
104 cef_string_userfree_t CEF_CALLBACK
domnode_get_form_control_element_type(struct _cef_domnode_t * self)105 domnode_get_form_control_element_type(struct _cef_domnode_t* self) {
106 shutdown_checker::AssertNotShutdown();
107
108 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
109
110 DCHECK(self);
111 if (!self)
112 return NULL;
113
114 // Execute
115 CefString _retval = CefDOMNodeCppToC::Get(self)->GetFormControlElementType();
116
117 // Return type: string
118 return _retval.DetachToUserFree();
119 }
120
domnode_is_same(struct _cef_domnode_t * self,struct _cef_domnode_t * that)121 int CEF_CALLBACK domnode_is_same(struct _cef_domnode_t* self,
122 struct _cef_domnode_t* that) {
123 shutdown_checker::AssertNotShutdown();
124
125 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
126
127 DCHECK(self);
128 if (!self)
129 return 0;
130 // Verify param: that; type: refptr_same
131 DCHECK(that);
132 if (!that)
133 return 0;
134
135 // Execute
136 bool _retval =
137 CefDOMNodeCppToC::Get(self)->IsSame(CefDOMNodeCppToC::Unwrap(that));
138
139 // Return type: bool
140 return _retval;
141 }
142
143 cef_string_userfree_t CEF_CALLBACK
domnode_get_name(struct _cef_domnode_t * self)144 domnode_get_name(struct _cef_domnode_t* self) {
145 shutdown_checker::AssertNotShutdown();
146
147 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
148
149 DCHECK(self);
150 if (!self)
151 return NULL;
152
153 // Execute
154 CefString _retval = CefDOMNodeCppToC::Get(self)->GetName();
155
156 // Return type: string
157 return _retval.DetachToUserFree();
158 }
159
160 cef_string_userfree_t CEF_CALLBACK
domnode_get_value(struct _cef_domnode_t * self)161 domnode_get_value(struct _cef_domnode_t* self) {
162 shutdown_checker::AssertNotShutdown();
163
164 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
165
166 DCHECK(self);
167 if (!self)
168 return NULL;
169
170 // Execute
171 CefString _retval = CefDOMNodeCppToC::Get(self)->GetValue();
172
173 // Return type: string
174 return _retval.DetachToUserFree();
175 }
176
domnode_set_value(struct _cef_domnode_t * self,const cef_string_t * value)177 int CEF_CALLBACK domnode_set_value(struct _cef_domnode_t* self,
178 const cef_string_t* value) {
179 shutdown_checker::AssertNotShutdown();
180
181 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
182
183 DCHECK(self);
184 if (!self)
185 return 0;
186 // Verify param: value; type: string_byref_const
187 DCHECK(value);
188 if (!value)
189 return 0;
190
191 // Execute
192 bool _retval = CefDOMNodeCppToC::Get(self)->SetValue(CefString(value));
193
194 // Return type: bool
195 return _retval;
196 }
197
198 cef_string_userfree_t CEF_CALLBACK
domnode_get_as_markup(struct _cef_domnode_t * self)199 domnode_get_as_markup(struct _cef_domnode_t* self) {
200 shutdown_checker::AssertNotShutdown();
201
202 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
203
204 DCHECK(self);
205 if (!self)
206 return NULL;
207
208 // Execute
209 CefString _retval = CefDOMNodeCppToC::Get(self)->GetAsMarkup();
210
211 // Return type: string
212 return _retval.DetachToUserFree();
213 }
214
215 cef_domdocument_t* CEF_CALLBACK
domnode_get_document(struct _cef_domnode_t * self)216 domnode_get_document(struct _cef_domnode_t* self) {
217 shutdown_checker::AssertNotShutdown();
218
219 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
220
221 DCHECK(self);
222 if (!self)
223 return NULL;
224
225 // Execute
226 CefRefPtr<CefDOMDocument> _retval =
227 CefDOMNodeCppToC::Get(self)->GetDocument();
228
229 // Return type: refptr_same
230 return CefDOMDocumentCppToC::Wrap(_retval);
231 }
232
233 struct _cef_domnode_t* CEF_CALLBACK
domnode_get_parent(struct _cef_domnode_t * self)234 domnode_get_parent(struct _cef_domnode_t* self) {
235 shutdown_checker::AssertNotShutdown();
236
237 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
238
239 DCHECK(self);
240 if (!self)
241 return NULL;
242
243 // Execute
244 CefRefPtr<CefDOMNode> _retval = CefDOMNodeCppToC::Get(self)->GetParent();
245
246 // Return type: refptr_same
247 return CefDOMNodeCppToC::Wrap(_retval);
248 }
249
250 struct _cef_domnode_t* CEF_CALLBACK
domnode_get_previous_sibling(struct _cef_domnode_t * self)251 domnode_get_previous_sibling(struct _cef_domnode_t* self) {
252 shutdown_checker::AssertNotShutdown();
253
254 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
255
256 DCHECK(self);
257 if (!self)
258 return NULL;
259
260 // Execute
261 CefRefPtr<CefDOMNode> _retval =
262 CefDOMNodeCppToC::Get(self)->GetPreviousSibling();
263
264 // Return type: refptr_same
265 return CefDOMNodeCppToC::Wrap(_retval);
266 }
267
268 struct _cef_domnode_t* CEF_CALLBACK
domnode_get_next_sibling(struct _cef_domnode_t * self)269 domnode_get_next_sibling(struct _cef_domnode_t* self) {
270 shutdown_checker::AssertNotShutdown();
271
272 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
273
274 DCHECK(self);
275 if (!self)
276 return NULL;
277
278 // Execute
279 CefRefPtr<CefDOMNode> _retval = CefDOMNodeCppToC::Get(self)->GetNextSibling();
280
281 // Return type: refptr_same
282 return CefDOMNodeCppToC::Wrap(_retval);
283 }
284
domnode_has_children(struct _cef_domnode_t * self)285 int CEF_CALLBACK domnode_has_children(struct _cef_domnode_t* self) {
286 shutdown_checker::AssertNotShutdown();
287
288 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
289
290 DCHECK(self);
291 if (!self)
292 return 0;
293
294 // Execute
295 bool _retval = CefDOMNodeCppToC::Get(self)->HasChildren();
296
297 // Return type: bool
298 return _retval;
299 }
300
301 struct _cef_domnode_t* CEF_CALLBACK
domnode_get_first_child(struct _cef_domnode_t * self)302 domnode_get_first_child(struct _cef_domnode_t* self) {
303 shutdown_checker::AssertNotShutdown();
304
305 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
306
307 DCHECK(self);
308 if (!self)
309 return NULL;
310
311 // Execute
312 CefRefPtr<CefDOMNode> _retval = CefDOMNodeCppToC::Get(self)->GetFirstChild();
313
314 // Return type: refptr_same
315 return CefDOMNodeCppToC::Wrap(_retval);
316 }
317
318 struct _cef_domnode_t* CEF_CALLBACK
domnode_get_last_child(struct _cef_domnode_t * self)319 domnode_get_last_child(struct _cef_domnode_t* self) {
320 shutdown_checker::AssertNotShutdown();
321
322 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
323
324 DCHECK(self);
325 if (!self)
326 return NULL;
327
328 // Execute
329 CefRefPtr<CefDOMNode> _retval = CefDOMNodeCppToC::Get(self)->GetLastChild();
330
331 // Return type: refptr_same
332 return CefDOMNodeCppToC::Wrap(_retval);
333 }
334
335 cef_string_userfree_t CEF_CALLBACK
domnode_get_element_tag_name(struct _cef_domnode_t * self)336 domnode_get_element_tag_name(struct _cef_domnode_t* self) {
337 shutdown_checker::AssertNotShutdown();
338
339 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
340
341 DCHECK(self);
342 if (!self)
343 return NULL;
344
345 // Execute
346 CefString _retval = CefDOMNodeCppToC::Get(self)->GetElementTagName();
347
348 // Return type: string
349 return _retval.DetachToUserFree();
350 }
351
domnode_has_element_attributes(struct _cef_domnode_t * self)352 int CEF_CALLBACK domnode_has_element_attributes(struct _cef_domnode_t* self) {
353 shutdown_checker::AssertNotShutdown();
354
355 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
356
357 DCHECK(self);
358 if (!self)
359 return 0;
360
361 // Execute
362 bool _retval = CefDOMNodeCppToC::Get(self)->HasElementAttributes();
363
364 // Return type: bool
365 return _retval;
366 }
367
domnode_has_element_attribute(struct _cef_domnode_t * self,const cef_string_t * attrName)368 int CEF_CALLBACK domnode_has_element_attribute(struct _cef_domnode_t* self,
369 const cef_string_t* attrName) {
370 shutdown_checker::AssertNotShutdown();
371
372 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
373
374 DCHECK(self);
375 if (!self)
376 return 0;
377 // Verify param: attrName; type: string_byref_const
378 DCHECK(attrName);
379 if (!attrName)
380 return 0;
381
382 // Execute
383 bool _retval =
384 CefDOMNodeCppToC::Get(self)->HasElementAttribute(CefString(attrName));
385
386 // Return type: bool
387 return _retval;
388 }
389
390 cef_string_userfree_t CEF_CALLBACK
domnode_get_element_attribute(struct _cef_domnode_t * self,const cef_string_t * attrName)391 domnode_get_element_attribute(struct _cef_domnode_t* self,
392 const cef_string_t* attrName) {
393 shutdown_checker::AssertNotShutdown();
394
395 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
396
397 DCHECK(self);
398 if (!self)
399 return NULL;
400 // Verify param: attrName; type: string_byref_const
401 DCHECK(attrName);
402 if (!attrName)
403 return NULL;
404
405 // Execute
406 CefString _retval =
407 CefDOMNodeCppToC::Get(self)->GetElementAttribute(CefString(attrName));
408
409 // Return type: string
410 return _retval.DetachToUserFree();
411 }
412
domnode_get_element_attributes(struct _cef_domnode_t * self,cef_string_map_t attrMap)413 void CEF_CALLBACK domnode_get_element_attributes(struct _cef_domnode_t* self,
414 cef_string_map_t attrMap) {
415 shutdown_checker::AssertNotShutdown();
416
417 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
418
419 DCHECK(self);
420 if (!self)
421 return;
422 // Verify param: attrMap; type: string_map_single_byref
423 DCHECK(attrMap);
424 if (!attrMap)
425 return;
426
427 // Translate param: attrMap; type: string_map_single_byref
428 std::map<CefString, CefString> attrMapMap;
429 transfer_string_map_contents(attrMap, attrMapMap);
430
431 // Execute
432 CefDOMNodeCppToC::Get(self)->GetElementAttributes(attrMapMap);
433
434 // Restore param: attrMap; type: string_map_single_byref
435 cef_string_map_clear(attrMap);
436 transfer_string_map_contents(attrMapMap, attrMap);
437 }
438
domnode_set_element_attribute(struct _cef_domnode_t * self,const cef_string_t * attrName,const cef_string_t * value)439 int CEF_CALLBACK domnode_set_element_attribute(struct _cef_domnode_t* self,
440 const cef_string_t* attrName,
441 const cef_string_t* value) {
442 shutdown_checker::AssertNotShutdown();
443
444 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
445
446 DCHECK(self);
447 if (!self)
448 return 0;
449 // Verify param: attrName; type: string_byref_const
450 DCHECK(attrName);
451 if (!attrName)
452 return 0;
453 // Verify param: value; type: string_byref_const
454 DCHECK(value);
455 if (!value)
456 return 0;
457
458 // Execute
459 bool _retval = CefDOMNodeCppToC::Get(self)->SetElementAttribute(
460 CefString(attrName), CefString(value));
461
462 // Return type: bool
463 return _retval;
464 }
465
466 cef_string_userfree_t CEF_CALLBACK
domnode_get_element_inner_text(struct _cef_domnode_t * self)467 domnode_get_element_inner_text(struct _cef_domnode_t* self) {
468 shutdown_checker::AssertNotShutdown();
469
470 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
471
472 DCHECK(self);
473 if (!self)
474 return NULL;
475
476 // Execute
477 CefString _retval = CefDOMNodeCppToC::Get(self)->GetElementInnerText();
478
479 // Return type: string
480 return _retval.DetachToUserFree();
481 }
482
483 cef_rect_t CEF_CALLBACK
domnode_get_element_bounds(struct _cef_domnode_t * self)484 domnode_get_element_bounds(struct _cef_domnode_t* self) {
485 shutdown_checker::AssertNotShutdown();
486
487 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
488
489 DCHECK(self);
490 if (!self)
491 return CefRect();
492
493 // Execute
494 cef_rect_t _retval = CefDOMNodeCppToC::Get(self)->GetElementBounds();
495
496 // Return type: simple
497 return _retval;
498 }
499
500 } // namespace
501
502 // CONSTRUCTOR - Do not edit by hand.
503
CefDOMNodeCppToC()504 CefDOMNodeCppToC::CefDOMNodeCppToC() {
505 GetStruct()->get_type = domnode_get_type;
506 GetStruct()->is_text = domnode_is_text;
507 GetStruct()->is_element = domnode_is_element;
508 GetStruct()->is_editable = domnode_is_editable;
509 GetStruct()->is_form_control_element = domnode_is_form_control_element;
510 GetStruct()->get_form_control_element_type =
511 domnode_get_form_control_element_type;
512 GetStruct()->is_same = domnode_is_same;
513 GetStruct()->get_name = domnode_get_name;
514 GetStruct()->get_value = domnode_get_value;
515 GetStruct()->set_value = domnode_set_value;
516 GetStruct()->get_as_markup = domnode_get_as_markup;
517 GetStruct()->get_document = domnode_get_document;
518 GetStruct()->get_parent = domnode_get_parent;
519 GetStruct()->get_previous_sibling = domnode_get_previous_sibling;
520 GetStruct()->get_next_sibling = domnode_get_next_sibling;
521 GetStruct()->has_children = domnode_has_children;
522 GetStruct()->get_first_child = domnode_get_first_child;
523 GetStruct()->get_last_child = domnode_get_last_child;
524 GetStruct()->get_element_tag_name = domnode_get_element_tag_name;
525 GetStruct()->has_element_attributes = domnode_has_element_attributes;
526 GetStruct()->has_element_attribute = domnode_has_element_attribute;
527 GetStruct()->get_element_attribute = domnode_get_element_attribute;
528 GetStruct()->get_element_attributes = domnode_get_element_attributes;
529 GetStruct()->set_element_attribute = domnode_set_element_attribute;
530 GetStruct()->get_element_inner_text = domnode_get_element_inner_text;
531 GetStruct()->get_element_bounds = domnode_get_element_bounds;
532 }
533
534 // DESTRUCTOR - Do not edit by hand.
535
~CefDOMNodeCppToC()536 CefDOMNodeCppToC::~CefDOMNodeCppToC() {
537 shutdown_checker::AssertNotShutdown();
538 }
539
540 template <>
541 CefRefPtr<CefDOMNode>
UnwrapDerived(CefWrapperType type,cef_domnode_t * s)542 CefCppToCRefCounted<CefDOMNodeCppToC, CefDOMNode, cef_domnode_t>::UnwrapDerived(
543 CefWrapperType type,
544 cef_domnode_t* s) {
545 NOTREACHED() << "Unexpected class type: " << type;
546 return nullptr;
547 }
548
549 template <>
550 CefWrapperType CefCppToCRefCounted<CefDOMNodeCppToC,
551 CefDOMNode,
552 cef_domnode_t>::kWrapperType = WT_DOMNODE;
553