Commit 556a9a41 authored by Yuhong Sha's avatar Yuhong Sha Committed by Commit Bot

Remove the trim operation for text node creation in xml tree.

Currently whitespaces can not be shown in the built-in XML Viewer.
It is proper to remove trim in text node creation for whitespaces show.

Bug: 736690
Signed-off-by: default avatarYuhong Sha <yuhong.sha@samsung.com>
Change-Id: I55ca0f61d76f3a45a9dabdd0b5805a2e895e1fc2
Reviewed-on: https://chromium-review.googlesource.com/950489
Commit-Queue: Kent Tamura <tkent@chromium.org>
Reviewed-by: default avatarKent Tamura <tkent@chromium.org>
Cr-Commit-Position: refs/heads/master@{#543342}
parent 34b4aa84
This XML file does not appear to have any style information associated with it. The document tree is shown below.
<foo>
<?xml-stylesheet
<?xml-stylesheet
href="resources/xml-stylesheet-pi-not-in-prolog.css" type="text/css"
?>
This tests that xml-stylesheet processing instructions have no effect when they're not in the prolog (before the root element). If this test is successful, this text should NOT have a black border.
......
This XML file does not appear to have any style information associated with it. The document tree is shown below.
<svg width="300" height="200">
<!-- note: no namespace, but sent as image/svg+xml -->
<!-- note: no namespace, but sent as image/svg+xml -->
<desc>There should be no red on this page.</desc>
<rect x="10" y="10" width="280" height="180" fill="red"/>
<!--
<!--
This document is either not SVG, or is SVG but is in error.
Section 5.1.1 of SVG 1.1 says:
# In all cases, for compliance with the "Namespaces in XML"
......
This XML file does not appear to have any style information associated with it. The document tree is shown below.
<svg xmlns="http://www.example.org/" width="300" height="200">
<!-- wrong namespace, but sent as image/svg+xml -->
<!-- wrong namespace, but sent as image/svg+xml -->
<desc>There should be no red on this page.</desc>
<rect x="10" y="10" width="280" height="180" fill="red"/>
</svg>
Tests leading and trailing whitespaces in xml viewer.
SUCCESS
<html>
<head>
<script>
if (window.testRunner) {
testRunner.dumpAsText();
testRunner.setCanOpenWindows();
testRunner.waitUntilDone();
}
var xmlWindow;
function print(str)
{
document.getElementById('output').textContent = str;
xmlWindow.close();
testRunner.notifyDone();
}
function checkWhiteSpaces()
{
var sourcePretty = xmlWindow.document.getElementsByClassName("pretty-print")[0];
if (!sourcePretty || !sourcePretty.innerText) {
requestAnimationFrame(checkWhiteSpaces);
return;
}
if (sourcePretty.innerText.includes(" bar "))
print('SUCCESS');
else
print('FAIL');
}
function onload()
{
xmlWindow = window.open('resources/leading-and-trailing-whitespaces.xml', "XMLViewerTestWindow");
xmlWindow.onload = checkWhiteSpaces;
}
</script>
</head>
<body onload="onload();">
<p>Tests leading and trailing whitespaces in xml viewer.</p>
<div id='output'></div>
</body>
</html>
......@@ -271,7 +271,7 @@ function createComment(commentString)
function createText(value)
{
var text = createHTMLElement('span');
text.textContent = trim(value);
text.textContent = value;
text.classList.add('text');
return text;
}
......
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