mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
Add support for accessing and modifying the DOM (issue #60).
git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@191 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
242
libcef_dll/cpptoc/domdocument_cpptoc.cc
Normal file
242
libcef_dll/cpptoc/domdocument_cpptoc.cc
Normal file
@ -0,0 +1,242 @@
|
||||
// Copyright (c) 2010 The Chromium Embedded Framework Authors. All rights
|
||||
// reserved. Use of this source code is governed by a BSD-style license that
|
||||
// can be found in the LICENSE file.
|
||||
//
|
||||
// ---------------------------------------------------------------------------
|
||||
//
|
||||
// A portion of this file was generated by the CEF translator tool. When
|
||||
// making changes by hand only do so within the body of existing function
|
||||
// implementations. See the translator.README.txt file in the tools directory
|
||||
// for more information.
|
||||
//
|
||||
|
||||
#include "libcef_dll/cpptoc/domdocument_cpptoc.h"
|
||||
#include "libcef_dll/cpptoc/domnode_cpptoc.h"
|
||||
|
||||
|
||||
// MEMBER FUNCTIONS - Body may be edited by hand.
|
||||
|
||||
enum cef_dom_document_type_t CEF_CALLBACK domdocument_get_type(
|
||||
struct _cef_domdocument_t* self)
|
||||
{
|
||||
DCHECK(self);
|
||||
if(!self)
|
||||
return DOM_DOCUMENT_TYPE_UNKNOWN;
|
||||
|
||||
return CefDOMDocumentCppToC::Get(self)->GetType();
|
||||
}
|
||||
|
||||
struct _cef_domnode_t* CEF_CALLBACK domdocument_get_document(
|
||||
struct _cef_domdocument_t* self)
|
||||
{
|
||||
DCHECK(self);
|
||||
if(!self)
|
||||
return NULL;
|
||||
|
||||
CefRefPtr<CefDOMNode> nodePtr =
|
||||
CefDOMDocumentCppToC::Get(self)->GetDocument();
|
||||
if (nodePtr.get())
|
||||
return CefDOMNodeCppToC::Wrap(nodePtr);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
struct _cef_domnode_t* CEF_CALLBACK domdocument_get_body(
|
||||
struct _cef_domdocument_t* self)
|
||||
{
|
||||
DCHECK(self);
|
||||
if(!self)
|
||||
return NULL;
|
||||
|
||||
CefRefPtr<CefDOMNode> nodePtr = CefDOMDocumentCppToC::Get(self)->GetBody();
|
||||
if (nodePtr.get())
|
||||
return CefDOMNodeCppToC::Wrap(nodePtr);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
struct _cef_domnode_t* CEF_CALLBACK domdocument_get_head(
|
||||
struct _cef_domdocument_t* self)
|
||||
{
|
||||
DCHECK(self);
|
||||
if(!self)
|
||||
return NULL;
|
||||
|
||||
CefRefPtr<CefDOMNode> elementPtr = CefDOMDocumentCppToC::Get(self)->GetHead();
|
||||
if (elementPtr.get())
|
||||
return CefDOMNodeCppToC::Wrap(elementPtr);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
cef_string_userfree_t CEF_CALLBACK domdocument_get_title(
|
||||
struct _cef_domdocument_t* self)
|
||||
{
|
||||
DCHECK(self);
|
||||
if(!self)
|
||||
return NULL;
|
||||
|
||||
CefString str = CefDOMDocumentCppToC::Get(self)->GetTitle();
|
||||
return str.DetachToUserFree();
|
||||
}
|
||||
|
||||
struct _cef_domnode_t* CEF_CALLBACK domdocument_get_element_by_id(
|
||||
struct _cef_domdocument_t* self, const cef_string_t* id)
|
||||
{
|
||||
DCHECK(self);
|
||||
DCHECK(id);
|
||||
if(!self || !id)
|
||||
return NULL;
|
||||
|
||||
CefRefPtr<CefDOMNode> elementPtr =
|
||||
CefDOMDocumentCppToC::Get(self)->GetElementById(CefString(id));
|
||||
if (elementPtr.get())
|
||||
return CefDOMNodeCppToC::Wrap(elementPtr);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
struct _cef_domnode_t* CEF_CALLBACK domdocument_get_focused_node(
|
||||
struct _cef_domdocument_t* self)
|
||||
{
|
||||
DCHECK(self);
|
||||
if(!self)
|
||||
return NULL;
|
||||
|
||||
CefRefPtr<CefDOMNode> elementPtr =
|
||||
CefDOMDocumentCppToC::Get(self)->GetFocusedNode();
|
||||
if (elementPtr.get())
|
||||
return CefDOMNodeCppToC::Wrap(elementPtr);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int CEF_CALLBACK domdocument_has_selection(struct _cef_domdocument_t* self)
|
||||
{
|
||||
DCHECK(self);
|
||||
if(!self)
|
||||
return NULL;
|
||||
|
||||
return CefDOMDocumentCppToC::Get(self)->HasSelection();
|
||||
}
|
||||
|
||||
struct _cef_domnode_t* CEF_CALLBACK domdocument_get_selection_start_node(
|
||||
struct _cef_domdocument_t* self)
|
||||
{
|
||||
DCHECK(self);
|
||||
if(!self)
|
||||
return NULL;
|
||||
|
||||
CefRefPtr<CefDOMNode> elementPtr =
|
||||
CefDOMDocumentCppToC::Get(self)->GetSelectionStartNode();
|
||||
if (elementPtr.get())
|
||||
return CefDOMNodeCppToC::Wrap(elementPtr);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int CEF_CALLBACK domdocument_get_selection_start_offset(
|
||||
struct _cef_domdocument_t* self)
|
||||
{
|
||||
DCHECK(self);
|
||||
if(!self)
|
||||
return NULL;
|
||||
|
||||
return CefDOMDocumentCppToC::Get(self)->GetSelectionStartOffset();
|
||||
}
|
||||
|
||||
struct _cef_domnode_t* CEF_CALLBACK domdocument_get_selection_end_node(
|
||||
struct _cef_domdocument_t* self)
|
||||
{
|
||||
DCHECK(self);
|
||||
if(!self)
|
||||
return NULL;
|
||||
|
||||
CefRefPtr<CefDOMNode> elementPtr =
|
||||
CefDOMDocumentCppToC::Get(self)->GetSelectionEndNode();
|
||||
if (elementPtr.get())
|
||||
return CefDOMNodeCppToC::Wrap(elementPtr);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int CEF_CALLBACK domdocument_get_selection_end_offset(
|
||||
struct _cef_domdocument_t* self)
|
||||
{
|
||||
DCHECK(self);
|
||||
if(!self)
|
||||
return NULL;
|
||||
|
||||
return CefDOMDocumentCppToC::Get(self)->GetSelectionEndOffset();
|
||||
}
|
||||
|
||||
cef_string_userfree_t CEF_CALLBACK domdocument_get_selection_as_markup(
|
||||
struct _cef_domdocument_t* self)
|
||||
{
|
||||
DCHECK(self);
|
||||
if(!self)
|
||||
return NULL;
|
||||
|
||||
CefString str = CefDOMDocumentCppToC::Get(self)->GetSelectionAsMarkup();
|
||||
return str.DetachToUserFree();
|
||||
}
|
||||
|
||||
cef_string_userfree_t CEF_CALLBACK domdocument_get_selection_as_text(
|
||||
struct _cef_domdocument_t* self)
|
||||
{
|
||||
DCHECK(self);
|
||||
if(!self)
|
||||
return NULL;
|
||||
|
||||
CefString str = CefDOMDocumentCppToC::Get(self)->GetSelectionAsText();
|
||||
return str.DetachToUserFree();
|
||||
}
|
||||
|
||||
cef_string_userfree_t CEF_CALLBACK domdocument_get_base_url(
|
||||
struct _cef_domdocument_t* self)
|
||||
{
|
||||
DCHECK(self);
|
||||
if(!self)
|
||||
return NULL;
|
||||
|
||||
CefString str = CefDOMDocumentCppToC::Get(self)->GetBaseURL();
|
||||
return str.DetachToUserFree();
|
||||
}
|
||||
|
||||
cef_string_userfree_t CEF_CALLBACK domdocument_get_complete_url(
|
||||
struct _cef_domdocument_t* self, const cef_string_t* partialURL)
|
||||
{
|
||||
DCHECK(self);
|
||||
if(!self)
|
||||
return NULL;
|
||||
|
||||
CefString str =
|
||||
CefDOMDocumentCppToC::Get(self)->GetCompleteURL(CefString(partialURL));
|
||||
return str.DetachToUserFree();
|
||||
}
|
||||
|
||||
|
||||
// CONSTRUCTOR - Do not edit by hand.
|
||||
|
||||
CefDOMDocumentCppToC::CefDOMDocumentCppToC(CefDOMDocument* cls)
|
||||
: CefCppToC<CefDOMDocumentCppToC, CefDOMDocument, cef_domdocument_t>(cls)
|
||||
{
|
||||
struct_.struct_.get_type = domdocument_get_type;
|
||||
struct_.struct_.get_document = domdocument_get_document;
|
||||
struct_.struct_.get_body = domdocument_get_body;
|
||||
struct_.struct_.get_head = domdocument_get_head;
|
||||
struct_.struct_.get_title = domdocument_get_title;
|
||||
struct_.struct_.get_element_by_id = domdocument_get_element_by_id;
|
||||
struct_.struct_.get_focused_node = domdocument_get_focused_node;
|
||||
struct_.struct_.has_selection = domdocument_has_selection;
|
||||
struct_.struct_.get_selection_start_node =
|
||||
domdocument_get_selection_start_node;
|
||||
struct_.struct_.get_selection_start_offset =
|
||||
domdocument_get_selection_start_offset;
|
||||
struct_.struct_.get_selection_end_node = domdocument_get_selection_end_node;
|
||||
struct_.struct_.get_selection_end_offset =
|
||||
domdocument_get_selection_end_offset;
|
||||
struct_.struct_.get_selection_as_markup = domdocument_get_selection_as_markup;
|
||||
struct_.struct_.get_selection_as_text = domdocument_get_selection_as_text;
|
||||
struct_.struct_.get_base_url = domdocument_get_base_url;
|
||||
struct_.struct_.get_complete_url = domdocument_get_complete_url;
|
||||
}
|
||||
|
||||
#ifdef _DEBUG
|
||||
template<> long CefCppToC<CefDOMDocumentCppToC, CefDOMDocument,
|
||||
cef_domdocument_t>::DebugObjCt = 0;
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user