Reviewed by Eric Seidel.
authoroliver <oliver@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 12 Oct 2007 15:24:56 +0000 (15:24 +0000)
committeroliver <oliver@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 12 Oct 2007 15:24:56 +0000 (15:24 +0000)
        http://bugs.webkit.org/show_bug.cgi?id=15368
        xsl:import fails when preceded by comment

        Test: fast/xsl/import-after-comment.xml

        * xml/XSLStyleSheet.cpp:
        (WebCore::XSLStyleSheet::loadChildSheets): It's OK for xsl:import to be preceded by
        non-element nodes.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@26511 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/fast/xsl/import-after-comment-expected.txt [new file with mode: 0644]
LayoutTests/fast/xsl/import-after-comment.xml [new file with mode: 0644]
LayoutTests/fast/xsl/resources/import-after-comment-stylesheet.xsl [new file with mode: 0644]
LayoutTests/fast/xsl/resources/import-after-comment-transform.xsl [new file with mode: 0644]
WebCore/ChangeLog
WebCore/xml/XSLStyleSheet.cpp

index 857c1a8e652b9cfafbbf8ea1ba963fef46154408..db32137ce5a93186ddf25798c017bcfc6ebda218 100644 (file)
@@ -1,3 +1,15 @@
+2007-10-07  Alexey Proskuryakov  <ap@webkit.org>
+
+        Reviewed by Eric Seidel.
+
+        http://bugs.webkit.org/show_bug.cgi?id=15368
+        xsl:import fails when preceded by comment
+
+        * fast/xsl/import-after-comment-expected.txt: Added.
+        * fast/xsl/import-after-comment.xml: Added.
+        * fast/xsl/resources/import-after-comment-stylesheet.xsl: Added.
+        * fast/xsl/resources/import-after-comment-transform.xsl: Added.
+
 2007-10-07  Vincent Ricard  <magic@magicninja.org>
 
         Reviewed by Maciej.  Landed by eseidel.
diff --git a/LayoutTests/fast/xsl/import-after-comment-expected.txt b/LayoutTests/fast/xsl/import-after-comment-expected.txt
new file mode 100644 (file)
index 0000000..ff43ca4
--- /dev/null
@@ -0,0 +1 @@
+SUCCESS
diff --git a/LayoutTests/fast/xsl/import-after-comment.xml b/LayoutTests/fast/xsl/import-after-comment.xml
new file mode 100644 (file)
index 0000000..431d85a
--- /dev/null
@@ -0,0 +1,3 @@
+<?xml version="1.0" encoding="utf-8"?>
+<?xml-stylesheet type='text/xsl' href='resources/import-after-comment-stylesheet.xsl'?>
+<doc/>
diff --git a/LayoutTests/fast/xsl/resources/import-after-comment-stylesheet.xsl b/LayoutTests/fast/xsl/resources/import-after-comment-stylesheet.xsl
new file mode 100644 (file)
index 0000000..65e0fa6
--- /dev/null
@@ -0,0 +1,5 @@
+<?xml version="1.0"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
+<!-- Comment -->
+<xsl:import href="import-after-comment-transform.xsl"/>
+</xsl:stylesheet>
diff --git a/LayoutTests/fast/xsl/resources/import-after-comment-transform.xsl b/LayoutTests/fast/xsl/resources/import-after-comment-transform.xsl
new file mode 100644 (file)
index 0000000..ebb38f3
--- /dev/null
@@ -0,0 +1,13 @@
+<?xml version="1.0"?>
+<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
+
+  <xsl:template match="*">
+   <html>
+    <body>
+      <script>if (window.layoutTestController) layoutTestController.dumpAsText();</script>
+      <p>SUCCESS</p>
+    </body>
+   </html>
+  </xsl:template>
+
+</xsl:transform>
index e1083773e497de971d0c51f1541bc6a614789cce..5a24f5c0c68fc2f18fbff7da3976abdae6439933 100644 (file)
@@ -1,3 +1,16 @@
+2007-10-07  Alexey Proskuryakov  <ap@webkit.org>
+
+        Reviewed by Eric Seidel.
+
+        http://bugs.webkit.org/show_bug.cgi?id=15368
+        xsl:import fails when preceded by comment
+
+        Test: fast/xsl/import-after-comment.xml
+
+        * xml/XSLStyleSheet.cpp:
+        (WebCore::XSLStyleSheet::loadChildSheets): It's OK for xsl:import to be preceded by
+        non-element nodes.
+
 2007-10-07  Vincent Ricard  <magic@magicninja.org>
 
         Reviewed by Maciej.  Landed by eseidel.
index 8ac6a7caca6a04bb5f14919d9024bb42b64a101d..43dc929de507bd0706b6ee55a79f526d9aa08861 100644 (file)
@@ -47,9 +47,6 @@ SOFT_LINK(libxslt, xsltLoadStylesheetPI, xsltStylesheetPtr, (xmlDocPtr doc), (do
 
 namespace WebCore {
 
-#define IS_BLANK_NODE(n)                                                \
-    (((n)->type == XML_TEXT_NODE) && (xsltIsBlank((n)->content)))
-    
 XSLStyleSheet::XSLStyleSheet(XSLImportRule* parentRule, const String& href)
     : StyleSheet(parentRule, href)
     , m_ownerDocument(0)
@@ -174,11 +171,11 @@ void XSLStyleSheet::loadChildSheets()
         // Imports must occur first.
         xmlNodePtr curr = stylesheetRoot->children;
         while (curr) {
-            if (IS_BLANK_NODE(curr)) {
+            if (curr->type != XML_ELEMENT_NODE) {
                 curr = curr->next;
                 continue;
             }
-            if (curr->type == XML_ELEMENT_NODE && IS_XSLT_ELEM(curr) && IS_XSLT_NAME(curr, "import")) {
+            if (IS_XSLT_ELEM(curr) && IS_XSLT_NAME(curr, "import")) {
                 xmlChar* uriRef = xsltGetNsProp(curr, (const xmlChar*)"href", XSLT_NAMESPACE);                
                 loadChildSheet(DeprecatedString::fromUtf8((const char*)uriRef));
                 xmlFree(uriRef);