Title: [111132] trunk
Revision
111132
Author
[email protected]
Date
2012-03-18 04:33:04 -0700 (Sun, 18 Mar 2012)

Log Message

CSS 2.1 failure: eof-003.htm fails
https://bugs.webkit.org/show_bug.cgi?id=78538

Reviewed by Antti Koivisto.

Source/WebCore:

Tests: css2.1/20110323/eof-001.htm
       css2.1/20110323/eof-003.htm
       css2.1/20110323/eof-004.htm
       css2.1/20110323/eof-005.htm
       css2.1/20110323/eof-006.htm
       css2.1/20110323/eof-007.htm

This patch fixes eof-003.htm, eof-005.htm and eof-006.htm. The other eof-* tests already pass.

* css/CSSGrammar.y: Allow EOF as well as ';' to terminate import rules.
                    This should probably be done for other rules in a separate patch.
* css/CSSParser.cpp:
(WebCore::CSSParser::checkAndSkipString): Allow strings to end with EOF.
(WebCore::CSSParser::parseString): ditto

LayoutTests:

* css2.1/20110323/eof-001-expected.html: Added.
* css2.1/20110323/eof-001.htm: Added.
* css2.1/20110323/eof-003-expected.html: Added.
* css2.1/20110323/eof-003.htm: Added.
* css2.1/20110323/eof-004-expected.html: Added.
* css2.1/20110323/eof-004.htm: Added.
* css2.1/20110323/eof-005-expected.html: Added.
* css2.1/20110323/eof-005.htm: Added.
* css2.1/20110323/eof-006-expected.html: Added.
* css2.1/20110323/eof-006.htm: Added.
* css2.1/20110323/eof-007-expected.html: Added.
* css2.1/20110323/eof-007.htm: Added.
* css2.1/20110323/support/eof-green.css: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (111131 => 111132)


--- trunk/LayoutTests/ChangeLog	2012-03-18 03:20:21 UTC (rev 111131)
+++ trunk/LayoutTests/ChangeLog	2012-03-18 11:33:04 UTC (rev 111132)
@@ -1,3 +1,24 @@
+2012-02-13  Robert Hogan  <[email protected]>
+
+        CSS 2.1 failure: eof-003.htm fails
+        https://bugs.webkit.org/show_bug.cgi?id=78538
+
+        Reviewed by Antti Koivisto.
+
+        * css2.1/20110323/eof-001-expected.html: Added.
+        * css2.1/20110323/eof-001.htm: Added.
+        * css2.1/20110323/eof-003-expected.html: Added.
+        * css2.1/20110323/eof-003.htm: Added.
+        * css2.1/20110323/eof-004-expected.html: Added.
+        * css2.1/20110323/eof-004.htm: Added.
+        * css2.1/20110323/eof-005-expected.html: Added.
+        * css2.1/20110323/eof-005.htm: Added.
+        * css2.1/20110323/eof-006-expected.html: Added.
+        * css2.1/20110323/eof-006.htm: Added.
+        * css2.1/20110323/eof-007-expected.html: Added.
+        * css2.1/20110323/eof-007.htm: Added.
+        * css2.1/20110323/support/eof-green.css: Added.
+
 2012-03-17  Nikolas Zimmermann  <[email protected]>
 
         Enable animVal support for SVGNumberOptionalNumber

Added: trunk/LayoutTests/css2.1/20110323/eof-001-expected.html (0 => 111132)


--- trunk/LayoutTests/css2.1/20110323/eof-001-expected.html	                        (rev 0)
+++ trunk/LayoutTests/css2.1/20110323/eof-001-expected.html	2012-03-18 11:33:04 UTC (rev 111132)
@@ -0,0 +1,17 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+    <head>
+        <title>CSS Test: Reference Result</title>
+        <style type="text/css">
+            div:before
+            {
+                color: green;
+                content: "Filler Text"
+            }
+        </style>
+    </head>
+    <body>
+        <p>Test passes if the "Filler Text" below is green.</p>
+        <div></div>
+    </body>
+</html>
\ No newline at end of file
Property changes on: trunk/LayoutTests/css2.1/20110323/eof-001-expected.html
___________________________________________________________________

Added: svn:eol-style

Added: trunk/LayoutTests/css2.1/20110323/eof-001.htm (0 => 111132)


--- trunk/LayoutTests/css2.1/20110323/eof-001.htm	                        (rev 0)
+++ trunk/LayoutTests/css2.1/20110323/eof-001.htm	2012-03-18 11:33:04 UTC (rev 111132)
@@ -0,0 +1,19 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+    <head>
+        <title>CSS Test: Parsing unexpected end of declaration block</title>
+        <link rel="author" title="Microsoft" href=""
+        <link rel="help" href=""
+        <meta name="flags" content="invalid">
+        <meta name="assert" content="The parser implicitly terminates the block and applies the styles if the declaration block is not terminated.">
+        <style type="text/css">
+            div
+            {
+                color: green
+        </style>
+    </head>
+    <body>
+        <p>Test passes if the "Filler Text" below is green.</p>
+        <div>Filler Text</div>
+    </body>
+</html>
\ No newline at end of file
Property changes on: trunk/LayoutTests/css2.1/20110323/eof-001.htm
___________________________________________________________________

Added: svn:eol-style

Added: trunk/LayoutTests/css2.1/20110323/eof-003-expected.html (0 => 111132)


--- trunk/LayoutTests/css2.1/20110323/eof-003-expected.html	                        (rev 0)
+++ trunk/LayoutTests/css2.1/20110323/eof-003-expected.html	2012-03-18 11:33:04 UTC (rev 111132)
@@ -0,0 +1,17 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+    <head>
+        <title>CSS Test: Reference Result</title>
+        <style type="text/css">
+            div:before
+            {
+                color: green;
+                content: "Filler Text"
+            }
+        </style>
+    </head>
+    <body>
+        <p>Test passes if the "Filler Text" below is green.</p>
+        <div></div>
+    </body>
+</html>
\ No newline at end of file
Property changes on: trunk/LayoutTests/css2.1/20110323/eof-003-expected.html
___________________________________________________________________

Added: svn:eol-style

Added: trunk/LayoutTests/css2.1/20110323/eof-003.htm (0 => 111132)


--- trunk/LayoutTests/css2.1/20110323/eof-003.htm	                        (rev 0)
+++ trunk/LayoutTests/css2.1/20110323/eof-003.htm	2012-03-18 11:33:04 UTC (rev 111132)
@@ -0,0 +1,21 @@
+
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+    <head>
+        <title>CSS Test: Parsing unexpected end of string</title>
+        <link rel="author" title="Microsoft" href=""
+        <link rel="help" href=""
+        <meta name="flags" content="invalid">
+        <meta name="assert" content="Close all open strings at the end of the style sheet.">
+        <style type="text/css">
+            div:before
+            {
+                color: green;
+                content: "Filler Text\
+        </style>
+    </head>
+    <body>
+        <p>Test passes if the "Filler Text" below is green.</p>
+        <div></div>
+    </body>
+</html>
\ No newline at end of file
Property changes on: trunk/LayoutTests/css2.1/20110323/eof-003.htm
___________________________________________________________________

Added: svn:eol-style

Added: trunk/LayoutTests/css2.1/20110323/eof-004-expected.html (0 => 111132)


--- trunk/LayoutTests/css2.1/20110323/eof-004-expected.html	                        (rev 0)
+++ trunk/LayoutTests/css2.1/20110323/eof-004-expected.html	2012-03-18 11:33:04 UTC (rev 111132)
@@ -0,0 +1,17 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+    <head>
+        <title>CSS Test: Reference Result</title>
+        <style type="text/css">
+            div:before
+            {
+                color: green;
+                content: "Filler Text"
+            }
+        </style>
+    </head>
+    <body>
+        <p>Test passes if the "Filler Text" below is green.</p>
+        <div></div>
+    </body>
+</html>
\ No newline at end of file
Property changes on: trunk/LayoutTests/css2.1/20110323/eof-004-expected.html
___________________________________________________________________

Added: svn:eol-style

Added: trunk/LayoutTests/css2.1/20110323/eof-004.htm (0 => 111132)


--- trunk/LayoutTests/css2.1/20110323/eof-004.htm	                        (rev 0)
+++ trunk/LayoutTests/css2.1/20110323/eof-004.htm	2012-03-18 11:33:04 UTC (rev 111132)
@@ -0,0 +1,21 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+    <head>
+        <title>CSS Test: Parsing unexpected end of @media block</title>
+        <link rel="author" title="Microsoft" href=""
+        <link rel="help" href=""
+        <meta name="flags" content="invalid">
+        <meta name="assert" content="User agents close all open blocks at the end of the style sheet.">
+        <style type="text/css">
+            @media screen
+            {
+                div
+                {
+                    color: green
+        </style>
+    </head>
+    <body>
+        <p>Test passes if the "Filler Text" below is green.</p>
+        <div>Filler Text</div>
+    </body>
+</html>
\ No newline at end of file
Property changes on: trunk/LayoutTests/css2.1/20110323/eof-004.htm
___________________________________________________________________

Added: svn:eol-style

Added: trunk/LayoutTests/css2.1/20110323/eof-005-expected.html (0 => 111132)


--- trunk/LayoutTests/css2.1/20110323/eof-005-expected.html	                        (rev 0)
+++ trunk/LayoutTests/css2.1/20110323/eof-005-expected.html	2012-03-18 11:33:04 UTC (rev 111132)
@@ -0,0 +1,17 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+    <head>
+        <title>CSS Test: Reference Result</title>
+        <style type="text/css">
+            div:before
+            {
+                color: green;
+                content: "Filler Text"
+            }
+        </style>
+    </head>
+    <body>
+        <p>Test passes if the "Filler Text" below is green.</p>
+        <div></div>
+    </body>
+</html>
\ No newline at end of file
Property changes on: trunk/LayoutTests/css2.1/20110323/eof-005-expected.html
___________________________________________________________________

Added: svn:eol-style

Added: trunk/LayoutTests/css2.1/20110323/eof-005.htm (0 => 111132)


--- trunk/LayoutTests/css2.1/20110323/eof-005.htm	                        (rev 0)
+++ trunk/LayoutTests/css2.1/20110323/eof-005.htm	2012-03-18 11:33:04 UTC (rev 111132)
@@ -0,0 +1,16 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+    <head>
+        <title>CSS Test: Parsing unexpected end of @import</title>
+        <link rel="author" title="Microsoft" href=""
+        <link rel="help" href=""
+        <meta name="flags" content="invalid">
+        <meta name="assert" content="User agents close all open rules at the end of the style sheet.">
+        <style type="text/css">
+            @import "support/eof-green.css</style>
+    </head>
+    <body>
+        <p>Test passes if the "Filler Text" below is green.</p>
+        <div>Filler Text</div>
+    </body>
+</html>
\ No newline at end of file
Property changes on: trunk/LayoutTests/css2.1/20110323/eof-005.htm
___________________________________________________________________

Added: svn:eol-style

Added: trunk/LayoutTests/css2.1/20110323/eof-006-expected.html (0 => 111132)


--- trunk/LayoutTests/css2.1/20110323/eof-006-expected.html	                        (rev 0)
+++ trunk/LayoutTests/css2.1/20110323/eof-006-expected.html	2012-03-18 11:33:04 UTC (rev 111132)
@@ -0,0 +1,17 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+    <head>
+        <title>CSS Test: Reference Result</title>
+        <style type="text/css">
+            div:before
+            {
+                color: green;
+                content: "Filler Text"
+            }
+        </style>
+    </head>
+    <body>
+        <p>Test passes if the "Filler Text" below is green.</p>
+        <div></div>
+    </body>
+</html>
\ No newline at end of file
Property changes on: trunk/LayoutTests/css2.1/20110323/eof-006-expected.html
___________________________________________________________________

Added: svn:eol-style

Added: trunk/LayoutTests/css2.1/20110323/eof-006.htm (0 => 111132)


--- trunk/LayoutTests/css2.1/20110323/eof-006.htm	                        (rev 0)
+++ trunk/LayoutTests/css2.1/20110323/eof-006.htm	2012-03-18 11:33:04 UTC (rev 111132)
@@ -0,0 +1,16 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+    <head>
+        <title>CSS Test: Parsing unexpected end of @import with closed quote</title>
+        <link rel="author" title="Microsoft" href=""
+        <link rel="help" href=""
+        <meta name="flags" content="invalid">
+        <meta name="assert" content="User agents close all open quotes at the end of the style sheet.">
+        <style type="text/css">
+            @import "support/eof-green.css"</style>
+    </head>
+    <body>
+        <p>Test passes if the "Filler Text" below is green.</p>
+        <div>Filler Text</div>
+    </body>
+</html>
\ No newline at end of file
Property changes on: trunk/LayoutTests/css2.1/20110323/eof-006.htm
___________________________________________________________________

Added: svn:eol-style

Added: trunk/LayoutTests/css2.1/20110323/eof-007-expected.html (0 => 111132)


--- trunk/LayoutTests/css2.1/20110323/eof-007-expected.html	                        (rev 0)
+++ trunk/LayoutTests/css2.1/20110323/eof-007-expected.html	2012-03-18 11:33:04 UTC (rev 111132)
@@ -0,0 +1,17 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+    <head>
+        <title>CSS Test: Reference Result</title>
+        <style type="text/css">
+            div:before
+            {
+                color: green;
+                content: "Filler Text"
+            }
+        </style>
+    </head>
+    <body>
+        <p>Test passes if the "Filler Text" below is green.</p>
+        <div></div>
+    </body>
+</html>
\ No newline at end of file
Property changes on: trunk/LayoutTests/css2.1/20110323/eof-007-expected.html
___________________________________________________________________

Added: svn:eol-style

Added: trunk/LayoutTests/css2.1/20110323/eof-007.htm (0 => 111132)


--- trunk/LayoutTests/css2.1/20110323/eof-007.htm	                        (rev 0)
+++ trunk/LayoutTests/css2.1/20110323/eof-007.htm	2012-03-18 11:33:04 UTC (rev 111132)
@@ -0,0 +1,19 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+    <head>
+        <title>CSS Test: Parsing unexpected end of shorthand rule</title>
+        <link rel="author" title="Microsoft" href=""
+        <link rel="help" href=""
+        <meta name="flags" content="invalid">
+        <meta name="assert" content="User agents close all open rules at the end of the style sheet.">
+        <style type="text/css">
+            div
+            {
+                color: green
+        </style>
+    </head>
+    <body>
+        <p>Test passes if the "Filler Text" below is green.</p>
+        <div>Filler Text</div>
+    </body>
+</html>
\ No newline at end of file
Property changes on: trunk/LayoutTests/css2.1/20110323/eof-007.htm
___________________________________________________________________

Added: svn:eol-style

Added: trunk/LayoutTests/css2.1/20110323/support/eof-green.css (0 => 111132)


--- trunk/LayoutTests/css2.1/20110323/support/eof-green.css	                        (rev 0)
+++ trunk/LayoutTests/css2.1/20110323/support/eof-green.css	2012-03-18 11:33:04 UTC (rev 111132)
@@ -0,0 +1,5 @@
+/* eof-green.css */
+div
+{
+    color: green;
+}
\ No newline at end of file
Property changes on: trunk/LayoutTests/css2.1/20110323/support/eof-green.css
___________________________________________________________________

Added: svn:eol-style

Modified: trunk/Source/WebCore/ChangeLog (111131 => 111132)


--- trunk/Source/WebCore/ChangeLog	2012-03-18 03:20:21 UTC (rev 111131)
+++ trunk/Source/WebCore/ChangeLog	2012-03-18 11:33:04 UTC (rev 111132)
@@ -1,3 +1,25 @@
+2012-02-13  Robert Hogan  <[email protected]>
+
+        CSS 2.1 failure: eof-003.htm fails
+        https://bugs.webkit.org/show_bug.cgi?id=78538
+
+        Reviewed by Antti Koivisto.
+
+        Tests: css2.1/20110323/eof-001.htm
+               css2.1/20110323/eof-003.htm
+               css2.1/20110323/eof-004.htm
+               css2.1/20110323/eof-005.htm
+               css2.1/20110323/eof-006.htm
+               css2.1/20110323/eof-007.htm
+
+        This patch fixes eof-003.htm, eof-005.htm and eof-006.htm. The other eof-* tests already pass.
+
+        * css/CSSGrammar.y: Allow EOF as well as ';' to terminate import rules.
+                            This should probably be done for other rules in a separate patch.
+        * css/CSSParser.cpp:
+        (WebCore::CSSParser::checkAndSkipString): Allow strings to end with EOF.
+        (WebCore::CSSParser::parseString): ditto
+
 2012-03-17  David Reveman  <[email protected]>
 
         [Chromium] PlatformContextSkia::m_drawingToImageBuffer is not correctly set when using per-tile painting.

Modified: trunk/Source/WebCore/css/CSSGrammar.y (111131 => 111132)


--- trunk/Source/WebCore/css/CSSGrammar.y	2012-03-18 03:20:21 UTC (rev 111131)
+++ trunk/Source/WebCore/css/CSSGrammar.y	2012-03-18 11:33:04 UTC (rev 111132)
@@ -457,6 +457,9 @@
     IMPORT_SYM maybe_space string_or_uri maybe_space maybe_media_list ';' {
         $$ = static_cast<CSSParser*>(parser)->createImportRule($3, $5);
     }
+  | IMPORT_SYM maybe_space string_or_uri maybe_space maybe_media_list TOKEN_EOF {
+        $$ = static_cast<CSSParser*>(parser)->createImportRule($3, $5);
+    }
   | IMPORT_SYM maybe_space string_or_uri maybe_space maybe_media_list invalid_block {
         $$ = 0;
     }

Modified: trunk/Source/WebCore/css/CSSParser.cpp (111131 => 111132)


--- trunk/Source/WebCore/css/CSSParser.cpp	2012-03-18 03:20:21 UTC (rev 111131)
+++ trunk/Source/WebCore/css/CSSParser.cpp	2012-03-18 11:33:04 UTC (rev 111132)
@@ -7714,8 +7714,12 @@
             // String parsing is successful.
             return currentCharacter + 1;
         }
-        if (UNLIKELY(*currentCharacter <= '\r' && (!*currentCharacter || *currentCharacter == '\n' || (*currentCharacter | 0x1) == '\r'))) {
-            // String parsing is failed for character '\0', '\n', '\f' or '\r'.
+        if (UNLIKELY(!*currentCharacter)) {
+            // String parsing is successful up to end of input.
+            return currentCharacter;
+        }
+        if (UNLIKELY(*currentCharacter <= '\r' && (*currentCharacter == '\n' || (*currentCharacter | 0x1) == '\r'))) {
+            // String parsing is failed for character '\n', '\f' or '\r'.
             return 0;
         }
 
@@ -7783,6 +7787,10 @@
             ++m_currentCharacter;
             return;
         }
+        if (UNLIKELY(!*m_currentCharacter)) {
+            // String parsing is done, but don't advance pointer if at the end of input.
+            return;
+        }
         ASSERT(*m_currentCharacter > '\r' || (*m_currentCharacter < '\n' && *m_currentCharacter) || *m_currentCharacter == '\v');
 
         if (LIKELY(m_currentCharacter[0] != '\\'))
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to