LayoutTests/ChangeLog

 12011-02-16 Vsevolod Vlasov <vsevik@chromium.org>
 2
 3 Reviewed by NOBODY (OOPS!).
 4
 5 XML without style should render as syntax-highlighted source
 6 https://bugs.webkit.org/show_bug.cgi?id=13807
 7
 8 * http/tests/xmlviewer/dumpAsText/css-stylesheet-expected.txt: Added.
 9 * http/tests/xmlviewer/dumpAsText/css-stylesheet.xml: Added.
 10 * http/tests/xmlviewer/dumpAsText/frames-expected.txt: Added.
 11 * http/tests/xmlviewer/dumpAsText/frames.html: Added.
 12 * http/tests/xmlviewer/dumpAsText/mathml-expected.txt: Added.
 13 * http/tests/xmlviewer/dumpAsText/mathml.xml: Added.
 14 * http/tests/xmlviewer/dumpAsText/resources/css-stylesheet.css: Added.
 15 (assertion):
 16 * http/tests/xmlviewer/dumpAsText/resources/frames-helper.xml: Added.
 17 * http/tests/xmlviewer/dumpAsText/svg-expected.txt: Added.
 18 * http/tests/xmlviewer/dumpAsText/svg.xml: Added.
 19 * http/tests/xmlviewer/dumpAsText/wml-expected.txt: Added.
 20 * http/tests/xmlviewer/dumpAsText/wml.xml: Added.
 21 * http/tests/xmlviewer/dumpAsText/xhtml-tag-expected.txt: Added.
 22 * http/tests/xmlviewer/dumpAsText/xhtml-tag.xml: Added.
 23 * http/tests/xmlviewer/dumpAsText/xlink-expected.txt: Added.
 24 * http/tests/xmlviewer/dumpAsText/xlink.xml: Added.
 25 * http/tests/xmlviewer/dumpAsText/xmlviewer-expected.txt: Added.
 26 * http/tests/xmlviewer/dumpAsText/xmlviewer.xml: Added.
 27 * http/tests/xmlviewer/dumpAsText/xsl-stylesheet-expected.txt: Added.
 28 * http/tests/xmlviewer/dumpAsText/xsl-stylesheet.xml: Added.
 29 * http/tests/xmlviewer/dumpAsText/xul-expected.txt: Added.
 30 * http/tests/xmlviewer/dumpAsText/xul.xml: Added.
 31 * platform/chromium/http/tests/xmlviewer/dumpAsText/mathml-expected.txt: Added.
 32
1332011-02-15 Kent Tamura <tkent@chromium.org>
234
335 Unreviewed, test expectation update.

LayoutTests/http/tests/xmlviewer/dumpAsText/css-stylesheet-expected.txt

 1This tests that xml viewer is not used when there is a CSS stylesheet. This text should be green. SUCCESS

LayoutTests/http/tests/xmlviewer/dumpAsText/css-stylesheet.xml

 1<!-- If you can see this, this test has failed. -->
 2<?xml-stylesheet href="resources/css-stylesheet.css"?>
 3<FAIL xmlns="http://unknown.example.org/">
 4 <header>This tests that xml viewer is not used when there is a CSS stylesheet.</header>
 5 <assertion>This text should be green.</assertion>
 6 SUCCESS
 7</FAIL>

LayoutTests/http/tests/xmlviewer/dumpAsText/frames-expected.txt

 1This tests that XML Viewer is not used when XML is opened in frame.
 2
 3
 4--------
 5Frame: 'iframeFrame'
 6--------
 7SUCCESS
 8
 9--------
 10Frame: 'objectFrame'
 11--------
 12SUCCESS

LayoutTests/http/tests/xmlviewer/dumpAsText/frames.html

 1<html>
 2<head>
 3 <script type="text/javascript">
 4 function onload() {
 5 if (window.layoutTestController) {
 6 layoutTestController.dumpAsText();
 7 layoutTestController.dumpChildFramesAsText();
 8 }
 9 }
 10 </script>
 11</head>
 12<body onload="onload()">
 13<div>
 14This tests that XML Viewer is not used when XML is opened in frame.
 15</div>
 16<iframe name="iframeFrame" style="border:10px solid gray;padding:25px" width="300" height="200" src="resources/frames-helper.xml"></iframe>
 17<object name="objectFrame" style="border:10px solid gray;padding:25px; width:300px; height:200px" data="resources/frames-helper.xml"></object>
 18</body>
 19</html>

LayoutTests/http/tests/xmlviewer/dumpAsText/mathml-expected.txt

 1This tests that xml viewer is not used when there is a tag in MATHML namespace. SUCCESS

LayoutTests/http/tests/xmlviewer/dumpAsText/mathml.xml

 1<!-- If you can see this, this test has failed, except if you are
 2 not using a MathML-aware client. -->
 3<FAIL xmlns:a="http://www.w3.org/1998/Math/MathML">
 4 <header>This tests that xml viewer is not used when there is a tag in MATHML namespace.</header>
 5 <a:math>
 6 <a:mrow>
 7 <a:mi>SUCCESS</a:mi>
 8 </a:mrow>
 9 </a:math>
 10</FAIL>

LayoutTests/http/tests/xmlviewer/dumpAsText/resources/css-stylesheet.css

 1assertion { color: green; }
02\ No newline at end of file

LayoutTests/http/tests/xmlviewer/dumpAsText/resources/frames-helper.xml

 1<!-- If you can see this, this test has failed. -->
 2<page>
 3<FAIL/>
 4<text>SUCCESS</text>
 5</page>

LayoutTests/http/tests/xmlviewer/dumpAsText/svg-expected.txt

 1This tests that xml viewer is not used when there is a tag in SVG namespace.
 2SUCCESS
 3

LayoutTests/http/tests/xmlviewer/dumpAsText/svg.xml

 1<!-- If you can see this, this test has failed, except if you are
 2 not using an SVG-aware client. -->
 3<root>
 4 <header>This tests that xml viewer is not used when there is a tag in SVG namespace.</header>
 5 <FAIL/>
 6 <svg:svg xmlns:svg="http://www.w3.org/2000/svg"x="20" y="20" font-size="20">
 7 <svg:text y="20" font-size="20">SUCCESS</svg:text>
 8 </svg:svg>
 9</root>

LayoutTests/http/tests/xmlviewer/dumpAsText/wml-expected.txt

 1This XML file does not have any style information. The document tree is shown.
 2<!--
 3If you can see this, this test has failed, except if you are not using a WML-aware client.
 4-->
 5<?sds erfe?>
 6<wml>
 7<header>
 8This tests that xml viewer is not used for documents with WML doctype.
 9</header>
 10<card id="card1" title="Card 1">
 11<FAIL/>
 12<p>SUCCESS</p>
 13</card>
 14</wml>
 15

LayoutTests/http/tests/xmlviewer/dumpAsText/wml.xml

 1<!-- If you can see this, this test has failed, except if you are
 2 not using a WML-aware client. -->
 3<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml">
 4<?sds erfe?>
 5<wml>
 6 <header>This tests that xml viewer is not used for documents with WML doctype.</header>
 7 <card id="card1" title="Card 1">
 8 <FAIL/>
 9 <p>SUCCESS</p>
 10 </card>
 11</wml>

LayoutTests/http/tests/xmlviewer/dumpAsText/xhtml-tag-expected.txt

 1This tests that xml viewer is not used when there is a tag in XHTML namespace.
 2This should be green.
 3SUCCESS

LayoutTests/http/tests/xmlviewer/dumpAsText/xhtml-tag.xml

 1<!-- If you can see this this test has failed-->
 2<page xmlns:xhtml="http://www.w3.org/1999/xhtml">
 3 <header>This tests that xml viewer is not used when there is a tag in XHTML namespace.</header>
 4 <FAIL/>
 5 <xhtml:div style="color:green" id="green">This should be green.</xhtml:div>
 6 <xhtml:div id="success"></xhtml:div>
 7
 8 <xhtml:script type="text/javascript">
 9 <![CDATA[
 10 if (window.layoutTestController)
 11 layoutTestController.dumpAsText();
 12
 13 if (document.getElementById("green").style.color == "green")
 14 document.getElementById('success').textContent = "SUCCESS";
 15 ]]>
 16 </xhtml:script>
 17</page>

LayoutTests/http/tests/xmlviewer/dumpAsText/xlink-expected.txt

 1This XML file does not have any style information. The document tree is shown.
 2<!-- If you can see this, this test has failed. -->
 3<test>
 4<header>
 5This tests that xml viewer is not used when there is an attribute XLink namespace.
 6</header>
 7<FAIL/>
 8<xlink l:type="simple" l:href="xlink.xml">SUCCESS</xlink>
 9</test>
 10

LayoutTests/http/tests/xmlviewer/dumpAsText/xlink.xml

 1<!-- If you can see this, this test has failed. -->
 2<test xmlns="http://still-unknown.example.org/">
 3 <header>This tests that xml viewer is not used when there is an attribute XLink namespace.</header>
 4 <FAIL/>
 5 <xlink l:type="simple" l:href="xlink.xml" xmlns:l="http://www.w3.org/1999/xlink">SUCCESS</xlink>
 6</test>

LayoutTests/http/tests/xmlviewer/dumpAsText/xmlviewer-expected.txt

 1This XML file does not have any style information. The document tree is shown.
 2<?some-short-processing-instruction short-params?>
 3<?some-long-processing-instruction
 4The 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.
 5?>
 6<root-tag-with-mixed-content>
 7<empty-tag/>
 8<empty-tag-with-attributes attr1="value" attr2="" attr3="some-long-value with two words"/>
 9<another-empty-tag/>
 10<another-empty-tag-with-attributes attr1="value" attr2="" attr3="some-long-value with two words"/>
 11<tag-with-short-text>Some short text</tag-with-short-text>
 12<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>
 13<tag-with-long-text>
 14The 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.
 15</tag-with-long-text>
 16<tag-with-long-text-and-attrs attr1="value" attr2="" attr3="some-long-value with two words">
 17The 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.
 18</tag-with-long-text-and-attrs>
 19And now some text in root element. And now some other text in root element.
 20<!-- some short comment -->
 21And 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.
 22<!--
 23some 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.
 24-->
 25<tag-with-short-cdata> some short text </tag-with-short-cdata>
 26<tag-with-long-cdata>
 27The 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.
 28</tag-with-long-cdata>
 29<ns:tag-with-some-namespace/>
 30</root-tag-with-mixed-content>
 31

LayoutTests/http/tests/xmlviewer/dumpAsText/xmlviewer.xml

 1<?xml version='1.0' encoding='utf-8'?>
 2<?some-short-processing-instruction short-params?>
 3<?some-long-processing-instruction
 4 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
 5 dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps
 6 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
 7 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
 8 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.
 9 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
 10 dog. The quick brown fox jumps over the lazy dog.
 11?>
 12<root-tag-with-mixed-content>
 13 <empty-tag/>
 14 <empty-tag-with-attributes attr1="value" attr2="" attr3="some-long-value with two words"/>
 15 <another-empty-tag></another-empty-tag>
 16 <another-empty-tag-with-attributes attr1="value" attr2="" attr3="some-long-value with two words"></another-empty-tag-with-attributes>
 17 <tag-with-short-text>Some short text</tag-with-short-text>
 18 <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>
 19 <tag-with-long-text>
 20 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
 21 dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps
 22 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
 23 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
 24 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.
 25 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
 26 dog. The quick brown fox jumps over the lazy dog.
 27 </tag-with-long-text>
 28 <tag-with-long-text-and-attrs attr1="value" attr2="" attr3="some-long-value with two words">
 29 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
 30 dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps
 31 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
 32 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
 33 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.
 34 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
 35 dog. The quick brown fox jumps over the lazy dog.
 36 </tag-with-long-text-and-attrs>
 37 And now some text in root element.
 38 And now some other text in root element.
 39 <!-- some short comment -->
 40 And now some long text in root element.
 41 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
 42 dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps
 43 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
 44 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
 45 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.
 46 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
 47 dog. The quick brown fox jumps over the lazy dog.
 48 <!-- some long comment
 49 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
 50 lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox
 51 jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The
 52 quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the
 53 lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox
 54 jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The
 55 quick brown fox jumps over the lazy dog. The quick brown fox
 56 jumps over the lazy dog.
 57 -->
 58 <tag-with-short-cdata>
 59 <![CDATA[ some short text ]]>
 60 </tag-with-short-cdata>
 61 <tag-with-long-cdata>
 62 <![CDATA[
 63 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
 64 dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps
 65 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
 66 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
 67 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.
 68 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
 69 dog. The quick brown fox jumps over the lazy dog.
 70 ]]>
 71 </tag-with-long-cdata>
 72 <ns:tag-with-some-namespace xmlns:ns="www.example.org/namespace"/>
 73</root-tag-with-mixed-content>

LayoutTests/http/tests/xmlviewer/dumpAsText/xsl-stylesheet-expected.txt

 1This tests that xml viewer is not used when there is an XSL stylesheet. SUCCESS

LayoutTests/http/tests/xmlviewer/dumpAsText/xsl-stylesheet.xml

 1<!-- If you can see this, this test has failed. -->
 2<?xml-stylesheet href="resources/xsl-stylesheet.xsl"?>
 3<FAIL>
 4 <header>This tests that xml viewer is not used when there is an XSL stylesheet.</header>
 5 SUCCESS
 6</FAIL>

LayoutTests/http/tests/xmlviewer/dumpAsText/xul-expected.txt

 1This XML file does not have any style information. The document tree is shown.
 2<!-- If you can see this, this test has failed. -->
 3<FAIL>
 4<header>
 5This tests that xml viewer is not used when there is an attribute in XUL namespace.
 6</header>
 7<box a:attr="value">SUCCESS</box>
 8</FAIL>
 9

LayoutTests/http/tests/xmlviewer/dumpAsText/xul.xml

 1<!-- If you can see this, this test has failed. -->
 2<FAIL xmlns:a="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
 3 <header>This tests that xml viewer is not used when there is an attribute in XUL namespace.</header>
 4 <box a:attr="value">SUCCESS</box>
 5</FAIL>

LayoutTests/platform/chromium/http/tests/xmlviewer/dumpAsText/mathml-expected.txt

 1This XML file does not have any style information. The document tree is shown.
 2<!--
 3If you can see this, this test has failed, except if you are not using a MathML-aware client.
 4-->
 5<FAIL>
 6<header>
 7This tests that xml viewer is not used when there is a tag in MATHML namespace.
 8</header>
 9<a:math>
 10<a:mrow>
 11<a:mi>SUCCESS</a:mi>
 12</a:mrow>
 13</a:math>
 14</FAIL>
 15

Source/WebCore/CMakeLists.txt

@@SET(WebCore_SOURCES
15131513 xml/XMLHttpRequest.cpp
15141514 xml/XMLHttpRequestProgressEventThrottle.cpp
15151515 xml/XMLHttpRequestUpload.cpp
 1516 xml/XMLViewerHelper.cpp
15161517 xml/XMLSerializer.cpp
15171518 xml/XPathEvaluator.cpp
15181519 xml/XPathExpression.cpp

@@MAKE_HASH_TOOLS(${WEBCORE_DIR}/html/DocTypeStrings)
21482149LIST(APPEND WebCore_SOURCES ${DERIVED_SOURCES_DIR}/DocTypeStrings.cpp)
21492150
21502151
 2152# Generate XMLViewerXSL.h
 2153ADD_CUSTOM_COMMAND(
 2154 OUTPUT ${DERIVED_SOURCES_DIR}/XMLViewerXSL.h
 2155 MAIN_DEPENDENCY xml/XMLViewer.xsl
 2156 COMMAND ${PERL_EXECUTABLE} ${WEBCORE_DIR}/inspector/xxd.pl XMLViewer_xsl xml/XMLViewer.xsl ${DERIVED_SOURCES_DIR}/XMLViewerXSL.h
 2157 VERBATIM)
 2158LIST(APPEND WebCore_SOURCES ${DERIVED_SOURCES_DIR}/XMLViewerXSL.h)
 2159
 2160
 2161# Generate XMLViewerDownArrowPNG.h
 2162ADD_CUSTOM_COMMAND(
 2163 OUTPUT ${DERIVED_SOURCES_DIR}/XMLViewerDownArrowPNG.h
 2164 MAIN_DEPENDENCY inspector/front-end/Images/treeDownTriangleBlack.png
 2165 COMMAND ${PERL_EXECUTABLE} ${WEBCORE_DIR}/inspector/xxd.pl XMLViewerDownArrow_png inspector/front-end/Images/treeDownTriangleBlack.png ${DERIVED_SOURCES_DIR}/XMLViewerDownArrowPNG.h
 2166 VERBATIM)
 2167LIST(APPEND WebCore_SOURCES ${DERIVED_SOURCES_DIR}/XMLViewerDownArrowPNG.h)
 2168
 2169
 2170# Generate XMLViewerRightArrowPNG.h
 2171ADD_CUSTOM_COMMAND(
 2172 OUTPUT ${DERIVED_SOURCES_DIR}/XMLViewerRightArrowPNG.h
 2173 MAIN_DEPENDENCY inspector/front-end/Images/treeRightTriangleBlack.png
 2174 COMMAND ${PERL_EXECUTABLE} ${WEBCORE_DIR}/inspector/xxd.pl XMLViewerRightArrow_png inspector/front-end/Images/treeRightTriangleBlack.png ${DERIVED_SOURCES_DIR}/XMLViewerRightArrowPNG.h
 2175 VERBATIM)
 2176LIST(APPEND WebCore_SOURCES ${DERIVED_SOURCES_DIR}/XMLViewerRightArrowPNG.h)
 2177
 2178
21512179# Generate HTML entity table
21522180ADD_CUSTOM_COMMAND(
21532181 OUTPUT ${DERIVED_SOURCES_DIR}/HTMLEntityTable.cpp

Source/WebCore/ChangeLog

 12011-02-16 Vsevolod Vlasov <vsevik@chromium.org>
 2
 3 Reviewed by NOBODY (OOPS!).
 4
 5 XML without style should render as syntax-highlighted source
 6 https://bugs.webkit.org/show_bug.cgi?id=13807
 7
 8 Tests: http/tests/xmlviewer/dumpAsText/css-stylesheet.xml
 9 http/tests/xmlviewer/dumpAsText/frames.html
 10 http/tests/xmlviewer/dumpAsText/mathml.xml
 11 http/tests/xmlviewer/dumpAsText/svg.xml
 12 http/tests/xmlviewer/dumpAsText/wml.xml
 13 http/tests/xmlviewer/dumpAsText/xhtml-tag.xml
 14 http/tests/xmlviewer/dumpAsText/xlink.xml
 15 http/tests/xmlviewer/dumpAsText/xmlviewer.xml
 16 http/tests/xmlviewer/dumpAsText/xsl-stylesheet.xml
 17 http/tests/xmlviewer/dumpAsText/xul.xml
 18
 19 * CMakeLists.txt:
 20 * DerivedSources.make:
 21 * GNUmakefile.am:
 22 * WebCore.gyp/WebCore.gyp:
 23 * WebCore.gypi:
 24 * WebCore.vcproj/WebCore.vcproj:
 25 * WebCore.xcodeproj/project.pbxproj:
 26 * css/CSSStyleSelector.cpp:
 27 (WebCore::CSSStyleSelector::matchUARules):
 28 * dom/Document.cpp:
 29 (WebCore::Document::Document):
 30 (WebCore::Document::createElement):
 31 * dom/Document.h:
 32 (WebCore::Document::usesViewSourceStyles):
 33 (WebCore::Document::setUsesViewSourceStyles):
 34 (WebCore::Document::hasElementsInKnownNamespaces):
 35 * dom/ProcessingInstruction.cpp:
 36 (WebCore::ProcessingInstruction::ProcessingInstruction):
 37 (WebCore::ProcessingInstruction::checkStyleSheet):
 38 * dom/ProcessingInstruction.h:
 39 (WebCore::ProcessingInstruction::isCSS):
 40 * dom/XMLDocumentParser.h:
 41 * dom/XMLDocumentParserLibxml2.cpp:
 42 (WebCore::XMLDocumentParser::XMLDocumentParser):
 43 (WebCore::XMLDocumentParser::processingInstruction):
 44 (WebCore::XMLDocumentParser::initializeParserContext):
 45 (WebCore::XMLDocumentParser::doEnd):
 46 * dom/XMLDocumentParserQt.cpp:
 47 (WebCore::XMLDocumentParser::XMLDocumentParser):
 48 (WebCore::XMLDocumentParser::initializeParserContext):
 49 (WebCore::XMLDocumentParser::parseProcessingInstruction):
 50 * html/HTMLViewSourceDocument.cpp:
 51 (WebCore::HTMLViewSourceDocument::HTMLViewSourceDocument):
 52 * xml/XMLViewer.xsl: Added.
 53 * xml/XMLViewerHelper.cpp: Added.
 54 (WebCore::XMLViewerHelper::XMLViewerHelper):
 55 (WebCore::XMLViewerHelper::hasNoStyleInformation):
 56 (WebCore::XMLViewerHelper::transformDocumentToXMLViewer):
 57 * xml/XMLViewerHelper.h: Added.
 58 (WebCore::XMLViewerHelper::~XMLViewerHelper):
 59 * xml/XSLStyleSheet.h:
 60 (WebCore::XSLStyleSheet::createFromString):
 61
1622011-02-15 John Sullivan <sullivan@apple.com>
263
364 Reviewed by Antti Koivisto.

Source/WebCore/DerivedSources.make

@@DocTypeStrings.cpp : html/DocTypeStrings.gperf $(WebCore)/make-hash-tools.pl
646646
647647# --------
648648
 649# XMLViewer XSLT and images
 650
 651all : XMLViewerXSL.h XMLViewerDownArrowPNG.h XMLViewerRightArrowPNG.h
 652
 653XMLViewerXSL.h : xml/XMLViewer.xsl
 654 perl $(WebCore)/inspector/xxd.pl XMLViewer_xsl $(WebCore)/xml/XMLViewer.xsl XMLViewerXSL.h
 655
 656XMLViewerDownArrowPNG.h : inspector/front-end/Images/treeDownTriangleBlack.png
 657 perl $(WebCore)/inspector/xxd.pl XMLViewerDownArrow_png $(WebCore)/inspector/front-end/Images/treeDownTriangleBlack.png XMLViewerDownArrowPNG.h
 658
 659XMLViewerRightArrowPNG.h : inspector/front-end/Images/treeRightTriangleBlack.png
 660 perl $(WebCore)/inspector/xxd.pl XMLViewerRightArrow_png $(WebCore)/inspector/front-end/Images/treeRightTriangleBlack.png XMLViewerRightArrowPNG.h
 661
 662# --------
 663
649664# HTML entity names
650665
651666HTMLEntityTable.cpp : html/parser/HTMLEntityNames.in $(WebCore)/html/parser/create-html-entity-table

Source/WebCore/GNUmakefile.am

@@webcore_built_sources += \
642642 DerivedSources/WebCore/XMLNames.cpp \
643643 DerivedSources/WebCore/XMLNames.h \
644644 DerivedSources/WebCore/XMLNSNames.cpp \
645  DerivedSources/WebCore/XMLNSNames.h
 645 DerivedSources/WebCore/XMLNSNames.h \
 646 DerivedSources/WebCore/XMLViewerXSL.h \
 647 DerivedSources/WebCore/XMLViewerDownArrowPNG.h \
 648 DerivedSources/WebCore/XMLViewerRightArrowPNG.h
646649
647650webcore_sources += \
648651 Source/WebCore/accessibility/AccessibilityARIAGridCell.cpp \

@@webcore_sources += \
36233626 Source/WebCore/xml/XMLHttpRequestProgressEventThrottle.h \
36243627 Source/WebCore/xml/XMLHttpRequestUpload.cpp \
36253628 Source/WebCore/xml/XMLHttpRequestUpload.h \
 3629 Source/WebCore/xml/XMLViewerHelper.cpp \
 3630 Source/WebCore/xml/XMLViewerHelper.h \
36263631 Source/WebCore/xml/XMLSerializer.cpp \
36273632 Source/WebCore/xml/XMLSerializer.h \
36283633 Source/WebCore/xml/XPathEvaluator.cpp \

@@DerivedSources/WebCore/HashTools.h: DerivedSources/WebCore/DocTypeStrings.cpp
48304835DerivedSources/WebCore/DocTypeStrings.cpp: $(WebCore)/html/DocTypeStrings.gperf $(WebCore)/make-hash-tools.pl
48314836 $(PERL) $(WebCore)/make-hash-tools.pl $(GENSOURCES_WEBCORE) $(WebCore)/html/DocTypeStrings.gperf
48324837
 4838# XML Viewer XSL
 4839DerivedSources/WebCore/XMLViewerXSL.h: $(WebCore)/xml/XMLViewer.xsl
 4840 $(PERL) $(WebCore)/inspector/xxd.pl XMLViewer_xsl $(WebCore)/xml/XMLViewer.xsl $(GENSOURCES_WEBCORE)/XMLViewerXSL.h
 4841# XML Viewer Down Arrow
 4842DerivedSources/WebCore/XMLViewerDownArrowPNG.h: $(WebCore)/inspector/front-end/Images/treeDownTriangleBlack.png
 4843 $(PERL) $(WebCore)/inspector/xxd.pl XMLViewerDownArrow_png $(WebCore)/inspector/front-end/Images/treeDownTriangleBlack.png $(GENSOURCES_WEBCORE)/XMLViewerDownArrowPNG.h
 4844# XML Viewer Right Arrow
 4845DerivedSources/WebCore/XMLViewerRightArrowPNG.h: $(WebCore)/inspector/front-end/Images/treeRightTriangleBlack.png
 4846 $(PERL) $(WebCore)/inspector/xxd.pl XMLViewerRightArrow_png $(WebCore)/inspector/front-end/Images/treeRightTriangleBlack.png $(GENSOURCES_WEBCORE)/XMLViewerRightArrowPNG.h
 4847
48334848# HTML entity names
48344849DerivedSources/WebCore/HTMLEntityTable.cpp: $(WebCore)/html/parser/HTMLEntityNames.in $(WebCore)/html/parser/create-html-entity-table
48354850 $(PYTHON) $(WebCore)/html/parser/create-html-entity-table -o $(GENSOURCES_WEBCORE)/HTMLEntityTable.cpp $(WebCore)/html/parser/HTMLEntityNames.in

Source/WebCore/WebCore.gyp/WebCore.gyp

387387 'actions': [
388388 # Actions to build derived sources.
389389 {
 390 'action_name': 'generateXMLViewerXSL',
 391 'inputs': [
 392 '../xml/XMLViewer.xsl',
 393 ],
 394 'outputs': [
 395 '<(SHARED_INTERMEDIATE_DIR)/webkit/XMLViewerXSL.h',
 396 '<(SHARED_INTERMEDIATE_DIR)/webkit/XMLViewerXSL.cpp',
 397 ],
 398 'action': [
 399 'perl',
 400 '../inspector/xxd.pl',
 401 'XMLViewer_xsl',
 402 '../xml/XMLViewer.xsl',
 403 '<(SHARED_INTERMEDIATE_DIR)/webkit/XMLViewerXSL.h'
 404 ],
 405 },
 406 {
 407 'action_name': 'generateXMLViewerDownArrowPNG',
 408 'inputs': [
 409 '../inspector/front-end/Images/treeDownTriangleBlack.png',
 410 ],
 411 'outputs': [
 412 '<(SHARED_INTERMEDIATE_DIR)/webkit/XMLViewerDownArrowPNG.h',
 413 '<(SHARED_INTERMEDIATE_DIR)/webkit/XMLViewerDownArrowPNG.cpp',
 414 ],
 415 'action': [
 416 'perl',
 417 '../inspector/xxd.pl',
 418 'XMLViewerDownArrow_png',
 419 '../inspector/front-end/Images/treeDownTriangleBlack.png',
 420 '<(SHARED_INTERMEDIATE_DIR)/webkit/XMLViewerDownArrowPNG.h'
 421 ],
 422 },
 423 {
 424 'action_name': 'generateXMLViewerRightArrowPNG',
 425 'inputs': [
 426 '../inspector/front-end/Images/treeRightTriangleBlack.png',
 427 ],
 428 'outputs': [
 429 '<(SHARED_INTERMEDIATE_DIR)/webkit/XMLViewerRightArrowPNG.h',
 430 '<(SHARED_INTERMEDIATE_DIR)/webkit/XMLViewerRightArrowPNG.cpp',
 431 ],
 432 'action': [
 433 'perl',
 434 '../inspector/xxd.pl',
 435 'XMLViewerRightArrow_png',
 436 '../inspector/front-end/Images/treeRightTriangleBlack.png',
 437 '<(SHARED_INTERMEDIATE_DIR)/webkit/XMLViewerRightArrowPNG.h'
 438 ],
 439 },
 440 {
390441 'action_name': 'HTMLEntityTable',
391442 'inputs': [
392443 '../html/parser/HTMLEntityNames.in',

Source/WebCore/WebCore.gypi

45994599 'xml/XMLHttpRequestProgressEventThrottle.h',
46004600 'xml/XMLHttpRequestUpload.cpp',
46014601 'xml/XMLHttpRequestUpload.h',
 4602 'xml/XMLViewerHelper.cpp',
 4603 'xml/XMLViewerHelper.h',
46024604 'xml/XMLSerializer.cpp',
46034605 'xml/XMLSerializer.h',
46044606 'xml/XPathEvaluator.cpp',

Source/WebCore/WebCore.vcproj/WebCore.vcproj

2303823038 >
2303923039 </File>
2304023040 <File
 23041 RelativePath="$(ConfigurationBuildDir)\obj\$(ProjectName)\DerivedSources\XMLViewerXSL.h"
 23042 >
 23043 </File>
 23044 <File
 23045 RelativePath="$(ConfigurationBuildDir)\obj\$(ProjectName)\DerivedSources\XMLViewerDownArrowPNG.h"
 23046 >
 23047 </File>
 23048 <File
 23049 RelativePath="$(ConfigurationBuildDir)\obj\$(ProjectName)\DerivedSources\XMLViewerRightArrowPNG.h"
 23050 >
 23051 </File>
 23052 <File
2304123053 RelativePath="$(ConfigurationBuildDir)\obj\$(ProjectName)\DerivedSources\XPathGrammar.cpp"
2304223054 >
2304323055 <FileConfiguration

4099641008 >
4099741009 </File>
4099841010 <File
 41011 RelativePath="..\xml\XMLViewerHelper.cpp"
 41012 >
 41013 </File>
 41014 <File
 41015 RelativePath="..\xml\XMLViewerHelper.h"
 41016 >
 41017 </File>
 41018 <File
4099941019 RelativePath="..\xml\XMLSerializer.cpp"
4100041020 >
4100141021 </File>

Source/WebCore/WebCore.xcodeproj/project.pbxproj

14101410 54C50F7B0E801DF3009832A0 /* XMLDocumentParserLibxml2.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 54C50F7A0E801DF3009832A0 /* XMLDocumentParserLibxml2.cpp */; };
14111411 550A0BC9085F6039007353D6 /* QualifiedName.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 550A0BC7085F6039007353D6 /* QualifiedName.cpp */; };
14121412 550A0BCA085F6039007353D6 /* QualifiedName.h in Headers */ = {isa = PBXBuildFile; fileRef = 550A0BC8085F6039007353D6 /* QualifiedName.h */; settings = {ATTRIBUTES = (Private, ); }; };
 1413 5905ADBF1302F3CE00F116DF /* XMLViewerHelper.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5905ADBD1302F3CE00F116DF /* XMLViewerHelper.cpp */; };
 1414 5905ADC01302F3CE00F116DF /* XMLViewerHelper.h in Headers */ = {isa = PBXBuildFile; fileRef = 5905ADBE1302F3CE00F116DF /* XMLViewerHelper.h */; };
14131415 590E1B4911E4EF4B0069F784 /* DeviceOrientation.h in Headers */ = {isa = PBXBuildFile; fileRef = 590E1B4811E4EF4B0069F784 /* DeviceOrientation.h */; settings = {ATTRIBUTES = (Private, ); }; };
14141416 590E1B4B11E4EF700069F784 /* JSDeviceOrientationEventCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 590E1B4A11E4EF700069F784 /* JSDeviceOrientationEventCustom.cpp */; };
14151417 5913953B110758450083EC55 /* JNIBridge.h in Headers */ = {isa = PBXBuildFile; fileRef = 5913953A110758450083EC55 /* JNIBridge.h */; };

78297831 54C50F7A0E801DF3009832A0 /* XMLDocumentParserLibxml2.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = XMLDocumentParserLibxml2.cpp; sourceTree = "<group>"; };
78307832 550A0BC7085F6039007353D6 /* QualifiedName.cpp */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.cpp; path = QualifiedName.cpp; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
78317833 550A0BC8085F6039007353D6 /* QualifiedName.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = QualifiedName.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
 7834 5905ADBD1302F3CE00F116DF /* XMLViewerHelper.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = XMLViewerHelper.cpp; sourceTree = "<group>"; };
 7835 5905ADBE1302F3CE00F116DF /* XMLViewerHelper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XMLViewerHelper.h; sourceTree = "<group>"; };
78327836 590E1B4811E4EF4B0069F784 /* DeviceOrientation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DeviceOrientation.h; sourceTree = "<group>"; };
78337837 590E1B4A11E4EF700069F784 /* JSDeviceOrientationEventCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSDeviceOrientationEventCustom.cpp; sourceTree = "<group>"; };
78347838 5913953A110758450083EC55 /* JNIBridge.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JNIBridge.h; sourceTree = "<group>"; };

78377841 59309A1211F4AE6A00250603 /* DeviceOrientationClientMock.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DeviceOrientationClientMock.h; path = mock/DeviceOrientationClientMock.h; sourceTree = "<group>"; };
78387842 596229771133EFD700DC4CBB /* GeolocationPositionCache.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GeolocationPositionCache.cpp; sourceTree = "<group>"; };
78397843 596229791133EFE200DC4CBB /* GeolocationPositionCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GeolocationPositionCache.h; sourceTree = "<group>"; };
 7844 5980B03312EF3D8400DF5F85 /* XMLViewer.xsl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = XMLViewer.xsl; sourceTree = "<group>"; };
78407845 599E758F11055A1F00D904FA /* Bridge.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Bridge.h; path = bridge/Bridge.h; sourceTree = "<group>"; };
78417846 59A85EA1119D68D900DEF1EF /* DeviceOrientationEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DeviceOrientationEvent.cpp; sourceTree = "<group>"; };
78427847 59A85EA3119D68EC00DEF1EF /* DeviceOrientationEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DeviceOrientationEvent.h; sourceTree = "<group>"; };

1838418389 BCDFD48D0E305290009D10AD /* XMLHttpRequestUpload.cpp */,
1838518390 BCDFD48C0E305290009D10AD /* XMLHttpRequestUpload.h */,
1838618391 BCDFD4900E305644009D10AD /* XMLHttpRequestUpload.idl */,
 18392 5905ADBD1302F3CE00F116DF /* XMLViewerHelper.cpp */,
 18393 5905ADBE1302F3CE00F116DF /* XMLViewerHelper.h */,
1838718394 1ACE53E40A8D18E70022947D /* XMLSerializer.cpp */,
1838818395 1ACE53E50A8D18E70022947D /* XMLSerializer.h */,
1838918396 1ACE53E60A8D18E70022947D /* XMLSerializer.idl */,
 18397 5980B03312EF3D8400DF5F85 /* XMLViewer.xsl */,
1839018398 1AB7FC470A8B92EC00D9D37B /* XPathEvaluator.cpp */,
1839118399 1AB7FC480A8B92EC00D9D37B /* XPathEvaluator.h */,
1839218400 1AB7FC490A8B92EC00D9D37B /* XPathEvaluator.idl */,

2243422442 26E98A10130A9FCA008EB7B2 /* TextCodecASCIIFastPath.h in Headers */,
2243522443 B8DBDB4C130B0F8A00F5CDB1 /* SetSelectionCommand.h in Headers */,
2243622444 B8DBDB4E130B0F8A00F5CDB1 /* SpellingCorrectionCommand.h in Headers */,
 22445 5905ADC01302F3CE00F116DF /* XMLViewerHelper.h in Headers */,
2243722446 );
2243822447 runOnlyForDeploymentPostprocessing = 0;
2243922448 };

2511625125 A1E1154413015C3D0054AC8C /* DistantLightSource.cpp in Sources */,
2511725126 A1E1154613015C4E0054AC8C /* PointLightSource.cpp in Sources */,
2511825127 A1E1154813015C5D0054AC8C /* SpotLightSource.cpp in Sources */,
 25128<<<<<<< HEAD
2511925129 B8DBDB4B130B0F8A00F5CDB1 /* SetSelectionCommand.cpp in Sources */,
2512025130 B8DBDB4D130B0F8A00F5CDB1 /* SpellingCorrectionCommand.cpp in Sources */,
 25131=======
 25132 5905ADBF1302F3CE00F116DF /* XMLViewerHelper.cpp in Sources */,
 25133>>>>>>> XML without style should render as syntax-highlighted source.
2512125134 );
2512225135 runOnlyForDeploymentPostprocessing = 0;
2512325136 };

Source/WebCore/css/CSSStyleSelector.cpp

@@void CSSStyleSelector::matchUARules(int& firstUARule, int& lastUARule)
11921192 if (!m_checker.m_strictParsing)
11931193 matchRules(defaultQuirksStyle, firstUARule, lastUARule, false);
11941194
1195  // If we're in view source mode, then we match rules from the view source style sheet.
1196  if (m_checker.m_document->frame() && m_checker.m_document->frame()->inViewSourceMode()) {
 1195 // If document uses view source styles (in view source mode or in xml viewer mode), then we match rules from the view source style sheet.
 1196 if (m_checker.m_document->usesViewSourceStyles()) {
11971197 if (!defaultViewSourceStyle)
11981198 loadViewSourceStyle();
11991199 matchRules(defaultViewSourceStyle, firstUARule, lastUARule, false);

Source/WebCore/dom/Document.cpp

@@Document::Document(Frame* frame, const KURL& url, bool isXHTML, bool isHTML)
407407 , m_useSecureKeyboardEntryWhenActive(false)
408408 , m_isXHTML(isXHTML)
409409 , m_isHTML(isHTML)
 410 , m_usesViewSourceStyles(false)
 411 , m_hasElementsInKnownNamespaces(false)
410412 , m_numNodeListCaches(0)
411413#if USE(JSC)
412414 , m_normalWorldWrapperCache(0)

@@PassRefPtr<Element> Document::createElement(const QualifiedName& qName, bool cre
954956 e = MathMLElementFactory::createMathMLElement(qName, this, createdByParser);
955957#endif
956958
957  if (!e)
 959 if (e)
 960 m_hasElementsInKnownNamespaces = true;
 961 else
958962 e = Element::create(qName, document());
959963
960964 // <image> uses imgTag so we need a special rule.

Source/WebCore/dom/Document.h

@@public:
434434 virtual bool isFrameSet() const { return false; }
435435
436436 CSSStyleSelector* styleSelectorIfExists() const { return m_styleSelector.get(); }
 437
 438 bool usesViewSourceStyles() const { return m_usesViewSourceStyles; }
 439 void setUsesViewSourceStyles(bool usesViewSourceStyles) { m_usesViewSourceStyles = usesViewSourceStyles; }
 440
 441 bool hasElementsInKnownNamespaces() const { return m_hasElementsInKnownNamespaces; }
 442
437443 CSSStyleSelector* styleSelector()
438444 {
439445 if (!m_styleSelector)

@@private:
13671373 bool m_isXHTML;
13681374 bool m_isHTML;
13691375
 1376 bool m_usesViewSourceStyles;
 1377 bool m_hasElementsInKnownNamespaces;
 1378
13701379 unsigned m_numNodeListCaches;
13711380
13721381#if USE(JSC)

Source/WebCore/dom/ProcessingInstruction.cpp

@@inline ProcessingInstruction::ProcessingInstruction(Document* document, const St
4343 , m_loading(false)
4444 , m_alternate(false)
4545 , m_createdByParser(false)
 46 , m_isCSS(false)
4647#if ENABLE(XSLT)
4748 , m_isXSL(false)
4849#endif

@@void ProcessingInstruction::checkStyleSheet()
120121 if (i != attrs.end())
121122 type = i->second;
122123
123  bool isCSS = type.isEmpty() || type == "text/css";
 124 m_isCSS = type.isEmpty() || type == "text/css";
124125#if ENABLE(XSLT)
125126 m_isXSL = (type == "text/xml" || type == "text/xsl" || type == "application/xml" ||
126127 type == "application/xhtml+xml" || type == "application/rss+xml" || type == "application/atom+xml");
127  if (!isCSS && !m_isXSL)
 128 if (!m_isCSS && !m_isXSL)
128129#else
129  if (!isCSS)
 130 if (!m_isCSS)
130131#endif
131132 return;
132133

Source/WebCore/dom/ProcessingInstruction.h

@@public:
4848 StyleSheet* sheet() const { return m_sheet.get(); }
4949 void setCSSStyleSheet(PassRefPtr<CSSStyleSheet>);
5050
 51 bool isCSS() const { return m_isCSS; }
5152#if ENABLE(XSLT)
5253 bool isXSL() const { return m_isXSL; }
5354#endif

@@private:
9091 bool m_loading;
9192 bool m_alternate;
9293 bool m_createdByParser;
 94 bool m_isCSS;
9395#if ENABLE(XSLT)
9496 bool m_isXSL;
9597#endif

Source/WebCore/dom/XMLDocumentParser.h

@@public:
194194 Vector<Node*> m_currentNodeStack;
195195
196196 bool m_sawError;
 197 bool m_sawCSS;
197198 bool m_sawXSLTransform;
198199 bool m_sawFirstElement;
199200 bool m_isXHTMLDocument;

Source/WebCore/dom/XMLDocumentParserLibxml2.cpp

6363#include <wtf/Vector.h>
6464
6565#if ENABLE(XSLT)
 66#include "XMLViewerHelper.h"
6667#include <libxslt/xslt.h>
6768#endif
6869
6970#if ENABLE(XHTMLMP)
70 #include "HTMLNames.h"
7171#include "HTMLScriptElement.h"
7272#endif
7373
 74
7475using namespace std;
7576
7677namespace WebCore {

@@XMLDocumentParser::XMLDocumentParser(Document* document, FrameView* frameView)
548549 , m_pendingCallbacks(new PendingCallbacks)
549550 , m_currentNode(document)
550551 , m_sawError(false)
 552 , m_sawCSS(false)
551553 , m_sawXSLTransform(false)
552554 , m_sawFirstElement(false)
553555 , m_isXHTMLDocument(false)

@@XMLDocumentParser::XMLDocumentParser(DocumentFragment* fragment, Element* parent
574576 , m_pendingCallbacks(new PendingCallbacks)
575577 , m_currentNode(fragment)
576578 , m_sawError(false)
 579 , m_sawCSS(false)
577580 , m_sawXSLTransform(false)
578581 , m_sawFirstElement(false)
579582 , m_isXHTMLDocument(false)

@@void XMLDocumentParser::processingInstruction(const xmlChar* target, const xmlCh
970973 exitText();
971974
972975 // ### handle exceptions
973  int exception = 0;
 976 ExceptionCode ec = 0;
974977 RefPtr<ProcessingInstruction> pi = document()->createProcessingInstruction(
975  toString(target), toString(data), exception);
976  if (exception)
 978 toString(target), toString(data), ec);
 979 if (ec)
977980 return;
978981
979982 pi->setCreatedByParser(true);

@@void XMLDocumentParser::processingInstruction(const xmlChar* target, const xmlCh
984987
985988 pi->finishParsingChildren();
986989
 990 if (pi->isCSS())
 991 m_sawCSS = true;
987992#if ENABLE(XSLT)
988993 m_sawXSLTransform = !m_sawFirstElement && pi->isXSL();
989994 if (m_sawXSLTransform && !document()->transformSourceDocument())

@@void XMLDocumentParser::initializeParserContext(const char* chunk)
13101315 sax.initialized = XML_SAX2_MAGIC;
13111316 DocumentParser::startParsing();
13121317 m_sawError = false;
 1318 m_sawCSS = false;
13131319 m_sawXSLTransform = false;
13141320 m_sawFirstElement = false;
13151321

@@void XMLDocumentParser::initializeParserContext(const char* chunk)
13251331void XMLDocumentParser::doEnd()
13261332{
13271333#if ENABLE(XSLT)
1328  if (m_sawXSLTransform) {
 1334 XMLViewerHelper xmlViewerHelper(document());
 1335
 1336 bool xmlViewerMode = !m_sawError && !m_sawCSS && !m_sawXSLTransform && xmlViewerHelper.hasNoStyleInformation();
 1337
 1338 if (xmlViewerMode || m_sawXSLTransform) {
13291339 void* doc = xmlDocPtrForString(document()->cachedResourceLoader(), m_originalSourceForTransform, document()->url().string());
13301340 document()->setTransformSource(new TransformSource(doc));
13311341
1332  document()->setParsing(false); // Make the doc think it's done, so it will apply xsl sheets.
1333  document()->styleSelectorChanged(RecalcStyleImmediately);
1334  document()->setParsing(true);
 1342 if (xmlViewerMode)
 1343 xmlViewerHelper.transformDocumentToXMLViewer();
 1344 else {
 1345 document()->setParsing(false); // Make the doc think it's done, so it will apply xsl sheets.
 1346 document()->styleSelectorChanged(RecalcStyleImmediately);
 1347 document()->setParsing(true);
 1348 }
 1349
13351350 DocumentParser::stopParsing();
13361351 }
13371352#endif

Source/WebCore/dom/XMLDocumentParserQt.cpp

@@XMLDocumentParser::XMLDocumentParser(Document* document, FrameView* frameView)
9191 , m_wroteText(false)
9292 , m_currentNode(document)
9393 , m_sawError(false)
 94 , m_sawCSS(false)
9495 , m_sawXSLTransform(false)
9596 , m_sawFirstElement(false)
9697 , m_isXHTMLDocument(false)

@@XMLDocumentParser::XMLDocumentParser(DocumentFragment* fragment, Element* parent
117118 , m_wroteText(false)
118119 , m_currentNode(fragment)
119120 , m_sawError(false)
 121 , m_sawCSS(false)
120122 , m_sawXSLTransform(false)
121123 , m_sawFirstElement(false)
122124 , m_isXHTMLDocument(false)

@@void XMLDocumentParser::initializeParserContext(const char*)
205207{
206208 DocumentParser::startParsing();
207209 m_sawError = false;
 210 m_sawCSS = false;
208211 m_sawXSLTransform = false;
209212 m_sawFirstElement = false;
210213}

@@void XMLDocumentParser::parseProcessingInstruction()
643646
644647 pi->finishParsingChildren();
645648
 649 if (pi->isCSS())
 650 m_sawCSS = true;
646651#if ENABLE(XSLT)
647652 m_sawXSLTransform = !m_sawFirstElement && pi->isXSL();
648653 if (m_sawXSLTransform && !document()->transformSourceDocument())

Source/WebCore/html/HTMLViewSourceDocument.cpp

@@HTMLViewSourceDocument::HTMLViewSourceDocument(Frame* frame, const KURL& url, co
5252 , m_type(mimeType)
5353{
5454 setUsesBeforeAfterRules(true);
 55 setUsesViewSourceStyles(true);
 56
5557 setCompatibilityMode(QuirksMode);
5658 lockCompatibilityMode();
5759}

Source/WebCore/xml/XMLViewer.xsl

 1<?xml version='1.0' encoding='utf-8'?>
 2<!--
 3 - Copyright (C) 2011 Google Inc. All rights reserved.
 4 -
 5 - Redistribution and use in source and binary forms, with or without
 6 - modification, are permitted provided that the following conditions are
 7 - met:
 8 -
 9 - # Redistributions of source code must retain the above copyright
 10 - notice, this list of conditions and the following disclaimer.
 11 - # Redistributions in binary form must reproduce the above
 12 - copyright notice, this list of conditions and the following disclaimer
 13 - in the documentation and/or other materials provided with the
 14 - distribution.
 15 - # Neither the name of Google Inc. nor the names of its
 16 - contributors may be used to endorse or promote products derived from
 17 - this software without specific prior written permission.
 18
 19 - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 20 - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 21 - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
 22 - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
 23 - OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 24 - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 25 - LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 26 - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 27 - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 28 - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 29 - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 30 -
 31 -->
 32
 33<xsl:stylesheet version='1.0' xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>
 34 <xsl:output method="html"/>
 35 <xsl:param name="xml_has_no_style_message"/>
 36 <xsl:param name="downArrowBase64"/>
 37 <xsl:param name="rightArrowBase64"/>
 38
 39 <xsl:template match="/">
 40 <xsl:call-template name="main"/>
 41 </xsl:template>
 42
 43 <!-- Empty element -->
 44 <xsl:template match="*">
 45 <div class="line">
 46 <span class="webkit-html-tag">
 47 <xsl:text>&lt;</xsl:text>
 48 <xsl:value-of select="name()"/>
 49 <xsl:apply-templates select="@*"/>
 50 <xsl:text>/&gt;</xsl:text>
 51 </span>
 52 </div>
 53 </xsl:template>
 54
 55 <!-- Element with short text only -->
 56 <xsl:template match="*[node()]">
 57 <div class="line">
 58 <span class="webkit-html-tag">
 59 <xsl:text>&lt;</xsl:text>
 60 <xsl:value-of select="name()"/>
 61 <xsl:apply-templates select="@*"/>
 62 <xsl:text>&gt;</xsl:text>
 63 </span>
 64
 65 <span class="text"><xsl:value-of select="."/></span>
 66
 67 <span class="webkit-html-tag">
 68 <xsl:text>&lt;/</xsl:text>
 69 <xsl:value-of select="name()"/>
 70 <xsl:text>&gt;</xsl:text>
 71 </span>
 72 </div>
 73 </xsl:template>
 74
 75 <!-- Collapsable element -->
 76 <xsl:template match="*[* or processing-instruction() or comment() or string-length() &gt; 50]">
 77 <div class="collapsable">
 78 <div class="expanded">
 79 <div class="line">
 80 <xsl:call-template name="collapse-button"/>
 81 <span class="webkit-html-tag">
 82 <xsl:text>&lt;</xsl:text>
 83 <xsl:value-of select="name()"/>
 84 <xsl:apply-templates select="@*"/>
 85 <xsl:text>&gt;</xsl:text>
 86 </span>
 87 </div>
 88
 89 <div class="collapsable-content">
 90 <xsl:apply-templates/>
 91 </div>
 92
 93 <div class="line">
 94 <span class="webkit-html-tag">
 95 <xsl:text>&lt;/</xsl:text>
 96 <xsl:value-of select="name()"/>
 97 <xsl:text>&gt;</xsl:text>
 98 </span>
 99 </div>
 100 </div>
 101
 102 <div class="collapsed hidden">
 103 <div class="line">
 104 <xsl:call-template name="expand-button"/>
 105 <span class="webkit-html-tag">
 106 <xsl:text>&lt;</xsl:text>
 107 <xsl:value-of select="name()"/>
 108 <xsl:apply-templates select="@*"/>
 109 <xsl:text>&gt;</xsl:text>
 110 <xsl:text>...</xsl:text>
 111 <xsl:text>&lt;/</xsl:text>
 112 <xsl:value-of select="name()"/>
 113 <xsl:text>&gt;</xsl:text>
 114 </span>
 115 </div>
 116 </div>
 117 </div>
 118 </xsl:template>
 119
 120 <!-- Any attribute -->
 121 <xsl:template match="@*">
 122 <xsl:text> </xsl:text>
 123 <span class="webkit-html-attribute-name"><xsl:value-of select="name()"/></span>
 124 <xsl:text>=&quot;</xsl:text>
 125 <span class="webkit-html-attribute-value"><xsl:value-of select="."/></span>
 126 <xsl:text>&quot;</xsl:text>
 127 </xsl:template>
 128
 129 <!-- Short comment -->
 130 <xsl:template match="comment()">
 131 <div class="line">
 132 <span class="webkit-html-comment">
 133 <xsl:text>&lt;!--</xsl:text>
 134 <xsl:value-of select="."/>
 135 <xsl:text>--&gt;</xsl:text>
 136 </span>
 137 </div>
 138 </xsl:template>
 139
 140 <!-- Long comment -->
 141 <xsl:template match="comment()[string-length() &gt; 50]">
 142 <div class="collapsable">
 143 <div class="expanded">
 144 <div class="line">
 145 <xsl:call-template name="collapse-button"/>
 146 <span class="webkit-html-comment">
 147 <xsl:text>&lt;!--</xsl:text>
 148 </span>
 149 </div>
 150
 151 <div class="collapsable-content comment">
 152 <span class="webkit-html-comment"><xsl:value-of select="."/></span>
 153 </div>
 154
 155 <div class="line">
 156 <span class="webkit-html-comment">
 157 <xsl:text>--&gt;</xsl:text>
 158 </span>
 159 </div>
 160 </div>
 161
 162 <div class="collapsed hidden">
 163 <div class="line">
 164 <xsl:call-template name="expand-button"/>
 165 <span class="webkit-html-comment">
 166 <xsl:text>&lt;!--</xsl:text>
 167 </span>
 168
 169 <span class="webkit-html-comment"><xsl:text>...</xsl:text></span>
 170
 171 <span class="webkit-html-comment">
 172 <xsl:text>--&gt;</xsl:text>
 173 </span>
 174 </div>
 175 </div>
 176 </div>
 177 </xsl:template>
 178
 179 <!-- Short processing instruction -->
 180 <xsl:template match="processing-instruction()[name() != 'xml-stylesheet']">
 181 <div class="line">
 182 <span class="webkit-html-comment">
 183 <xsl:text>&lt;?</xsl:text>
 184 <xsl:value-of select="name()"/>
 185 <xsl:text> </xsl:text>
 186 <xsl:value-of select="."/>
 187 <xsl:text>?&gt;</xsl:text>
 188 </span>
 189 </div>
 190 </xsl:template>
 191
 192 <!-- Long processing instruction -->
 193 <xsl:template match="processing-instruction()[(string-length() &gt; 50) and (name() != 'xml-stylesheet')]">
 194 <div class="collapsable">
 195 <div class="expanded">
 196 <div class="line">
 197 <xsl:call-template name="collapse-button"/>
 198 <span class="webkit-html-comment">
 199 <xsl:text>&lt;?</xsl:text>
 200 <xsl:value-of select="name()"/>
 201 <xsl:text> </xsl:text>
 202 </span>
 203 </div>
 204
 205 <div class="collapsable-content">
 206 <span class="webkit-html-comment"><xsl:value-of select="."/></span>
 207 </div>
 208
 209 <div class="line">
 210 <span class="webkit-html-comment">
 211 <xsl:text>?&gt;</xsl:text>
 212 </span>
 213 </div>
 214 </div>
 215 <div class="collapsed hidden">
 216 <div class="line">
 217 <xsl:call-template name="expand-button"/>
 218 <span class="webkit-html-comment">
 219 <xsl:text>&lt;?</xsl:text>
 220 <xsl:value-of select="name()"/>
 221 </span>
 222
 223 <span class="webkit-html-comment"><xsl:text>...</xsl:text></span>
 224
 225 <span class="webkit-html-comment">
 226 <xsl:text>?&gt;</xsl:text>
 227 </span>
 228 </div>
 229 </div>
 230 </div>
 231 </xsl:template>
 232
 233 <!-- Text node -->
 234 <xsl:template match="text()">
 235 <xsl:value-of select="."/>
 236 </xsl:template>
 237
 238 <xsl:template name="collapse-button">
 239 <span class="button collapse-button" onclick="return collapseButtonClick(this);" onmousedown="return buttonMouseDown();">
 240 </span>
 241 </xsl:template>
 242
 243 <xsl:template name="expand-button">
 244 <span class="button expand-button" onclick="return expandButtonClick(this);" onmousedown="return buttonMouseDown();">
 245 </span>
 246 </xsl:template>
 247
 248 <xsl:template name="main">
 249 <html>
 250 <head>
 251 <xsl:call-template name="style"/>
 252 <xsl:call-template name="script"/>
 253 </head>
 254 <body>
 255 <div class="header">
 256 <span> <xsl:value-of select="$xml_has_no_style_message"/> </span>
 257 <br/>
 258 </div>
 259
 260 <div class="pretty-print">
 261 <xsl:apply-templates/>
 262 </div>
 263 <div> </div>
 264 </body>
 265 </html>
 266 </xsl:template>
 267
 268 <xsl:template name="script">
 269 <script type="text/javascript">
 270 <xsl:text>
 271 function buttonMouseDown() {
 272 // To prevent selection on double click
 273 return false;
 274 }
 275
 276 function getElementsByClassName(classname, node, recursive) {
 277 var a = [];
 278 var re = new RegExp('\\b' + classname + '\\b');
 279 var els;
 280 if (recursive) {
 281 els = node.getElementsByTagName('div');
 282 } else {
 283 els = node.childNodes;
 284 }
 285 for(var i = 0,j = els.length; i &lt; j; i++) {
 286 if(re.test(els[i].className)) {
 287 a.push(els[i]);
 288 }
 289 }
 290 return a;
 291 }
 292
 293 function expandButtonClick(button) {
 294 getElementsByClassName('expanded', button.parentNode.parentNode.parentNode, false)[0].className = 'expanded';
 295 getElementsByClassName('collapsed', button.parentNode.parentNode.parentNode, false)[0].className = 'collapsed hidden';
 296 }
 297
 298 function collapseButtonClick(button) {
 299 getElementsByClassName('collapsed', button.parentNode.parentNode.parentNode, false)[0].className = 'collapsed';
 300 getElementsByClassName('expanded', button.parentNode.parentNode.parentNode, false)[0].className = 'expanded hidden';
 301 }
 302 </xsl:text>
 303 </script>
 304 </xsl:template>
 305
 306 <xsl:template name="style">
 307 <style type="text/css">
 308 div.header {
 309 border-bottom: 2px solid black;
 310 padding-bottom: 5px;
 311 margin: 10px;
 312 }
 313
 314 div.collapsable > div.hidden {
 315 display:none;
 316 }
 317
 318 .pretty-print {
 319 margin-top: 1em;
 320 margin-left: 20px;
 321 font-family: monospace;
 322 font-size: 13px;
 323 }
 324
 325 .collapsable-content {
 326 margin-left: 1em;
 327 }
 328 .comment {
 329 whitespace: pre;
 330 }
 331
 332 .button {
 333 -webkit-user-select: none;
 334 cursor: pointer;
 335 display: inline-block;
 336 margin-left: -10px;
 337 width: 10px;
 338 background-repeat: no-repeat;
 339 background-position: left top;
 340 vertical-align: bottom;
 341 }
 342
 343 .collapse-button {
 344 background-image: url(<xsl:value-of select="$downArrowBase64"/>);
 345 height: 10px;
 346 }
 347
 348 .expand-button {
 349 background-image: url(<xsl:value-of select="$rightArrowBase64"/>);
 350 height: 11px;
 351 }
 352 </style>
 353 </xsl:template>
 354</xsl:stylesheet>

Source/WebCore/xml/XMLViewerHelper.cpp

 1/*
 2 * Copyright (C) 2011 Google Inc. All rights reserved.
 3 *
 4 * Redistribution and use in source and binary forms, with or without
 5 * modification, are permitted provided that the following conditions
 6 * are met:
 7 *
 8 * 1. Redistributions of source code must retain the above copyright
 9 * notice, this list of conditions and the following disclaimer.
 10 * 2. Redistributions in binary form must reproduce the above copyright
 11 * notice, this list of conditions and the following disclaimer in the
 12 * documentation and/or other materials provided with the distribution.
 13 * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
 14 * its contributors may be used to endorse or promote products derived
 15 * from this software without specific prior written permission.
 16 *
 17 * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
 18 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 19 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 20 * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
 21 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 22 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
 24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 27 */
 28
 29#include "config.h"
 30
 31#if ENABLE(XSLT)
 32#include "XMLViewerHelper.h"
 33
 34
 35#include "Base64.h"
 36#include "Document.h"
 37#include "Frame.h"
 38#include "HTMLNames.h"
 39#include "Page.h"
 40#include "ProcessingInstruction.h"
 41#include "Settings.h"
 42#include "TransformSource.h"
 43#include "XLinkNames.h"
 44#include "XMLViewerDownArrowPNG.h"
 45#include "XMLViewerRightArrowPNG.h"
 46#include "XMLViewerXSL.h"
 47#include "XPathResult.h"
 48#include "XSLStyleSheet.h"
 49#include "XSLTProcessor.h"
 50
 51#include <libxslt/xslt.h>
 52
 53#if ENABLE(MATHML)
 54#include "MathMLNames.h"
 55#endif
 56#if ENABLE(SVG)
 57#include "SVGNames.h"
 58#endif
 59#if ENABLE(WML)
 60#include "WMLNames.h"
 61#endif
 62
 63using namespace std;
 64
 65namespace WebCore {
 66
 67XMLViewerHelper::XMLViewerHelper(Document* document)
 68 : m_document(document)
 69{
 70}
 71
 72bool XMLViewerHelper::hasNoStyleInformation() const
 73{
 74 if (m_document->hasElementsInKnownNamespaces())
 75 return false;
 76
 77 if (!m_document->frame() || !m_document->frame()->page())
 78 return false;
 79
 80 if (!m_document->frame()->page()->settings()->developerExtrasEnabled())
 81 return false;
 82
 83 if (m_document->frame()->tree()->parent(true))
 84 return false; // This document is not in a top frame
 85
 86 if (m_document->frame()->loader()->opener())
 87 return false; // This document is not opened manually by user
 88 return true;
 89}
 90
 91void XMLViewerHelper::transformDocumentToXMLViewer()
 92{
 93 String sheetString(reinterpret_cast<char*>(XMLViewer_xsl), sizeof(XMLViewer_xsl));
 94 RefPtr<XSLStyleSheet> styleSheet = XSLStyleSheet::createFromString(m_document, sheetString);
 95
 96 RefPtr<XSLTProcessor> processor = XSLTProcessor::create();
 97 processor->setXSLStyleSheet(styleSheet);
 98
 99 processor->setParameter("", "xml_has_no_style_message", "This XML file does not have any style information. The document tree is shown.");
 100
 101 const char kDataUrlPrefix[] = "data:image/png;base64,";
 102
 103 String downArrowStringBase64 = base64Encode(reinterpret_cast<char*>(XMLViewerDownArrow_png), sizeof(XMLViewerDownArrow_png));
 104 processor->setParameter("", "downArrowBase64", kDataUrlPrefix + downArrowStringBase64);
 105
 106 String rightArrowStringBase64 = base64Encode(reinterpret_cast<char*>(XMLViewerRightArrow_png), sizeof(XMLViewerRightArrow_png));
 107 processor->setParameter("", "rightArrowBase64", kDataUrlPrefix + rightArrowStringBase64);
 108
 109 String resultMIMEType;
 110 String newSource;
 111 String resultEncoding;
 112
 113 Frame* frame = m_document->frame();
 114 // FIXME: We should introduce error handling
 115 if (processor->transformToString(m_document, resultMIMEType, newSource, resultEncoding))
 116 processor->createDocumentFromSource(newSource, resultEncoding, resultMIMEType, m_document, frame);
 117 // New document should have been loaded in frame. Tell it to use view source styles.
 118 frame->document()->setUsesViewSourceStyles(true);
 119 frame->document()->styleSelectorChanged(RecalcStyleImmediately);
 120}
 121
 122} // namespace WebCore
 123
 124#endif // ENABLE(XSLT)

Source/WebCore/xml/XMLViewerHelper.h

 1/*
 2 * Copyright (C) 2011 Google Inc. All rights reserved.
 3 *
 4 * Redistribution and use in source and binary forms, with or without
 5 * modification, are permitted provided that the following conditions
 6 * are met:
 7 *
 8 * 1. Redistributions of source code must retain the above copyright
 9 * notice, this list of conditions and the following disclaimer.
 10 * 2. Redistributions in binary form must reproduce the above copyright
 11 * notice, this list of conditions and the following disclaimer in the
 12 * documentation and/or other materials provided with the distribution.
 13 * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
 14 * its contributors may be used to endorse or promote products derived
 15 * from this software without specific prior written permission.
 16 *
 17 * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
 18 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 19 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 20 * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
 21 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 22 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
 24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 27 */
 28
 29#ifndef XMLViewerHelper_h
 30#define XMLViewerHelper_h
 31
 32#include <wtf/Vector.h>
 33#include <wtf/text/WTFString.h>
 34
 35#if ENABLE(XSLT)
 36
 37namespace WebCore {
 38
 39class Document;
 40class ProcessingInstruction;
 41
 42class XMLViewerHelper {
 43public:
 44 explicit XMLViewerHelper(Document*);
 45 virtual ~XMLViewerHelper() {};
 46
 47 bool hasNoStyleInformation() const;
 48 void transformDocumentToXMLViewer();
 49
 50private:
 51 Document* m_document;
 52};
 53
 54} // namespace WebCore
 55
 56#endif // ENABLE(XSLT)
 57#endif /* XMLViewerHelper_h */

Source/WebCore/xml/XSLStyleSheet.h

2525
2626#if ENABLE(XSLT)
2727
 28#include "Document.h"
2829#include "ProcessingInstruction.h"
2930#include "StyleSheet.h"
3031

@@public:
6364 return adoptRef(new XSLStyleSheet(parentNode, originalURL, finalURL, false));
6465 }
6566
 67 static PassRefPtr<XSLStyleSheet> createFromString(Document* document, String sheetString)
 68 {
 69 RefPtr<XSLStyleSheet> sheet = adoptRef(new XSLStyleSheet(document, String(), KURL(), false));
 70 sheet->parseString(sheetString);
 71
 72 return sheet;
 73 }
 74
6675 virtual ~XSLStyleSheet();
6776
6877 virtual bool isXSLStyleSheet() const { return true; }

Source/WebKit/chromium/ChangeLog

 12011-02-16 Vsevolod Vlasov <vsevik@chromium.org>
 2
 3 Reviewed by NOBODY (OOPS!).
 4
 5 XML without style should render as syntax-highlighted source
 6 https://bugs.webkit.org/show_bug.cgi?id=13807
 7
 8 * public/WebFrame.h:
 9 * src/WebFrameImpl.cpp:
 10 (WebKit::WebFrameImpl::resetOpener):
 11 * src/WebFrameImpl.h:
 12
1132011-02-15 Bill Budge <bbudge@chromium.org>
214
315 Reviewed by David Levin.

Source/WebKit/chromium/public/WebFrame.h

@@public:
168168 // Returns the frame that opened this frame or 0 if there is none.
169169 virtual WebFrame* opener() const = 0;
170170
 171 // Reset the frame that opened this frame to 0.
 172 virtual void resetOpener() = 0;
 173
171174 // Returns the parent frame or 0 if this is a top-most frame.
172175 virtual WebFrame* parent() const = 0;
173176

Source/WebKit/chromium/src/WebFrameImpl.cpp

@@WebView* WebFrameImpl::view() const
573573 return viewImpl();
574574}
575575
 576void WebFrameImpl::resetOpener()
 577{
 578 m_frame->loader()->setOpener(0);
 579}
 580
576581WebFrame* WebFrameImpl::opener() const
577582{
578583 Frame* opener = 0;

Source/WebKit/chromium/src/WebFrameImpl.h

@@public:
7979 virtual bool hasVisibleContent() const;
8080 virtual WebView* view() const;
8181 virtual WebFrame* opener() const;
 82 virtual void resetOpener();
8283 virtual WebFrame* parent() const;
8384 virtual WebFrame* top() const;
8485 virtual WebFrame* firstChild() const;

Tools/ChangeLog

 12011-02-16 Vsevolod Vlasov <vsevik@chromium.org>
 2
 3 Reviewed by NOBODY (OOPS!).
 4
 5 XML without style should render as syntax-highlighted source
 6 https://bugs.webkit.org/show_bug.cgi?id=13807
 7
 8 * DumpRenderTree/chromium/LayoutTestController.h:
 9 (LayoutTestController::setShouldDumpAsText):
 10 (LayoutTestController::setShouldGeneratePixelResults):
 11 * DumpRenderTree/chromium/TestShell.cpp:
 12 (TestShell::runFileTest):
 13 (TestShell::resetTestController):
 14 * DumpRenderTree/gtk/DumpRenderTree.cpp:
 15 (shouldDumpAsText):
 16 (dump):
 17 (runTest):
 18 * DumpRenderTree/mac/DumpRenderTree.mm:
 19 (shouldDumpAsText):
 20 (runTest):
 21
1222011-02-15 Xianzhu Wang <wangxianzhu@google.com>
223
324 Reviewed by Kent Tamura.

Tools/DumpRenderTree/chromium/LayoutTestController.h

@@public:
343343
344344 WebKit::WebSpeechInputController* speechInputController(WebKit::WebSpeechInputListener*);
345345 bool shouldDumpAsText() { return m_dumpAsText; }
 346 void setShouldDumpAsText(bool value) { m_dumpAsText = value; }
346347 bool shouldDumpEditingCallbacks() { return m_dumpEditingCallbacks; }
347348 bool shouldDumpFrameLoadCallbacks() { return m_dumpFrameLoadCallbacks; }
348349 void setShouldDumpFrameLoadCallbacks(bool value) { m_dumpFrameLoadCallbacks = value; }

@@public:
358359 bool shouldDumpChildFrameScrollPositions() { return m_dumpChildFrameScrollPositions; }
359360 bool shouldDumpChildFramesAsText() { return m_dumpChildFramesAsText; }
360361 bool shouldGeneratePixelResults() { return m_generatePixelResults; }
 362 void setShouldGeneratePixelResults(bool value) { m_generatePixelResults = value; }
361363 bool acceptsEditing() { return m_acceptsEditing; }
362364 bool canOpenWindows() { return m_canOpenWindows; }
363365 bool shouldAddFileToPasteboard() { return m_shouldAddFileToPasteboard; }

Tools/DumpRenderTree/chromium/TestShell.cpp

@@void TestShell::runFileTest(const TestParams& params)
173173 m_params = params;
174174 string testUrl = m_params.testUrl.spec();
175175
176  bool inspectorTestMode = testUrl.find("/inspector/") != string::npos
177  || testUrl.find("\\inspector\\") != string::npos;
178  m_prefs.developerExtrasEnabled = inspectorTestMode;
 176 m_prefs.developerExtrasEnabled = true;
179177 applyPreferences();
180178
181179 if (testUrl.find("loading/") != string::npos
182180 || testUrl.find("loading\\") != string::npos)
183181 m_layoutTestController->setShouldDumpFrameLoadCallbacks(true);
184182
185  if (inspectorTestMode)
 183 if (testUrl.find("dumpAsText/") != string::npos
 184 || testUrl.find("dumpAsText\\") != string::npos) {
 185 m_layoutTestController->setShouldDumpAsText(true);
 186 m_layoutTestController->setShouldGeneratePixelResults(false);
 187 }
 188
 189 if (testUrl.find("/inspector/") != string::npos
 190 || testUrl.find("\\inspector\\") != string::npos)
186191 showDevTools();
187192
188193 if (m_dumpWhenFinished)

@@void TestShell::resetTestController()
222227 m_drtDevToolsAgent->reset();
223228 if (m_drtDevToolsClient)
224229 m_drtDevToolsClient->reset();
 230 webView()->mainFrame()->resetOpener();
225231}
226232
227233void TestShell::loadURL(const WebURL& url)

Tools/DumpRenderTree/gtk/DumpRenderTree.cpp

@@static bool shouldOpenWebInspector(const string& pathOrURL)
105105 return pathOrURL.find("inspector/") != string::npos;
106106}
107107
 108static bool shouldDumpAsText(const string& pathOrURL)
 109{
 110 return pathOrURL.find("dumpAsText/") != string::npos;
 111}
 112
108113static bool shouldEnableDeveloperExtras(const string& pathOrURL)
109114{
110115 return true;

@@void dump()
512517 gchar* responseMimeType = webkit_web_frame_get_response_mime_type(mainFrame);
513518
514519 if (g_str_equal(responseMimeType, "text/plain")) {
515  gLayoutTestController->setDumpAsText(true);
 520 gLayoutTestController->setDumpAsText(true);
516521 gLayoutTestController->setGeneratePixelResults(false);
517522 }
518523 g_free(responseMimeType);

@@static void runTest(const string& testPathOrURL)
638643 gLayoutTestController->setDeveloperExtrasEnabled(true);
639644 if (shouldOpenWebInspector(testURL))
640645 gLayoutTestController->showWebInspector();
 646 if (shouldDumpAsText(testURL)) {
 647 gLayoutTestController->setDumpAsText(true);
 648 gLayoutTestController->setGeneratePixelResults(false);
 649 }
641650 }
642651
643652 WorkQueue::shared()->clear();

Tools/DumpRenderTree/mac/DumpRenderTree.mm

@@static bool shouldOpenWebInspector(const char* pathOrURL)
995995 return strstr(pathOrURL, "inspector/");
996996}
997997
 998static bool shouldDumpAsText(const char* pathOrURL)
 999{
 1000 return strstr(pathOrURL, "dumpAsText/");
 1001}
 1002
9981003static bool shouldEnableDeveloperExtras(const char* pathOrURL)
9991004{
10001005 return true;

@@static void runTest(const string& testPathOrURL)
10891094 gLayoutTestController->setDeveloperExtrasEnabled(true);
10901095 if (shouldOpenWebInspector(pathOrURL.c_str()))
10911096 gLayoutTestController->showWebInspector();
 1097 if (shouldDumpAsText(pathOrURL.c_str())) {
 1098 gLayoutTestController->setDumpAsText(true);
 1099 gLayoutTestController->setGeneratePixelResults(false);
 1100 }
10921101 }
10931102
10941103 if ([WebHistory optionalSharedHistory])