Add direct DOM access (issue #511).

git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@610 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
Marshall Greenblatt
2012-04-27 21:19:06 +00:00
parent 4fe0ddf640
commit db3a9817ed
58 changed files with 5089 additions and 7 deletions

View File

@ -8,6 +8,7 @@
#include "libcef/common/http_header_utils.h"
#include "libcef/common/request_impl.h"
#include "libcef/renderer/browser_impl.h"
#include "libcef/renderer/dom_document_impl.h"
#include "libcef/renderer/thread_util.h"
#include "libcef/renderer/v8_impl.h"
#include "libcef/renderer/webkit_glue.h"
@ -240,6 +241,25 @@ CefRefPtr<CefV8Context> CefFrameImpl::GetV8Context() {
}
}
void CefFrameImpl::VisitDOM(CefRefPtr<CefDOMVisitor> visitor) {
CEF_REQUIRE_RT_RETURN_VOID();
if (!frame_)
return;
// Create a CefDOMDocumentImpl object that is valid only for the scope of this
// method.
CefRefPtr<CefDOMDocumentImpl> documentImpl;
const WebKit::WebDocument& document = frame_->document();
if (!document.isNull())
documentImpl = new CefDOMDocumentImpl(browser_, frame_);
visitor->Visit(documentImpl.get());
if (documentImpl.get())
documentImpl->Detach();
}
void CefFrameImpl::Detach() {
browser_ = NULL;
frame_ = NULL;