Title: [99086] trunk
- Revision
- 99086
- Author
- [email protected]
- Date
- 2011-11-02 11:53:07 -0700 (Wed, 02 Nov 2011)
Log Message
Match allowed CSS string characters to Firefox and Opera browsers
https://bugs.webkit.org/show_bug.cgi?id=71000
Reviewed by Darin Adler.
Source/WebCore:
Firefox and Opera accepts any character inside a string except
newline and starting quote character. This behaviour matches to
the CSS 2.1 grammar: http://www.w3.org/TR/CSS2/grammar.html
WebKit should follow them.
Test: fast/css/parsing-css-allowed-string-characters.html
* css/tokenizer.flex:
LayoutTests:
Add a new test case which contains various uncommon characters.
* fast/css/parsing-css-allowed-string-characters-expected.txt: Added.
* fast/css/parsing-css-allowed-string-characters.html: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (99085 => 99086)
--- trunk/LayoutTests/ChangeLog 2011-11-02 18:43:29 UTC (rev 99085)
+++ trunk/LayoutTests/ChangeLog 2011-11-02 18:53:07 UTC (rev 99086)
@@ -1,3 +1,15 @@
+2011-11-02 Zoltan Herczeg <[email protected]>
+
+ Match allowed CSS string characters to Firefox and Opera browsers
+ https://bugs.webkit.org/show_bug.cgi?id=71000
+
+ Reviewed by Darin Adler.
+
+ Add a new test case which contains various uncommon characters.
+
+ * fast/css/parsing-css-allowed-string-characters-expected.txt: Added.
+ * fast/css/parsing-css-allowed-string-characters.html: Added.
+
2011-11-02 Devdatta Deshpande <[email protected]>
Assert in MoveSelectionCommand::doApply
Added: trunk/LayoutTests/fast/css/parsing-css-allowed-string-characters-expected.txt (0 => 99086)
--- trunk/LayoutTests/fast/css/parsing-css-allowed-string-characters-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/css/parsing-css-allowed-string-characters-expected.txt 2011-11-02 18:53:07 UTC (rev 99086)
@@ -0,0 +1,39 @@
+Test parsing of CSS escapes.
+
+SUCCESS
+
+Rules from the stylesheet:
+
+#a::after { content: '65:A 9:\9'; }
+#b::after { content: '128: 159:'; }
+#c::after { content: '1:\1'; }
+#d::after { content: '8:\8'; }
+#e::after { content: '9:\9'; }
+#f::after { }
+#g::after { content: '11:\b'; }
+#h::after { }
+#i::after { }
+#j::after { content: '14:\e'; }
+#k::after { content: '20:\14'; }
+#l::after { content: '30:\1e'; }
+#m::after { content: '31:\1f'; }
+#n::after { content: '127:\7f'; }
+#o::after { content: '384:ƀ'; }
+Expected result:
+
+#a::after { content: '65:A 9:\9'; }
+#b::after { content: '128: 159:'; }
+#c::after { content: '1:\1'; }
+#d::after { content: '8:\8'; }
+#e::after { content: '9:\9'; }
+#f::after { }
+#g::after { content: '11:\b'; }
+#h::after { }
+#i::after { }
+#j::after { content: '14:\e'; }
+#k::after { content: '20:\14'; }
+#l::after { content: '30:\1e'; }
+#m::after { content: '31:\1f'; }
+#n::after { content: '127:\7f'; }
+#o::after { content: '384:ƀ'; }
+
Added: trunk/LayoutTests/fast/css/parsing-css-allowed-string-characters.html (0 => 99086)
--- trunk/LayoutTests/fast/css/parsing-css-allowed-string-characters.html (rev 0)
+++ trunk/LayoutTests/fast/css/parsing-css-allowed-string-characters.html 2011-11-02 18:53:07 UTC (rev 99086)
@@ -0,0 +1,91 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
+<style>
+/*
+ === Warning ===
+
+ This file intentionally contains scpecial characters which
+ cannot be displayed by some text editors. Please
+ carefully edit the file.
+*/
+
+#a:after { content:"65:A 9: "; }
+#b:after { content:"128: 159:"; }
+#c:after { content:"1:"; }
+#d:after { content:"8:"; }
+#e:after { content:"9: "; }
+#f:after { content:"10:
+"; } /* Newline. Invalid string */
+#g:after { content:"11:"; }
+#h:after { content:"12:"; } /* Newline. Invalid string */
+#i:after { content:"13:
+"; } /* Newline. Invalid string */
+#j:after { content:"14:"; }
+#k:after { content:"20:"; }
+#l:after { content:"30:"; }
+#m:after { content:"31:"; }
+#n:after { content:"127:" }
+#o:after { content:"384:ƀ" }
+</style>
+
+<script>
+
+function runTest()
+{
+ if (window.layoutTestController)
+ layoutTestController.dumpAsText();
+
+ var rules = document.styleSheets[0].cssRules;
+ var text = "";
+ for (var i = 0; i < rules.length; i++) {
+ text += rules.item(i).cssText;
+ text += "\n";
+ }
+
+ document.getElementById("result").appendChild(document.createTextNode(text));
+
+ if (document.getElementById("result").firstChild.data ="" document.getElementById("expected").firstChild.data)
+ document.getElementById("message").firstChild.data = ""
+ else
+ document.getElementById("message").firstChild.data = ""
+}
+
+</script>
+
+</head>
+
+<body _onload_="runTest()">
+
+<p>Test parsing of CSS escapes.</p>
+
+<p id="message">TEST DID NOT COMPLETE</p>
+
+<p>Rules from the stylesheet:</p>
+
+<pre id="result"></pre>
+
+<p>Expected result:</p>
+
+<pre id="expected">#a::after { content: '65:A 9:\9'; }
+#b::after { content: '128: 159:'; }
+#c::after { content: '1:\1'; }
+#d::after { content: '8:\8'; }
+#e::after { content: '9:\9'; }
+#f::after { }
+#g::after { content: '11:\b'; }
+#h::after { }
+#i::after { }
+#j::after { content: '14:\e'; }
+#k::after { content: '20:\14'; }
+#l::after { content: '30:\1e'; }
+#m::after { content: '31:\1f'; }
+#n::after { content: '127:\7f'; }
+#o::after { content: '384:ƀ'; }
+</pre>
+
+<script>
+
+</script>
+</body>
+
Modified: trunk/Source/WebCore/ChangeLog (99085 => 99086)
--- trunk/Source/WebCore/ChangeLog 2011-11-02 18:43:29 UTC (rev 99085)
+++ trunk/Source/WebCore/ChangeLog 2011-11-02 18:53:07 UTC (rev 99086)
@@ -1,3 +1,19 @@
+2011-11-02 Zoltan Herczeg <[email protected]>
+
+ Match allowed CSS string characters to Firefox and Opera browsers
+ https://bugs.webkit.org/show_bug.cgi?id=71000
+
+ Reviewed by Darin Adler.
+
+ Firefox and Opera accepts any character inside a string except
+ newline and starting quote character. This behaviour matches to
+ the CSS 2.1 grammar: http://www.w3.org/TR/CSS2/grammar.html
+ WebKit should follow them.
+
+ Test: fast/css/parsing-css-allowed-string-characters.html
+
+ * css/tokenizer.flex:
+
2011-11-02 Devdatta Deshpande <[email protected]>
Assert in MoveSelectionCommand::doApply
Modified: trunk/Source/WebCore/css/tokenizer.flex (99085 => 99086)
--- trunk/Source/WebCore/css/tokenizer.flex 2011-11-02 18:43:29 UTC (rev 99085)
+++ trunk/Source/WebCore/css/tokenizer.flex 2011-11-02 18:53:07 UTC (rev 99086)
@@ -12,8 +12,8 @@
escape {unicode}|\\[ -~\200-\377]
nmstart [_a-zA-Z]|{nonascii}|{escape}
nmchar [_a-zA-Z0-9-]|{nonascii}|{escape}
-string1 \"([\t !#$%&(-~]|\\{nl}|\'|{nonascii}|{escape})*\"
-string2 \'([\t !#$%&(-~]|\\{nl}|\"|{nonascii}|{escape})*\'
+string1 \"([^\n\r\f\\"]|\\{nl}|{escape})*\"
+string2 \'([^\n\r\f\\']|\\{nl}|{escape})*\'
ident -?{nmstart}{nmchar}*
num [0-9]+|[0-9]*"."[0-9]+
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes