This source file includes following definitions.
- transformDocumentToTreeView
#include "config.h"
#include "core/xml/XMLTreeViewer.h"
#include "XMLViewerCSS.h"
#include "XMLViewerJS.h"
#include "bindings/v8/ExceptionStatePlaceholder.h"
#include "bindings/v8/ScriptController.h"
#include "bindings/v8/ScriptSourceCode.h"
#include "core/dom/Document.h"
#include "core/dom/Element.h"
#include "core/dom/Text.h"
#include "core/frame/LocalFrame.h"
using namespace std;
namespace WebCore {
XMLTreeViewer::XMLTreeViewer(Document* document)
: m_document(document)
{
}
void XMLTreeViewer::transformDocumentToTreeView()
{
m_document->setIsViewSource(true);
String scriptString(reinterpret_cast<const char*>(XMLViewer_js), sizeof(XMLViewer_js));
m_document->frame()->script().executeScriptInMainWorld(scriptString, ScriptController::ExecuteScriptWhenScriptsDisabled);
String noStyleMessage("This XML file does not appear to have any style information associated with it. The document tree is shown below.");
m_document->frame()->script().executeScriptInMainWorld("prepareWebKitXMLViewer('" + noStyleMessage + "');", ScriptController::ExecuteScriptWhenScriptsDisabled);
String cssString(reinterpret_cast<const char*>(XMLViewer_css), sizeof(XMLViewer_css));
RefPtr<Text> text = m_document->createTextNode(cssString);
m_document->getElementById("xml-viewer-style")->appendChild(text, IGNORE_EXCEPTION);
}
}