1 // Copyright (c) 2015 Marshall A. Greenblatt. All rights reserved.
3 // Redistribution and use in source and binary forms, with or without
4 // modification, are permitted provided that the following conditions are
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
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.
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.
30 // ---------------------------------------------------------------------------
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
37 #ifndef CEF_INCLUDE_CAPI_CEF_DOM_CAPI_H_
38 #define CEF_INCLUDE_CAPI_CEF_DOM_CAPI_H_
41 #include "include/capi/cef_base_capi.h"
47 struct _cef_domdocument_t;
48 struct _cef_domnode_t;
51 // Structure to implement for visiting the DOM. The functions of this structure
52 // will be called on the render process main thread.
54 typedef struct _cef_domvisitor_t {
61 // Method executed for visiting the DOM. The document object passed to this
62 // function represents a snapshot of the DOM at the time this function is
63 // executed. DOM objects are only valid for the scope of this function. Do not
64 // keep references to or attempt to access any DOM objects outside the scope
67 void (CEF_CALLBACK *visit)(struct _cef_domvisitor_t* self,
68 struct _cef_domdocument_t* document);
73 // Structure used to represent a DOM document. The functions of this structure
74 // should only be called on the render process main thread thread.
76 typedef struct _cef_domdocument_t {
83 // Returns the document type.
85 cef_dom_document_type_t (CEF_CALLBACK *get_type)(
86 struct _cef_domdocument_t* self);
89 // Returns the root document node.
91 struct _cef_domnode_t* (CEF_CALLBACK *get_document)(
92 struct _cef_domdocument_t* self);
95 // Returns the BODY node of an HTML document.
97 struct _cef_domnode_t* (CEF_CALLBACK *get_body)(
98 struct _cef_domdocument_t* self);
101 // Returns the HEAD node of an HTML document.
103 struct _cef_domnode_t* (CEF_CALLBACK *get_head)(
104 struct _cef_domdocument_t* self);
107 // Returns the title of an HTML document.
109 // The resulting string must be freed by calling cef_string_userfree_free().
110 cef_string_userfree_t (CEF_CALLBACK *get_title)(
111 struct _cef_domdocument_t* self);
114 // Returns the document element with the specified ID value.
116 struct _cef_domnode_t* (CEF_CALLBACK *get_element_by_id)(
117 struct _cef_domdocument_t* self, const cef_string_t* id);
120 // Returns the node that currently has keyboard focus.
122 struct _cef_domnode_t* (CEF_CALLBACK *get_focused_node)(
123 struct _cef_domdocument_t* self);
126 // Returns true (1) if a portion of the document is selected.
128 int (CEF_CALLBACK *has_selection)(struct _cef_domdocument_t* self);
131 // Returns the selection offset within the start node.
133 int (CEF_CALLBACK *get_selection_start_offset)(
134 struct _cef_domdocument_t* self);
137 // Returns the selection offset within the end node.
139 int (CEF_CALLBACK *get_selection_end_offset)(struct _cef_domdocument_t* self);
142 // Returns the contents of this selection as markup.
144 // The resulting string must be freed by calling cef_string_userfree_free().
145 cef_string_userfree_t (CEF_CALLBACK *get_selection_as_markup)(
146 struct _cef_domdocument_t* self);
149 // Returns the contents of this selection as text.
151 // The resulting string must be freed by calling cef_string_userfree_free().
152 cef_string_userfree_t (CEF_CALLBACK *get_selection_as_text)(
153 struct _cef_domdocument_t* self);
156 // Returns the base URL for the document.
158 // The resulting string must be freed by calling cef_string_userfree_free().
159 cef_string_userfree_t (CEF_CALLBACK *get_base_url)(
160 struct _cef_domdocument_t* self);
163 // Returns a complete URL based on the document base URL and the specified
166 // The resulting string must be freed by calling cef_string_userfree_free().
167 cef_string_userfree_t (CEF_CALLBACK *get_complete_url)(
168 struct _cef_domdocument_t* self, const cef_string_t* partialURL);
173 // Structure used to represent a DOM node. The functions of this structure
174 // should only be called on the render process main thread.
176 typedef struct _cef_domnode_t {
183 // Returns the type for this node.
185 cef_dom_node_type_t (CEF_CALLBACK *get_type)(struct _cef_domnode_t* self);
188 // Returns true (1) if this is a text node.
190 int (CEF_CALLBACK *is_text)(struct _cef_domnode_t* self);
193 // Returns true (1) if this is an element node.
195 int (CEF_CALLBACK *is_element)(struct _cef_domnode_t* self);
198 // Returns true (1) if this is an editable node.
200 int (CEF_CALLBACK *is_editable)(struct _cef_domnode_t* self);
203 // Returns true (1) if this is a form control element node.
205 int (CEF_CALLBACK *is_form_control_element)(struct _cef_domnode_t* self);
208 // Returns the type of this form control element node.
210 // The resulting string must be freed by calling cef_string_userfree_free().
211 cef_string_userfree_t (CEF_CALLBACK *get_form_control_element_type)(
212 struct _cef_domnode_t* self);
215 // Returns true (1) if this object is pointing to the same handle as |that|
218 int (CEF_CALLBACK *is_same)(struct _cef_domnode_t* self,
219 struct _cef_domnode_t* that);
222 // Returns the name of this node.
224 // The resulting string must be freed by calling cef_string_userfree_free().
225 cef_string_userfree_t (CEF_CALLBACK *get_name)(struct _cef_domnode_t* self);
228 // Returns the value of this node.
230 // The resulting string must be freed by calling cef_string_userfree_free().
231 cef_string_userfree_t (CEF_CALLBACK *get_value)(struct _cef_domnode_t* self);
234 // Set the value of this node. Returns true (1) on success.
236 int (CEF_CALLBACK *set_value)(struct _cef_domnode_t* self,
237 const cef_string_t* value);
240 // Returns the contents of this node as markup.
242 // The resulting string must be freed by calling cef_string_userfree_free().
243 cef_string_userfree_t (CEF_CALLBACK *get_as_markup)(
244 struct _cef_domnode_t* self);
247 // Returns the document associated with this node.
249 struct _cef_domdocument_t* (CEF_CALLBACK *get_document)(
250 struct _cef_domnode_t* self);
253 // Returns the parent node.
255 struct _cef_domnode_t* (CEF_CALLBACK *get_parent)(
256 struct _cef_domnode_t* self);
259 // Returns the previous sibling node.
261 struct _cef_domnode_t* (CEF_CALLBACK *get_previous_sibling)(
262 struct _cef_domnode_t* self);
265 // Returns the next sibling node.
267 struct _cef_domnode_t* (CEF_CALLBACK *get_next_sibling)(
268 struct _cef_domnode_t* self);
271 // Returns true (1) if this node has child nodes.
273 int (CEF_CALLBACK *has_children)(struct _cef_domnode_t* self);
276 // Return the first child node.
278 struct _cef_domnode_t* (CEF_CALLBACK *get_first_child)(
279 struct _cef_domnode_t* self);
282 // Returns the last child node.
284 struct _cef_domnode_t* (CEF_CALLBACK *get_last_child)(
285 struct _cef_domnode_t* self);
288 // The following functions are valid only for element nodes.
291 // Returns the tag name of this element.
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);
298 // Returns true (1) if this element has attributes.
300 int (CEF_CALLBACK *has_element_attributes)(struct _cef_domnode_t* self);
303 // Returns true (1) if this element has an attribute named |attrName|.
305 int (CEF_CALLBACK *has_element_attribute)(struct _cef_domnode_t* self,
306 const cef_string_t* attrName);
309 // Returns the element attribute named |attrName|.
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, const cef_string_t* attrName);
316 // Returns a map of all element attributes.
318 void (CEF_CALLBACK *get_element_attributes)(struct _cef_domnode_t* self,
319 cef_string_map_t attrMap);
322 // Set the value for the element attribute named |attrName|. Returns true (1)
325 int (CEF_CALLBACK *set_element_attribute)(struct _cef_domnode_t* self,
326 const cef_string_t* attrName, const cef_string_t* value);
329 // Returns the inner text of the element.
331 // The resulting string must be freed by calling cef_string_userfree_free().
332 cef_string_userfree_t (CEF_CALLBACK *get_element_inner_text)(
333 struct _cef_domnode_t* self);
341 #endif // CEF_INCLUDE_CAPI_CEF_DOM_CAPI_H_