Reviewed by Maciej.
authorrwlbuis <rwlbuis@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 29 Sep 2006 08:30:12 +0000 (08:30 +0000)
committerrwlbuis <rwlbuis@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 29 Sep 2006 08:30:12 +0000 (08:30 +0000)
        http://bugzilla.opendarwin.org/show_bug.cgi?id=10893
        InsertRule can not handle @import statements

        Allow @import as part of a css rule.

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

LayoutTests/ChangeLog
LayoutTests/fast/dom/css-insert-import-rule-expected.txt [new file with mode: 0644]
LayoutTests/fast/dom/css-insert-import-rule.html [new file with mode: 0644]
LayoutTests/fast/dom/resources/css-insert-import-rule.css [new file with mode: 0644]
WebCore/ChangeLog
WebCore/css/CSSGrammar.y

index 6f79b49697ab0a3744741207a5fb144d203282f7..e8bc6f5af3c9c1daaf7e833ee227bd4d83981f07 100644 (file)
@@ -1,3 +1,14 @@
+2006-09-29  Rob Buis  <buis@kde.org>
+
+        Reviewed by Maciej.
+
+        Testcase for:
+        http://bugzilla.opendarwin.org/show_bug.cgi?id=10893
+        InsertRule can not handle @import statements
+
+        * fast/dom/css-insert-import-rule.html: Added.
+        * fast/dom/resources/css-insert-import-rule.css: Added.
+
 2006-09-28  David Harrison  <harrison@apple.com>
 
         Reviewed by Justin.
diff --git a/LayoutTests/fast/dom/css-insert-import-rule-expected.txt b/LayoutTests/fast/dom/css-insert-import-rule-expected.txt
new file mode 100644 (file)
index 0000000..b5666db
--- /dev/null
@@ -0,0 +1,22 @@
+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 73x18
+          text run at (0,0) width 73: "Test result: "
+        RenderInline {SPAN} at (0,0) size 39x18
+          RenderText {#text} at (73,0) size 39x18
+            text run at (73,0) width 39: "PASS"
+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 73x18
+          text run at (0,0) width 73: "Test result: "
+        RenderInline {SPAN} at (0,0) size 39x18
+          RenderText {#text} at (73,0) size 39x18
+            text run at (73,0) width 39: "PASS"
diff --git a/LayoutTests/fast/dom/css-insert-import-rule.html b/LayoutTests/fast/dom/css-insert-import-rule.html
new file mode 100644 (file)
index 0000000..0962abe
--- /dev/null
@@ -0,0 +1,19 @@
+<head>
+<style>
+div {
+    width: 100px;
+    height: 100px;
+    background-color: red;
+}
+</style>
+
+<script>
+function test() {
+  document.styleSheets[0].insertRule('@import url("resources/css-insert-import-rule.css");', 0);
+}
+</script>
+
+</head>
+<body onload="test()";>
+<div></div>
+</body>
diff --git a/LayoutTests/fast/dom/resources/css-insert-import-rule.css b/LayoutTests/fast/dom/resources/css-insert-import-rule.css
new file mode 100644 (file)
index 0000000..a1b6c99
--- /dev/null
@@ -0,0 +1,3 @@
+div {
+     background-color: green !important;
+}
index d69c350a0e01eeb695c7025a8e422351c8842eaa..391cadc7a0338772aad5a2c2bd500127c5d6e149 100644 (file)
@@ -1,3 +1,14 @@
+2006-09-29  Rob Buis  <buis@kde.org>
+
+        Reviewed by Maciej.
+
+        http://bugzilla.opendarwin.org/show_bug.cgi?id=10893
+        InsertRule can not handle @import statements
+
+        Allow @import as part of a css rule.
+
+        * css/CSSGrammar.y:
+
 2006-09-28  David Hyatt  <hyatt@apple.com>
 
         Switch over the Mac-specific uses of viewportToContents/contentsToViewport.
index 4f95fa032d196bbb491f91d88791e25dbcade9cc..fe7dcc501c10a66487109d675dac58d572f15d53 100644 (file)
@@ -228,6 +228,7 @@ static int cssyylex(YYSTYPE *yylval) { return CSSParser::current()->lex(yylval);
 
 %type <rule> charset
 %type <rule> ruleset
+%type <rule> ruleset_or_import
 %type <rule> media
 %type <rule> import
 %type <rule> page
@@ -297,8 +298,13 @@ stylesheet:
   | webkit_mediaquery maybe_space
   ;
 
+ruleset_or_import:
+   ruleset |
+   import
+;
+
 webkit_rule:
-    WEBKIT_RULE_SYM '{' maybe_space ruleset maybe_space '}' {
+    WEBKIT_RULE_SYM '{' maybe_space ruleset_or_import maybe_space '}' {
         static_cast<CSSParser*>(parser)->rule = $4;
     }
 ;