+2007-06-28 Rob Buis <buis@kde.org>
+
+ Reviewed by Maciej.
+
+ http://bugs.webkit.org/show_bug.cgi?id=14373
+ CSS1: selectors (classes and IDs) cannot start with a dash or with a digit
+
+ These are improvements due to stricter id selector checking.
+
+ * css2.1/css1_forward_compatible_parsing-expected.checksum: Added.
+ * css2.1/css1_forward_compatible_parsing-expected.png: Added.
+ * css2.1/css1_forward_compatible_parsing-expected.txt: Added.
+ * css2.1/css1_forward_compatible_parsing.html: Added.
+ * css2.1/t040103-ident-08-c-expected.checksum:
+ * css2.1/t040103-ident-08-c-expected.png:
+ * css2.1/t040103-ident-08-c-expected.txt:
+ * css2.1/t0509-id-sel-syntax-01-f-expected.checksum:
+ * css2.1/t0509-id-sel-syntax-01-f-expected.png:
+ * css2.1/t0509-id-sel-syntax-01-f-expected.txt:
+
2007-06-28 Antti Koivisto <antti@apple.com>
Reviewed by Mitz.
--- /dev/null
+20988752587ed8b7c4beadc7fa054940
\ No newline at end of file
--- /dev/null
+layer at (0,0) size 800x600
+ RenderView at (0,0) size 800x600
+layer at (0,0) size 800x399
+ RenderBlock {HTML} at (0,0) size 800x399
+ RenderBody {BODY} at (8,16) size 784x367
+ RenderBlock {DIV} at (0,0) size 784x36 [color=#008000] [bgcolor=#FFFFFF]
+ RenderBlock {P} at (0,0) size 784x36
+ RenderText {#text} at (0,0) size 773x36
+ text run at (0,0) width 773: "First sentence: this text should be green. The markup code is invalid according to W3C HTML validator and the CSS code"
+ text run at (0,18) width 273: "is invalid according to W3C CSS validator."
+ RenderBlock {DIV} at (0,52) size 784x36 [color=#008000] [bgcolor=#FFFFFF]
+ RenderBlock {P} at (0,0) size 784x36 [color=#FF0000]
+ RenderText {#text} at (0,0) size 776x36
+ text run at (0,0) width 776: "Second sentence: this text should be green according to CSS 1 but it should be red according to CSS 2.1. The markup code"
+ text run at (0,18) width 753: "is also invalid according to W3C HTML validator but the CSS code is perfectly valid according to W3C CSS validator."
+ RenderBlock {H3} at (0,106) size 784x44 [color=#008000] [bgcolor=#FFFFFF]
+ RenderText {#text} at (0,0) size 767x44
+ text run at (0,0) width 767: "Third sentence: this text should be green. The markup code is valid according to W3C HTML"
+ text run at (0,22) width 581: "validator but the CSS code is invalid according to W3C CSS validator."
+ RenderBlock {H4} at (0,171) size 784x54 [color=#FF0000] [bgcolor=#FFFFFF]
+ RenderText {#text} at (0,0) size 776x54
+ text run at (0,0) width 776: "Fourth sentence: this text should be green according to CSS 1 (class name can not start with a dash in CSS 1) but it"
+ text run at (0,18) width 773: "should be red according to CSS 2.1 and the markup code is valid according to W3C HTML validator and the CSS"
+ text run at (0,36) width 376: "code is perfectly valid according to W3C CSS validator."
+ RenderBlock {H5} at (0,251) size 784x72 [color=#800080] [bgcolor=#FFFFFF]
+ RenderText {#text} at (0,0) size 775x72
+ text run at (0,0) width 761: "Fifth sentence: this text should be green according to CSS 1 (class name can not start with a dash in CSS 1) but it"
+ text run at (0,18) width 775: "should be purple according to latest CSS 2.1 WD (class name can not start with a dash unless immediately followed"
+ text run at (0,36) width 771: "by [_A-Za-z] character in CSS 2.1) and the markup code is valid according to W3C HTML validator and the CSS"
+ text run at (0,54) width 402: "code is perfectly valid according to the W3C CSS validator!"
+ RenderBlock {P} at (0,349) size 784x18
+ RenderText {#text} at (0,0) size 27x18
+ text run at (0,0) width 27: "See "
+ RenderInline {A} at (0,0) size 71x18 [color=#0000EE]
+ RenderText {#text} at (27,0) size 71x18
+ text run at (27,0) width 71: "Bug 14373"
+ RenderInline {A} at (0,0) size 4x18
+ RenderText {#text} at (98,0) size 4x18
+ text run at (98,0) width 4: "."
+ RenderBlock (anonymous) at (0,383) size 784x0
+ RenderInline {A} at (0,0) size 0x0
+ RenderText {#text} at (0,0) size 0x0
+ RenderText {#text} at (0,0) size 0x0
+ RenderText {#text} at (0,0) size 0x0
--- /dev/null
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">\r
+<html>\r
+<head>\r
+<title>CSS selectors (classes and IDs) cannot start with a dash or with a digit</title>\r
+\r
+<style type="text/css">\r
+#divWrapper1 {color: green; background-color: white;}\r
+#1stSentence {color: red; background-color: white;}\r
+\r
+#divWrapper2 {color: green; background-color: white;}\r
+#-secondSentence {color: red; background-color: white; }\r
+\r
+h3 {color: green; background-color: white;}\r
+.3rdSentence {color: red; background-color: white;}\r
+\r
+h4 {color: green; background-color: white;}\r
+.-fourthSentence {color: red; background-color: white;}\r
+\r
+h5 {color: green; background-color: white; font-size: 100%;}\r
+.-_ {color: purple; background-color: white;}\r
+</style>\r
+</head>\r
+\r
+<body>\r
+<div id="divWrapper1"><p id="1stSentence">First sentence: this text should be green. The markup code is invalid according to W3C HTML validator and the CSS code is invalid according to W3C CSS validator.</p></div>\r
+<div id="divWrapper2"><p id="-secondSentence">Second sentence: this text should be green according to CSS 1 but it should be red according to CSS 2.1. The markup code is also invalid according to W3C HTML validator but the CSS code is perfectly valid according to W3C CSS validator.</p></div>\r
+<h3 class="3rdSentence">Third sentence: this text should be green. The markup code is valid according to W3C HTML validator but the CSS code is invalid according to W3C CSS validator.</h3>\r
+<h4 class="-fourthSentence">Fourth sentence: this text should be green according to CSS 1 (class name can not start with a dash in CSS 1) but it should be red according to CSS 2.1 and the markup code is valid according to W3C HTML validator and the CSS code is perfectly valid according to W3C CSS validator.</h4>\r
+<h5 class="-_">Fifth sentence: this text should be green according to CSS 1 (class name can not start with a dash in CSS 1) but it should be purple according to latest CSS 2.1 WD (class name can not start with a dash unless immediately followed by [_A-Za-z] character in CSS 2.1) and the markup code is valid according to W3C HTML validator and the CSS code is perfectly valid according to the W3C CSS validator!</h5>\r
+<p>See <a href="http://bugs.webkit.org/show_bug.cgi?id=14373">Bug 14373<a>.</p>\r
+</body>\r
+</html>\r
-527466bfe479dba986be26455d5097c7
\ No newline at end of file
+cf6d4663f13ae5ddae0293140bbd41ac
\ No newline at end of file
RenderBlock {P} at (0,0) size 784x18 [color=#008000] [bgcolor=#FFFFFF]
RenderText {#text} at (0,0) size 136x18
text run at (0,0) width 136: "This should be green."
- RenderBlock {P} at (0,34) size 784x18 [color=#FF0000] [bgcolor=#FFFFFF]
+ RenderBlock {P} at (0,34) size 784x18 [color=#008000] [bgcolor=#FFFFFF]
RenderText {#text} at (0,0) size 136x18
text run at (0,0) width 136: "This should be green."
-495eb5e95a0cc013039e9288c322af98
\ No newline at end of file
+9639d8028649f506d5f3d48c465eb0cc
\ No newline at end of file
RenderBlock {HTML} at (0,0) size 800x50
RenderBody {BODY} at (8,16) size 784x18
RenderBlock {DIV} at (0,0) size 784x18 [color=#008000]
- RenderBlock {P} at (0,0) size 784x18 [color=#FF0000]
+ RenderBlock {P} at (0,0) size 784x18
RenderText {#text} at (0,0) size 159x18
text run at (0,0) width 159: "This text should be green"
+2007-06-28 Rob Buis <buis@kde.org>
+
+ Reviewed by Maciej.
+
+ http://bugs.webkit.org/show_bug.cgi?id=14373
+ CSS1: selectors (classes and IDs) cannot start with a dash or with a digit
+
+ Make sure the id selector validates against the CSS2.1 identfier
+ definition, not the hexcolor/HASH definition.
+
+ * css/CSSGrammar.y:
+ * css/cssparser.cpp:
+ (WebCore::CSSParser::lex):
+ (WebCore::CSSParser::text):
+ * css/tokenizer.flex:
+
2007-06-28 Simon Hausmann <hausmann@kde.org>
Reviewed by Zack.
%right <string> IDENT
-%nonassoc <string> HASH
+%nonassoc <string> HEX_OR_IDENT
+%nonassoc <string> IDSEL
%nonassoc ':'
%nonassoc '.'
%nonassoc '['
;
specifier:
- HASH {
+ HEX_OR_IDENT {
+ CSSParser* p = static_cast<CSSParser*>(parser);
+ $$ = p->createFloatingSelector();
+ $$->m_match = CSSSelector::Id;
+ if (!p->strict)
+ $1.lower();
+ $$->m_attr = idAttr;
+ $$->m_value = atomicString($1);
+ }
+ | IDSEL {
CSSParser* p = static_cast<CSSParser*>(parser);
$$ = p->createFloatingSelector();
$$->m_match = CSSSelector::Id;
* after the "#"; e.g., "#000" is OK, but "#abcd" is not.
*/
hexcolor:
- HASH maybe_space { $$ = $1; }
+ HEX_OR_IDENT maybe_space { $$ = $1; }
;
case URI:
case STRING:
case IDENT:
- case HASH:
+ case HEX_OR_IDENT:
+ case IDSEL:
case DIMEN:
case UNICODERANGE:
case FUNCTION:
case STRING:
l--;
/* nobreak */
- case HASH:
+ case HEX_OR_IDENT:
+ case IDSEL:
start++;
l--;
break;
nmchar [_a-zA-Z0-9-]|{nonascii}|{escape}
string1 \"([\t !#$%&(-~]|\\{nl}|\'|{nonascii}|{escape})*\"
string2 \'([\t !#$%&(-~]|\\{nl}|\"|{nonascii}|{escape})*\'
+hexcolor {h}{3}|{h}{6}
ident -?{nmstart}{nmchar}*
name {nmchar}+
{ident} {yyTok = IDENT; return yyTok;}
-"#"{name} {yyTok = HASH; return yyTok;}
+"#"{hexcolor} {yyTok = HEX_OR_IDENT; return yyTok;}
+"#"{ident} {yyTok = IDSEL; return yyTok;}
"@import" {BEGIN(mediaquery); yyTok = IMPORT_SYM; return yyTok;}
"@page" {yyTok = PAGE_SYM; return yyTok;}