1 // Copyright (c) 2022 Marshall A. Greenblatt. All rights reserved. 2 // 3 // Redistribution and use in source and binary forms, with or without 4 // modification, are permitted provided that the following conditions are 5 // met: 6 // 7 // * Redistributions of source code must retain the above copyright 8 // notice, this list of conditions and the following disclaimer. 9 // * Redistributions in binary form must reproduce the above 10 // copyright notice, this list of conditions and the following disclaimer 11 // in the documentation and/or other materials provided with the 12 // distribution. 13 // * Neither the name of Google Inc. nor the name Chromium Embedded 14 // Framework nor the names of its contributors may be used to endorse 15 // or promote products derived from this software without specific prior 16 // written permission. 17 // 18 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 // 30 // --------------------------------------------------------------------------- 31 // 32 // This file was generated by the CEF translator tool and should not edited 33 // by hand. See the translator.README.txt file in the tools directory for 34 // more information. 35 // 36 // $hash=c6de3fb4d64a2b2ad06a4b9c5e9d7625d40b5bb6$ 37 // 38 39 #ifndef CEF_INCLUDE_CAPI_CEF_DOM_CAPI_H_ 40 #define CEF_INCLUDE_CAPI_CEF_DOM_CAPI_H_ 41 #pragma once 42 43 #include "include/capi/cef_base_capi.h" 44 45 #ifdef __cplusplus 46 extern "C" { 47 #endif 48 49 struct _cef_domdocument_t; 50 struct _cef_domnode_t; 51 52 /// 53 // Structure to implement for visiting the DOM. The functions of this structure 54 // will be called on the render process main thread. 55 /// 56 typedef struct _cef_domvisitor_t { 57 /// 58 // Base structure. 59 /// 60 cef_base_ref_counted_t base; 61 62 /// 63 // Method executed for visiting the DOM. The document object passed to this 64 // function represents a snapshot of the DOM at the time this function is 65 // executed. DOM objects are only valid for the scope of this function. Do not 66 // keep references to or attempt to access any DOM objects outside the scope 67 // of this function. 68 /// 69 void(CEF_CALLBACK* visit)(struct _cef_domvisitor_t* self, 70 struct _cef_domdocument_t* document); 71 } cef_domvisitor_t; 72 73 /// 74 // Structure used to represent a DOM document. The functions of this structure 75 // should only be called on the render process main thread thread. 76 /// 77 typedef struct _cef_domdocument_t { 78 /// 79 // Base structure. 80 /// 81 cef_base_ref_counted_t base; 82 83 /// 84 // Returns the document type. 85 /// 86 cef_dom_document_type_t(CEF_CALLBACK* get_type)( 87 struct _cef_domdocument_t* self); 88 89 /// 90 // Returns the root document node. 91 /// 92 struct _cef_domnode_t*(CEF_CALLBACK* get_document)( 93 struct _cef_domdocument_t* self); 94 95 /// 96 // Returns the BODY node of an HTML document. 97 /// 98 struct _cef_domnode_t*(CEF_CALLBACK* get_body)( 99 struct _cef_domdocument_t* self); 100 101 /// 102 // Returns the HEAD node of an HTML document. 103 /// 104 struct _cef_domnode_t*(CEF_CALLBACK* get_head)( 105 struct _cef_domdocument_t* self); 106 107 /// 108 // Returns the title of an HTML document. 109 /// 110 // The resulting string must be freed by calling cef_string_userfree_free(). 111 cef_string_userfree_t(CEF_CALLBACK* get_title)( 112 struct _cef_domdocument_t* self); 113 114 /// 115 // Returns the document element with the specified ID value. 116 /// 117 struct _cef_domnode_t*(CEF_CALLBACK* get_element_by_id)( 118 struct _cef_domdocument_t* self, 119 const cef_string_t* id); 120 121 /// 122 // Returns the node that currently has keyboard focus. 123 /// 124 struct _cef_domnode_t*(CEF_CALLBACK* get_focused_node)( 125 struct _cef_domdocument_t* self); 126 127 /// 128 // Returns true (1) if a portion of the document is selected. 129 /// 130 int(CEF_CALLBACK* has_selection)(struct _cef_domdocument_t* self); 131 132 /// 133 // Returns the selection offset within the start node. 134 /// 135 int(CEF_CALLBACK* get_selection_start_offset)( 136 struct _cef_domdocument_t* self); 137 138 /// 139 // Returns the selection offset within the end node. 140 /// 141 int(CEF_CALLBACK* get_selection_end_offset)(struct _cef_domdocument_t* self); 142 143 /// 144 // Returns the contents of this selection as markup. 145 /// 146 // The resulting string must be freed by calling cef_string_userfree_free(). 147 cef_string_userfree_t(CEF_CALLBACK* get_selection_as_markup)( 148 struct _cef_domdocument_t* self); 149 150 /// 151 // Returns the contents of this selection as text. 152 /// 153 // The resulting string must be freed by calling cef_string_userfree_free(). 154 cef_string_userfree_t(CEF_CALLBACK* get_selection_as_text)( 155 struct _cef_domdocument_t* self); 156 157 /// 158 // Returns the base URL for the document. 159 /// 160 // The resulting string must be freed by calling cef_string_userfree_free(). 161 cef_string_userfree_t(CEF_CALLBACK* get_base_url)( 162 struct _cef_domdocument_t* self); 163 164 /// 165 // Returns a complete URL based on the document base URL and the specified 166 // partial URL. 167 /// 168 // The resulting string must be freed by calling cef_string_userfree_free(). 169 cef_string_userfree_t(CEF_CALLBACK* get_complete_url)( 170 struct _cef_domdocument_t* self, 171 const cef_string_t* partialURL); 172 } cef_domdocument_t; 173 174 /// 175 // Structure used to represent a DOM node. The functions of this structure 176 // should only be called on the render process main thread. 177 /// 178 typedef struct _cef_domnode_t { 179 /// 180 // Base structure. 181 /// 182 cef_base_ref_counted_t base; 183 184 /// 185 // Returns the type for this node. 186 /// 187 cef_dom_node_type_t(CEF_CALLBACK* get_type)(struct _cef_domnode_t* self); 188 189 /// 190 // Returns true (1) if this is a text node. 191 /// 192 int(CEF_CALLBACK* is_text)(struct _cef_domnode_t* self); 193 194 /// 195 // Returns true (1) if this is an element node. 196 /// 197 int(CEF_CALLBACK* is_element)(struct _cef_domnode_t* self); 198 199 /// 200 // Returns true (1) if this is an editable node. 201 /// 202 int(CEF_CALLBACK* is_editable)(struct _cef_domnode_t* self); 203 204 /// 205 // Returns true (1) if this is a form control element node. 206 /// 207 int(CEF_CALLBACK* is_form_control_element)(struct _cef_domnode_t* self); 208 209 /// 210 // Returns the type of this form control element node. 211 /// 212 // The resulting string must be freed by calling cef_string_userfree_free(). 213 cef_string_userfree_t(CEF_CALLBACK* get_form_control_element_type)( 214 struct _cef_domnode_t* self); 215 216 /// 217 // Returns true (1) if this object is pointing to the same handle as |that| 218 // object. 219 /// 220 int(CEF_CALLBACK* is_same)(struct _cef_domnode_t* self, 221 struct _cef_domnode_t* that); 222 223 /// 224 // Returns the name of this node. 225 /// 226 // The resulting string must be freed by calling cef_string_userfree_free(). 227 cef_string_userfree_t(CEF_CALLBACK* get_name)(struct _cef_domnode_t* self); 228 229 /// 230 // Returns the value of this node. 231 /// 232 // The resulting string must be freed by calling cef_string_userfree_free(). 233 cef_string_userfree_t(CEF_CALLBACK* get_value)(struct _cef_domnode_t* self); 234 235 /// 236 // Set the value of this node. Returns true (1) on success. 237 /// 238 int(CEF_CALLBACK* set_value)(struct _cef_domnode_t* self, 239 const cef_string_t* value); 240 241 /// 242 // Returns the contents of this node as markup. 243 /// 244 // The resulting string must be freed by calling cef_string_userfree_free(). 245 cef_string_userfree_t(CEF_CALLBACK* get_as_markup)( 246 struct _cef_domnode_t* self); 247 248 /// 249 // Returns the document associated with this node. 250 /// 251 struct _cef_domdocument_t*(CEF_CALLBACK* get_document)( 252 struct _cef_domnode_t* self); 253 254 /// 255 // Returns the parent node. 256 /// 257 struct _cef_domnode_t*(CEF_CALLBACK* get_parent)(struct _cef_domnode_t* self); 258 259 /// 260 // Returns the previous sibling node. 261 /// 262 struct _cef_domnode_t*(CEF_CALLBACK* get_previous_sibling)( 263 struct _cef_domnode_t* self); 264 265 /// 266 // Returns the next sibling node. 267 /// 268 struct _cef_domnode_t*(CEF_CALLBACK* get_next_sibling)( 269 struct _cef_domnode_t* self); 270 271 /// 272 // Returns true (1) if this node has child nodes. 273 /// 274 int(CEF_CALLBACK* has_children)(struct _cef_domnode_t* self); 275 276 /// 277 // Return the first child node. 278 /// 279 struct _cef_domnode_t*(CEF_CALLBACK* get_first_child)( 280 struct _cef_domnode_t* self); 281 282 /// 283 // Returns the last child node. 284 /// 285 struct _cef_domnode_t*(CEF_CALLBACK* get_last_child)( 286 struct _cef_domnode_t* self); 287 288 // The following functions are valid only for element nodes. 289 290 /// 291 // Returns the tag name of this element. 292 /// 293 // The resulting string must be freed by calling cef_string_userfree_free(). 294 cef_string_userfree_t(CEF_CALLBACK* get_element_tag_name)( 295 struct _cef_domnode_t* self); 296 297 /// 298 // Returns true (1) if this element has attributes. 299 /// 300 int(CEF_CALLBACK* has_element_attributes)(struct _cef_domnode_t* self); 301 302 /// 303 // Returns true (1) if this element has an attribute named |attrName|. 304 /// 305 int(CEF_CALLBACK* has_element_attribute)(struct _cef_domnode_t* self, 306 const cef_string_t* attrName); 307 308 /// 309 // Returns the element attribute named |attrName|. 310 /// 311 // The resulting string must be freed by calling cef_string_userfree_free(). 312 cef_string_userfree_t(CEF_CALLBACK* get_element_attribute)( 313 struct _cef_domnode_t* self, 314 const cef_string_t* attrName); 315 316 /// 317 // Returns a map of all element attributes. 318 /// 319 void(CEF_CALLBACK* get_element_attributes)(struct _cef_domnode_t* self, 320 cef_string_map_t attrMap); 321 322 /// 323 // Set the value for the element attribute named |attrName|. Returns true (1) 324 // on success. 325 /// 326 int(CEF_CALLBACK* set_element_attribute)(struct _cef_domnode_t* self, 327 const cef_string_t* attrName, 328 const cef_string_t* value); 329 330 /// 331 // Returns the inner text of the element. 332 /// 333 // The resulting string must be freed by calling cef_string_userfree_free(). 334 cef_string_userfree_t(CEF_CALLBACK* get_element_inner_text)( 335 struct _cef_domnode_t* self); 336 337 /// 338 // Returns the bounds of the element. 339 /// 340 cef_rect_t(CEF_CALLBACK* get_element_bounds)(struct _cef_domnode_t* self); 341 } cef_domnode_t; 342 343 #ifdef __cplusplus 344 } 345 #endif 346 347 #endif // CEF_INCLUDE_CAPI_CEF_DOM_CAPI_H_ 348