Skip to content
Permalink
Browse files
2011-02-25 Vsevolod Vlasov <vsevik@chromium.org>
        Reviewed by Pavel Feldman.

        XML without style should render as syntax-highlighted source.
        https://bugs.webkit.org/show_bug.cgi?id=13807

        Added tests for XML tree view mode. Testing both logic for entering
        XML tree view mode and rendering itself.

        * http/tests/xmlviewer/dumpAsText/css-stylesheet-expected.txt: Added.
        * http/tests/xmlviewer/dumpAsText/css-stylesheet.xml: Added.
        * http/tests/xmlviewer/dumpAsText/frames-expected.txt: Added.
        * http/tests/xmlviewer/dumpAsText/frames.html: Added.
        * http/tests/xmlviewer/dumpAsText/mathml-expected.txt: Added.
        * http/tests/xmlviewer/dumpAsText/mathml.xml: Added.
        * http/tests/xmlviewer/dumpAsText/resources/css-stylesheet.css: Added.
        (assertion):
        * http/tests/xmlviewer/dumpAsText/resources/frames-helper.xml: Added.
        * http/tests/xmlviewer/dumpAsText/resources/xsl.xml: Added.
        * http/tests/xmlviewer/dumpAsText/svg-expected.txt: Added.
        * http/tests/xmlviewer/dumpAsText/svg.xml: Added.
        * http/tests/xmlviewer/dumpAsText/wml-expected.txt: Added.
        * http/tests/xmlviewer/dumpAsText/wml.xml: Added.
        * http/tests/xmlviewer/dumpAsText/xhtml-tag-expected.txt: Added.
        * http/tests/xmlviewer/dumpAsText/xhtml-tag.xml: Added.
        * http/tests/xmlviewer/dumpAsText/xlink-expected.txt: Added.
        * http/tests/xmlviewer/dumpAsText/xlink.xml: Added.
        * http/tests/xmlviewer/dumpAsText/xmlviewer-charset-cp1251-expected.txt: Added.
        * http/tests/xmlviewer/dumpAsText/xmlviewer-charset-cp1251.xml: Added.
        * http/tests/xmlviewer/dumpAsText/xmlviewer-charset-utf8-expected.txt: Added.
        * http/tests/xmlviewer/dumpAsText/xmlviewer-charset-utf8.xml: Added.
        * http/tests/xmlviewer/dumpAsText/xmlviewer-expected.txt: Added.
        * http/tests/xmlviewer/dumpAsText/xmlviewer.xml: Added.
        * http/tests/xmlviewer/dumpAsText/xsl-stylesheet-expected.txt: Added.
        * http/tests/xmlviewer/dumpAsText/xsl-stylesheet.xml: Added.
        * http/tests/xmlviewer/dumpAsText/xul-expected.txt: Added.
        * http/tests/xmlviewer/dumpAsText/xul.xml: Added.
        * platform/chromium/http/tests/xmlviewer/dumpAsText/mathml-expected.txt: Added.
2011-02-25  Vsevolod Vlasov  <vsevik@chromium.org>

        Reviewed by Pavel Feldman.

        XML without style should render as syntax-highlighted source.
        https://bugs.webkit.org/show_bug.cgi?id=13807

        XML tree view mode implemented. If XML does not have any style
        information, it is rendered as highlighted source with collapsable
        elements.

        Tests: http/tests/xmlviewer/dumpAsText/css-stylesheet.xml
               http/tests/xmlviewer/dumpAsText/frames.html
               http/tests/xmlviewer/dumpAsText/mathml.xml
               http/tests/xmlviewer/dumpAsText/svg.xml
               http/tests/xmlviewer/dumpAsText/wml.xml
               http/tests/xmlviewer/dumpAsText/xhtml-tag.xml
               http/tests/xmlviewer/dumpAsText/xlink.xml
               http/tests/xmlviewer/dumpAsText/xmlviewer-charset-cp1251.xml
               http/tests/xmlviewer/dumpAsText/xmlviewer-charset-utf8.xml
               http/tests/xmlviewer/dumpAsText/xmlviewer.xml
               http/tests/xmlviewer/dumpAsText/xsl-stylesheet.xml
               http/tests/xmlviewer/dumpAsText/xul.xml

        * CMakeLists.txt:
        * DerivedSources.make:
        * GNUmakefile.am:
        * WebCore.gyp/WebCore.gyp:
        * WebCore.gypi:
        * WebCore.vcproj/WebCore.vcproj:
        * WebCore.xcodeproj/project.pbxproj:
        * css/CSSStyleSelector.cpp:
        (WebCore::CSSStyleSelector::matchUARules):
        * dom/Document.cpp:
        (WebCore::Document::Document):
        (WebCore::Document::createElement):
        * dom/Document.h:
        (WebCore::Document::usesViewSourceStyles):
        (WebCore::Document::setUsesViewSourceStyles):
        (WebCore::Document::sawElementsInKnownNamespaces):
        * dom/XMLDocumentParser.h:
        * dom/XMLDocumentParserLibxml2.cpp:
        (WebCore::XMLDocumentParser::XMLDocumentParser):
        (WebCore::XMLDocumentParser::processingInstruction):
        (WebCore::XMLDocumentParser::initializeParserContext):
        (WebCore::XMLDocumentParser::doEnd):
        * dom/XMLDocumentParserQt.cpp:
        (WebCore::XMLDocumentParser::XMLDocumentParser):
        (WebCore::XMLDocumentParser::initializeParserContext):
        (WebCore::XMLDocumentParser::parseProcessingInstruction):
        * html/HTMLViewSourceDocument.cpp:
        (WebCore::HTMLViewSourceDocument::HTMLViewSourceDocument):
        * xml/XMLTreeViewer.cpp: Added.
        (WebCore::XMLTreeViewer::XMLTreeViewer):
        (WebCore::XMLTreeViewer::hasNoStyleInformation):
        (WebCore::XMLTreeViewer::transformDocumentToTreeView):
        * xml/XMLTreeViewer.h: Added.
        (WebCore::XMLTreeViewer::~XMLTreeViewer):
        * xml/XMLViewer.xsl: Added.
        * xml/XSLStyleSheet.h:
        (WebCore::XSLStyleSheet::createFromString):

Canonical link: https://commits.webkit.org/69716@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@79799 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
pavelfeldman committed Feb 26, 2011
1 parent b4a3d15 commit 24f224f60b3df91c715c76111f1ffb5f4cfd210f
Showing 48 changed files with 1,052 additions and 12 deletions.
@@ -1,3 +1,43 @@
2011-02-25 Vsevolod Vlasov <vsevik@chromium.org>

Reviewed by Pavel Feldman.

XML without style should render as syntax-highlighted source.
https://bugs.webkit.org/show_bug.cgi?id=13807

Added tests for XML tree view mode. Testing both logic for entering
XML tree view mode and rendering itself.

* http/tests/xmlviewer/dumpAsText/css-stylesheet-expected.txt: Added.
* http/tests/xmlviewer/dumpAsText/css-stylesheet.xml: Added.
* http/tests/xmlviewer/dumpAsText/frames-expected.txt: Added.
* http/tests/xmlviewer/dumpAsText/frames.html: Added.
* http/tests/xmlviewer/dumpAsText/mathml-expected.txt: Added.
* http/tests/xmlviewer/dumpAsText/mathml.xml: Added.
* http/tests/xmlviewer/dumpAsText/resources/css-stylesheet.css: Added.
(assertion):
* http/tests/xmlviewer/dumpAsText/resources/frames-helper.xml: Added.
* http/tests/xmlviewer/dumpAsText/resources/xsl.xml: Added.
* http/tests/xmlviewer/dumpAsText/svg-expected.txt: Added.
* http/tests/xmlviewer/dumpAsText/svg.xml: Added.
* http/tests/xmlviewer/dumpAsText/wml-expected.txt: Added.
* http/tests/xmlviewer/dumpAsText/wml.xml: Added.
* http/tests/xmlviewer/dumpAsText/xhtml-tag-expected.txt: Added.
* http/tests/xmlviewer/dumpAsText/xhtml-tag.xml: Added.
* http/tests/xmlviewer/dumpAsText/xlink-expected.txt: Added.
* http/tests/xmlviewer/dumpAsText/xlink.xml: Added.
* http/tests/xmlviewer/dumpAsText/xmlviewer-charset-cp1251-expected.txt: Added.
* http/tests/xmlviewer/dumpAsText/xmlviewer-charset-cp1251.xml: Added.
* http/tests/xmlviewer/dumpAsText/xmlviewer-charset-utf8-expected.txt: Added.
* http/tests/xmlviewer/dumpAsText/xmlviewer-charset-utf8.xml: Added.
* http/tests/xmlviewer/dumpAsText/xmlviewer-expected.txt: Added.
* http/tests/xmlviewer/dumpAsText/xmlviewer.xml: Added.
* http/tests/xmlviewer/dumpAsText/xsl-stylesheet-expected.txt: Added.
* http/tests/xmlviewer/dumpAsText/xsl-stylesheet.xml: Added.
* http/tests/xmlviewer/dumpAsText/xul-expected.txt: Added.
* http/tests/xmlviewer/dumpAsText/xul.xml: Added.
* platform/chromium/http/tests/xmlviewer/dumpAsText/mathml-expected.txt: Added.

2011-02-26 Adam Klein <adamk@chromium.org>

Reviewed by James Robinson.
@@ -0,0 +1 @@
This tests that xml viewer is not used when there is a CSS stylesheet. This text should be green. SUCCESS
@@ -0,0 +1,7 @@
<!-- If you can see this, this test has failed. -->
<?xml-stylesheet href="resources/css-stylesheet.css"?>
<FAIL xmlns="http://unknown.example.org/">
<header>This tests that xml viewer is not used when there is a CSS stylesheet.</header>
<assertion>This text should be green.</assertion>
SUCCESS
</FAIL>
@@ -0,0 +1,12 @@
This tests that XML Viewer is not used when XML is opened in frame.


--------
Frame: 'iframeFrame'
--------
SUCCESS

--------
Frame: 'objectFrame'
--------
SUCCESS
@@ -0,0 +1,19 @@
<html>
<head>
<script type="text/javascript">
function onload() {
if (window.layoutTestController) {
layoutTestController.dumpAsText();
layoutTestController.dumpChildFramesAsText();
}
}
</script>
</head>
<body onload="onload()">
<div>
This tests that XML Viewer is not used when XML is opened in frame.
</div>
<iframe name="iframeFrame" style="border:10px solid gray;padding:25px" width="300" height="200" src="resources/frames-helper.xml"></iframe>
<object name="objectFrame" style="border:10px solid gray;padding:25px; width:300px; height:200px" data="resources/frames-helper.xml"></object>
</body>
</html>
@@ -0,0 +1 @@
This tests that xml viewer is not used when there is a tag in MATHML namespace. SUCCESS
@@ -0,0 +1,10 @@
<!-- If you can see this, this test has failed, except if you are
not using a MathML-aware client. -->
<FAIL xmlns:a="http://www.w3.org/1998/Math/MathML">
<header>This tests that xml viewer is not used when there is a tag in MATHML namespace.</header>
<a:math>
<a:mrow>
<a:mi>SUCCESS</a:mi>
</a:mrow>
</a:math>
</FAIL>
@@ -0,0 +1 @@
assertion { color: green; }
@@ -0,0 +1,5 @@
<!-- If you can see this, this test has failed. -->
<page>
<FAIL/>
<text>SUCCESS</text>
</page>
@@ -0,0 +1,11 @@
<?xml version='1.0' encoding='utf-8'?>
<xsl:stylesheet version="1.0"
id="stylesheet"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<FAIL>
<header>This tests that xml viewer is not used when there is an XSL stylesheet.</header>
SUCCESS
</FAIL>
</xsl:template>
</xsl:stylesheet>
@@ -0,0 +1,3 @@
This tests that xml viewer is not used when there is a tag in SVG namespace.
SUCCESS

@@ -0,0 +1,9 @@
<!-- If you can see this, this test has failed, except if you are
not using an SVG-aware client. -->
<root>
<header>This tests that xml viewer is not used when there is a tag in SVG namespace.</header>
<FAIL/>
<svg:svg xmlns:svg="http://www.w3.org/2000/svg"x="20" y="20" font-size="20">
<svg:text y="20" font-size="20">SUCCESS</svg:text>
</svg:svg>
</root>
@@ -0,0 +1,15 @@
This XML file does not appear to have any style information associated with it. The document tree is shown below.
<!--
If you can see this, this test has failed, except if you are not using a WML-aware client.
-->
<?sds erfe?>
<wml>
<header>
This tests that xml viewer is not used for documents with WML doctype.
</header>
<card id="card1" title="Card 1">
<FAIL/>
<p>SUCCESS</p>
</card>
</wml>

@@ -0,0 +1,11 @@
<!-- If you can see this, this test has failed, except if you are
not using a WML-aware client. -->
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml">
<?sds erfe?>
<wml>
<header>This tests that xml viewer is not used for documents with WML doctype.</header>
<card id="card1" title="Card 1">
<FAIL/>
<p>SUCCESS</p>
</card>
</wml>
@@ -0,0 +1,3 @@
This tests that xml viewer is not used when there is a tag in XHTML namespace.
This should be green.
SUCCESS
@@ -0,0 +1,17 @@
<!-- If you can see this this test has failed-->
<page xmlns:xhtml="http://www.w3.org/1999/xhtml">
<header>This tests that xml viewer is not used when there is a tag in XHTML namespace.</header>
<FAIL/>
<xhtml:div style="color:green" id="green">This should be green.</xhtml:div>
<xhtml:div id="success"></xhtml:div>

<xhtml:script type="text/javascript">
<![CDATA[
if (window.layoutTestController)
layoutTestController.dumpAsText();
if (document.getElementById("green").style.color == "green")
document.getElementById('success').textContent = "SUCCESS";
]]>
</xhtml:script>
</page>
@@ -0,0 +1,10 @@
This XML file does not appear to have any style information associated with it. The document tree is shown below.
<!-- If you can see this, this test has failed. -->
<test>
<header>
This tests that xml viewer is not used when there is an attribute XLink namespace.
</header>
<FAIL/>
<xlink l:type="simple" l:href="xlink.xml">SUCCESS</xlink>
</test>

@@ -0,0 +1,6 @@
<!-- If you can see this, this test has failed. -->
<test xmlns="http://still-unknown.example.org/">
<header>This tests that xml viewer is not used when there is an attribute XLink namespace.</header>
<FAIL/>
<xlink l:type="simple" l:href="xlink.xml" xmlns:l="http://www.w3.org/1999/xlink">SUCCESS</xlink>
</test>
@@ -0,0 +1,5 @@
This XML file does not appear to have any style information associated with it. The document tree is shown below.
<root>
<cp1251>SUССЕSS - These 'CCE' are cyrillic letters.</cp1251>
</root>

@@ -0,0 +1,4 @@
<?xml version='1.0' encoding='cp1251'?>
<root>
<cp1251>SUÑÑÅSS - These 'CCE' are cyrillic letters.</cp1251>
</root>
@@ -0,0 +1,5 @@
This XML file does not appear to have any style information associated with it. The document tree is shown below.
<root>
<utf8>SUССЕSS - These 'CCE' are cyrillic letters.</utf8>
</root>

@@ -0,0 +1,4 @@
<?xml version='1.0' encoding='utf-8'?>
<root>
<utf8>SUССЕSS - These 'CCE' are cyrillic letters.</utf8>
</root>
@@ -0,0 +1,31 @@
This XML file does not appear to have any style information associated with it. The document tree is shown below.
<?some-short-processing-instruction short-params?>
<?some-long-processing-instruction
The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
?>
<root-tag-with-mixed-content>
<empty-tag/>
<empty-tag-with-attributes attr1="value" attr2="" attr3="some-long-value with two words"/>
<another-empty-tag/>
<another-empty-tag-with-attributes attr1="value" attr2="" attr3="some-long-value with two words"/>
<tag-with-short-text>Some short text</tag-with-short-text>
<tag-with-short-text-and-attrs attr1="value" attr2="" attr3="some-long-value with two words">Some short text</tag-with-short-text-and-attrs>
<tag-with-long-text>
The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
</tag-with-long-text>
<tag-with-long-text-and-attrs attr1="value" attr2="" attr3="some-long-value with two words">
The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
</tag-with-long-text-and-attrs>
And now some text in root element. And now some other text in root element.
<!-- some short comment -->
And now some long text in root element. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
<!--
some long comment The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
-->
<tag-with-short-cdata> some short text </tag-with-short-cdata>
<tag-with-long-cdata>
The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
</tag-with-long-cdata>
<ns:tag-with-some-namespace/>
</root-tag-with-mixed-content>

0 comments on commit 24f224f

Please sign in to comment.