Commit e9ec525a authored by vivek.vg@samsung.com's avatar vivek.vg@samsung.com

[Blink] XMLTreeViewer should load resources from blink_resources.grd instead...

[Blink] XMLTreeViewer should load resources from blink_resources.grd instead of relying upon xxd.py (Part-2)

Blink should make use of blink_resources.grd for the inline resources for displaying XML tree view.
This removes the dependency upon using xxd.py which embeds the resources as strings.

BUG=312586

Review URL: https://codereview.chromium.org/391963002

git-svn-id: svn://svn.chromium.org/blink/trunk@178522 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent c2548b8f
...@@ -562,8 +562,6 @@ action("generated_testing_idls_internal_runtime_flags") { ...@@ -562,8 +562,6 @@ action("generated_testing_idls_internal_runtime_flags") {
group("make_core_generated") { group("make_core_generated") {
deps = [ deps = [
":make_core_generated_private_script", ":make_core_generated_private_script",
":make_core_generated_xml_viewer_css",
":make_core_generated_xml_viewer_js",
":make_core_generated_html_entity_table", ":make_core_generated_html_entity_table",
":make_core_generated_css_property_names", ":make_core_generated_css_property_names",
":make_core_generated_media_feature_names", ":make_core_generated_media_feature_names",
...@@ -971,48 +969,6 @@ action("make_core_generated_private_script_for_testing") { ...@@ -971,48 +969,6 @@ action("make_core_generated_private_script_for_testing") {
deps = make_core_generated_deps deps = make_core_generated_deps
} }
# "generateXMLViewerCSS" in make_core_generated from GYP.
action("make_core_generated_xml_viewer_css") {
visibility = ":make_core_generated"
script = "../build/scripts/xxd.py"
inputs = [
"xml/XMLViewer.css",
]
outputs = [
"$blink_core_output_dir/XMLViewerCSS.h",
]
args = [
"XMLViewer_css",
rebase_path(inputs[0], root_build_dir),
rebase_path(outputs[0], root_build_dir),
]
deps = make_core_generated_deps
}
# "generateXMLViewerJS" in make_core_generated from GYP.
action("make_core_generated_xml_viewer_js") {
visibility = ":make_core_generated"
script = "../build/scripts/xxd.py"
inputs = [
"xml/XMLViewer.js",
]
outputs = [
"$blink_core_output_dir/XMLViewerJS.h",
]
args = [
"XMLViewer_js",
rebase_path(inputs[0], root_build_dir),
rebase_path(outputs[0], root_build_dir),
]
deps = make_core_generated_deps
}
# "HTMLEntityTable" in make_core_generated from GYP. # "HTMLEntityTable" in make_core_generated from GYP.
action("make_core_generated_html_entity_table") { action("make_core_generated_html_entity_table") {
visibility = ":make_core_generated" visibility = ":make_core_generated"
......
...@@ -185,38 +185,6 @@ ...@@ -185,38 +185,6 @@
'<@(_private_script_files)' '<@(_private_script_files)'
], ],
}, },
{
'action_name': 'generateXMLViewerCSS',
'inputs': [
'xml/XMLViewer.css',
],
'outputs': [
'<(blink_core_output_dir)/XMLViewerCSS.h',
],
'action': [
'python',
'../build/scripts/xxd.py',
'XMLViewer_css',
'<@(_inputs)',
'<@(_outputs)'
],
},
{
'action_name': 'generateXMLViewerJS',
'inputs': [
'xml/XMLViewer.js',
],
'outputs': [
'<(blink_core_output_dir)/XMLViewerJS.h',
],
'action': [
'python',
'../build/scripts/xxd.py',
'XMLViewer_js',
'<@(_inputs)',
'<@(_outputs)'
],
},
{ {
'action_name': 'HTMLEntityTable', 'action_name': 'HTMLEntityTable',
'inputs': [ 'inputs': [
......
...@@ -32,12 +32,11 @@ ...@@ -32,12 +32,11 @@
#include "bindings/core/v8/ExceptionStatePlaceholder.h" #include "bindings/core/v8/ExceptionStatePlaceholder.h"
#include "bindings/core/v8/ScriptController.h" #include "bindings/core/v8/ScriptController.h"
#include "bindings/core/v8/ScriptSourceCode.h" #include "bindings/core/v8/ScriptSourceCode.h"
#include "core/XMLViewerCSS.h"
#include "core/XMLViewerJS.h"
#include "core/dom/Document.h" #include "core/dom/Document.h"
#include "core/dom/Element.h" #include "core/dom/Element.h"
#include "core/dom/Text.h" #include "core/dom/Text.h"
#include "core/frame/LocalFrame.h" #include "core/frame/LocalFrame.h"
#include "public/platform/Platform.h"
namespace blink { namespace blink {
...@@ -48,13 +47,18 @@ XMLTreeViewer::XMLTreeViewer(Document* document) ...@@ -48,13 +47,18 @@ XMLTreeViewer::XMLTreeViewer(Document* document)
void XMLTreeViewer::transformDocumentToTreeView() void XMLTreeViewer::transformDocumentToTreeView()
{ {
const blink::WebData& xmlViewerJSResource = blink::Platform::current()->loadResource("XMLViewer.js");
const blink::WebData& xmlViewerCSSResource = blink::Platform::current()->loadResource("XMLViewer.css");
if (xmlViewerJSResource.isEmpty() || xmlViewerCSSResource.isEmpty())
return;
m_document->setIsViewSource(true); m_document->setIsViewSource(true);
String scriptString(reinterpret_cast<const char*>(XMLViewer_js), sizeof(XMLViewer_js)); String scriptString(xmlViewerJSResource.data(), xmlViewerJSResource.size());
m_document->frame()->script().executeScriptInMainWorld(scriptString, ScriptController::ExecuteScriptWhenScriptsDisabled); 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."); 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); m_document->frame()->script().executeScriptInMainWorld("prepareWebKitXMLViewer('" + noStyleMessage + "');", ScriptController::ExecuteScriptWhenScriptsDisabled);
String cssString(reinterpret_cast<const char*>(XMLViewer_css), sizeof(XMLViewer_css)); String cssString(xmlViewerCSSResource.data(), xmlViewerCSSResource.size());
m_document->getElementById("xml-viewer-style")->appendChild(m_document->createTextNode(cssString), IGNORE_EXCEPTION); m_document->getElementById("xml-viewer-style")->appendChild(m_document->createTextNode(cssString), IGNORE_EXCEPTION);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment