Reviewed by Mitz.
authorap <ap@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 19 Oct 2006 16:41:03 +0000 (16:41 +0000)
committerap <ap@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 19 Oct 2006 16:41:03 +0000 (16:41 +0000)
        http://bugs.webkit.org/show_bug.cgi?id=11141
        REGRESSION(r16681-r16691): CSS '@import' doesn't respect HTML Base element

        Undo one misguided change made in bug 11011 - stop setting inline stylesheet's href
        to document URL. This matches WinIE and partially matches Firefox - although the latter
        reports the href as if it were inherited, it still doesn't use it when resolving URIs in
        @import rules.

        Test: http/tests/uri/css-href.php

        * html/HTMLStyleElement.cpp:
        (WebCore::HTMLStyleElement::childrenChanged):
        * ksvg2/svg/SVGStyleElement.cpp:
        (WebCore::SVGStyleElement::childrenChanged):

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

13 files changed:
LayoutTests/ChangeLog
LayoutTests/http/tests/uri/css-href-2.css [new file with mode: 0644]
LayoutTests/http/tests/uri/css-href-expected.checksum [new file with mode: 0644]
LayoutTests/http/tests/uri/css-href-expected.png [new file with mode: 0644]
LayoutTests/http/tests/uri/css-href-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/uri/css-href-fwd.css [new file with mode: 0644]
LayoutTests/http/tests/uri/css-href.css [new file with mode: 0644]
LayoutTests/http/tests/uri/css-href.php [new file with mode: 0644]
LayoutTests/http/tests/uri/resources/css-href-2.css [new file with mode: 0644]
LayoutTests/http/tests/uri/resources/css-href.css [new file with mode: 0644]
WebCore/ChangeLog
WebCore/html/HTMLStyleElement.cpp
WebCore/ksvg2/svg/SVGStyleElement.cpp

index 5ef0a37..5b879d3 100644 (file)
@@ -1,3 +1,20 @@
+2006-10-19  Alexey Proskuryakov  <ap@nypop.com>
+
+        Reviewed by Mitz.
+
+        Test for http://bugs.webkit.org/show_bug.cgi?id=11141
+        REGRESSION(r16681-r16691): CSS '@import' doesn't respect HTML Base element
+
+        * http/tests/uri/css-href-2.css: Added.
+        * http/tests/uri/css-href-expected.checksum: Added.
+        * http/tests/uri/css-href-expected.png: Added.
+        * http/tests/uri/css-href-expected.txt: Added.
+        * http/tests/uri/css-href-fwd.css: Added.
+        * http/tests/uri/css-href.css: Added.
+        * http/tests/uri/css-href.php: Added.
+        * http/tests/uri/resources/css-href-2.css: Added.
+        * http/tests/uri/resources/css-href.css: Added.
+
 2006-10-19  Geoffrey Garen  <ggaren@apple.com>
 
         Updated this test to avoid machine-specific results.
diff --git a/LayoutTests/http/tests/uri/css-href-2.css b/LayoutTests/http/tests/uri/css-href-2.css
new file mode 100644 (file)
index 0000000..11b5217
--- /dev/null
@@ -0,0 +1 @@
+.c2 { color:green !important; }
diff --git a/LayoutTests/http/tests/uri/css-href-expected.checksum b/LayoutTests/http/tests/uri/css-href-expected.checksum
new file mode 100644 (file)
index 0000000..099227e
--- /dev/null
@@ -0,0 +1 @@
+e2a3e44097d700091ea7824ab5327b24
\ No newline at end of file
diff --git a/LayoutTests/http/tests/uri/css-href-expected.png b/LayoutTests/http/tests/uri/css-href-expected.png
new file mode 100644 (file)
index 0000000..f42ada3
Binary files /dev/null and b/LayoutTests/http/tests/uri/css-href-expected.png differ
diff --git a/LayoutTests/http/tests/uri/css-href-expected.txt b/LayoutTests/http/tests/uri/css-href-expected.txt
new file mode 100644 (file)
index 0000000..a86e4bb
--- /dev/null
@@ -0,0 +1,28 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x600
+  RenderBlock {HTML} at (0,0) size 800x600
+    RenderBody {BODY} at (8,8) size 784x576
+      RenderBlock {P} at (0,0) size 784x18
+        RenderText {#text} at (0,0) size 53x18
+          text run at (0,0) width 53: "Test for "
+        RenderInline {A} at (0,0) size 68x18 [color=#0000EE]
+          RenderText {#text} at (53,0) size 68x18
+            text run at (53,0) width 68: "bug 11141"
+        RenderText {#text} at (121,0) size 341x18
+          text run at (121,0) width 8: ": "
+          text run at (129,0) width 333: "CSS '@import' doesn't respect HTML Base element."
+      RenderBlock {P} at (0,34) size 784x18 [color=#008000]
+        RenderText {#text} at (0,0) size 163x18
+          text run at (0,0) width 163: "This text should be green."
+      RenderBlock {P} at (0,68) size 784x54
+        RenderText {#text} at (0,0) size 770x54
+          text run at (0,0) width 378: "If it is red, the css has been loaded relative to the document. "
+          text run at (378,0) width 383: "If it is black, no stylesheet has been rendered, if it is rendered"
+          text run at (0,18) width 43: "green, "
+          text run at (43,18) width 463: "the stylesheet has been rendered correctly from the HREF attribute of the "
+          text run at (506,18) width 264: "Base element in the HEAD section of this"
+          text run at (0,36) width 66: "document."
+      RenderBlock {P} at (0,138) size 784x18 [color=#008000]
+        RenderText {#text} at (0,0) size 192x18
+          text run at (0,0) width 192: "This text should also be green."
diff --git a/LayoutTests/http/tests/uri/css-href-fwd.css b/LayoutTests/http/tests/uri/css-href-fwd.css
new file mode 100644 (file)
index 0000000..fe81ee1
--- /dev/null
@@ -0,0 +1 @@
+@import "css-href-2.css";
diff --git a/LayoutTests/http/tests/uri/css-href.css b/LayoutTests/http/tests/uri/css-href.css
new file mode 100644 (file)
index 0000000..eb19136
--- /dev/null
@@ -0,0 +1 @@
+.c1 { color:red !important; }
diff --git a/LayoutTests/http/tests/uri/css-href.php b/LayoutTests/http/tests/uri/css-href.php
new file mode 100644 (file)
index 0000000..a93aa00
--- /dev/null
@@ -0,0 +1,18 @@
+<html>
+    <head>
+        <base href="<?php echo 'http://' . $_SERVER['HTTP_HOST'] . '/uri/resources/'; ?>">
+        <style>
+            @import 'css-href.css';
+        </style>
+    </head>
+    <body>
+        <p>Test for <a href="http://bugs.webkit.org/show_bug.cgi?id=11141">bug 11141</a>: 
+        CSS '@import' doesn't respect HTML Base element.</p>
+        <p class="c1">This text should be green.</p>
+        <p>If it is red, the css has been loaded relative to the document.
+        If it is black, no stylesheet has been rendered, if it is rendered green,
+        the stylesheet has been rendered correctly from the HREF attribute of the
+        Base element in the HEAD section of this document.</p>
+        <p class="c2">This text should also be green.</p>
+    </body>
+</html>
diff --git a/LayoutTests/http/tests/uri/resources/css-href-2.css b/LayoutTests/http/tests/uri/resources/css-href-2.css
new file mode 100644 (file)
index 0000000..a63febc
--- /dev/null
@@ -0,0 +1 @@
+.c2 { color:red !important; }
diff --git a/LayoutTests/http/tests/uri/resources/css-href.css b/LayoutTests/http/tests/uri/resources/css-href.css
new file mode 100644 (file)
index 0000000..5ca2fe2
--- /dev/null
@@ -0,0 +1,2 @@
+@import "../css-href-fwd.css";
+.c1 { color:green !important; }
index f5a536e..1579a6a 100644 (file)
@@ -1,3 +1,22 @@
+2006-10-19  Alexey Proskuryakov  <ap@nypop.com>
+
+        Reviewed by Mitz.
+
+        http://bugs.webkit.org/show_bug.cgi?id=11141
+        REGRESSION(r16681-r16691): CSS '@import' doesn't respect HTML Base element
+
+        Undo one misguided change made in bug 11011 - stop setting inline stylesheet's href
+        to document URL. This matches WinIE and partially matches Firefox - although the latter
+        reports the href as if it were inherited, it still doesn't use it when resolving URIs in
+        @import rules.
+
+        Test: http/tests/uri/css-href.php
+
+        * html/HTMLStyleElement.cpp:
+        (WebCore::HTMLStyleElement::childrenChanged):
+        * ksvg2/svg/SVGStyleElement.cpp:
+        (WebCore::SVGStyleElement::childrenChanged):
+
 2006-10-19  Anders Carlsson  <acarlsson@apple.com>
 
         * loader/Cache.cpp:
index 632284c..d6d2658 100644 (file)
@@ -91,7 +91,7 @@ void HTMLStyleElement::childrenChanged()
         if (screenEval.eval(media.get()) || printEval.eval(media.get())) {
             document()->addPendingSheet();
             m_loading = true;
-            m_sheet = new CSSStyleSheet(this, document()->URL(), document()->inputEncoding());
+            m_sheet = new CSSStyleSheet(this, String(), document()->inputEncoding());
             m_sheet->parseString(text, !document()->inCompatMode());
             m_sheet->setMedia(media.get());
             m_loading = false;
index 9993b6c..043e288 100644 (file)
@@ -105,7 +105,7 @@ void SVGStyleElement::childrenChanged()
 
         m_loading = true;
  
-        m_sheet = new CSSStyleSheet(this, document()->URL(), document()->inputEncoding());
+        m_sheet = new CSSStyleSheet(this, String(), document()->inputEncoding());
         m_sheet->parseString(textContent()); // SVG css is always parsed in strict mode
         
         m_sheet->setMedia(mediaList.get());