Diff
Modified: trunk/LayoutTests/ChangeLog (89825 => 89826)
--- trunk/LayoutTests/ChangeLog 2011-06-27 16:32:23 UTC (rev 89825)
+++ trunk/LayoutTests/ChangeLog 2011-06-27 16:55:38 UTC (rev 89826)
@@ -1,3 +1,13 @@
+2011-06-27 Alexandru Chiculita <[email protected]>
+
+ Reviewed by Ojan Vafai.
+
+ css combinator "+" in combination with NAV tag is buggy
+ https://bugs.webkit.org/show_bug.cgi?id=47971
+
+ * fast/css/div_plus_nav_bug47971-expected.txt: Added.
+ * fast/css/div_plus_nav_bug47971.html: Added.
+
2011-06-27 Sheriff Bot <[email protected]>
Unreviewed, rolling out r89822.
Added: trunk/LayoutTests/fast/css/div_plus_nav_bug47971-expected.txt (0 => 89826)
--- trunk/LayoutTests/fast/css/div_plus_nav_bug47971-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/css/div_plus_nav_bug47971-expected.txt 2011-06-27 16:55:38 UTC (rev 89826)
@@ -0,0 +1,13 @@
+Testing label+nav selector. The test passes if all NAVs are green.
+
+NAV1
+NAV2
+NAV4
+NAV5
+NAV6
+Pass: nav1.
+Pass: nav2.
+Pass: nav3.
+Pass: nav4.
+Pass: nav5.
+
Added: trunk/LayoutTests/fast/css/div_plus_nav_bug47971.html (0 => 89826)
--- trunk/LayoutTests/fast/css/div_plus_nav_bug47971.html (rev 0)
+++ trunk/LayoutTests/fast/css/div_plus_nav_bug47971.html 2011-06-27 16:55:38 UTC (rev 89826)
@@ -0,0 +1,53 @@
+<!DOCTYPE HTML>
+
+<style>
+#one + nav { color: green; }
+#two+nav { color: green; }
+#three +nav { color: green; }
+#four+ nav { color: green; }
+label+nav { color: green; }
+</style>
+
+<p>Testing label+nav selector. The test passes if all NAVs are green.</p>
+
+<div id="one"></div>
+<nav id="nav1">NAV1</nav>
+
+<div id="two"></div>
+<nav id="nav2">NAV2</nav>
+
+<div id="three"></div>
+<nav id="nav3">NAV4</nav>
+
+<div id="four"></div>
+<nav id="nav4">NAV5</nav>
+
+<label></label>
+<nav id="nav5">NAV6</nav>
+
+<script type="text/_javascript_">
+if (window.layoutTestController)
+ window.layoutTestController.dumpAsText();
+
+function runTest(element)
+{
+ var greenValues = [
+ "rgb(0, 128, 0)", // WebKit, Firefox 4, IE9
+ "#008000" // Opera 11.11
+ ];
+
+ var elem = document.getElementById(element);
+ var val = getComputedStyle(elem, null).getPropertyValue("color");
+
+ if (greenValues.indexOf(val.toLowerCase()) != -1)
+ document.writeln("Pass: " + element + ".<br />");
+ else
+ document.writeln("Fail: " + element + " actual color is \"" + val + "\".<br />");
+}
+
+runTest("nav1");
+runTest("nav2");
+runTest("nav3");
+runTest("nav4");
+runTest("nav5");
+</script>
Modified: trunk/Source/WebCore/ChangeLog (89825 => 89826)
--- trunk/Source/WebCore/ChangeLog 2011-06-27 16:32:23 UTC (rev 89825)
+++ trunk/Source/WebCore/ChangeLog 2011-06-27 16:55:38 UTC (rev 89826)
@@ -1,3 +1,19 @@
+2011-06-27 Alexandru Chiculita <[email protected]>
+
+ Reviewed by Ojan Vafai.
+
+ css combinator "+" in combination with NAV tag is buggy
+ https://bugs.webkit.org/show_bug.cgi?id=47971
+
+ Added a new state in css/tokenizer.flex for the "nth" rule. The state begins
+ at nth-*( functions and ends at the first ")". It avoids parsing selectors
+ like "#div+nav" as: "#div" "+n" "av".
+
+ Test: fast/css/div_plus_nav_bug47971.html
+
+ * css/maketokenizer:
+ * css/tokenizer.flex:
+
2011-06-27 Sheriff Bot <[email protected]>
Unreviewed, rolling out r89822.
Modified: trunk/Source/WebCore/css/maketokenizer (89825 => 89826)
--- trunk/Source/WebCore/css/maketokenizer 2011-06-27 16:32:23 UTC (rev 89825)
+++ trunk/Source/WebCore/css/maketokenizer 2011-06-27 16:55:38 UTC (rev 89826)
@@ -49,6 +49,7 @@
#define INITIAL 0
#define mediaquery 1
#define forkeyword 2
+#define nthchild 3
/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
Modified: trunk/Source/WebCore/css/tokenizer.flex (89825 => 89826)
--- trunk/Source/WebCore/css/tokenizer.flex 2011-06-27 16:32:23 UTC (rev 89825)
+++ trunk/Source/WebCore/css/tokenizer.flex 2011-06-27 16:55:38 UTC (rev 89826)
@@ -4,6 +4,7 @@
%option stack
%s mediaquery
%s forkeyword
+%s nthchild
h [0-9a-fA-F]
nonascii [\200-\377]
@@ -23,6 +24,7 @@
nl \n|\r\n|\r|\f
range \?{1,6}|{h}(\?{0,5}|{h}(\?{0,4}|{h}(\?{0,3}|{h}(\?{0,2}|{h}(\??|{h})))))
nth [\+-]?{intnum}*n([\t\r\n ]*[\+-][\t\r\n ]*{intnum})?
+nthfunc "nth-"("child"|"of-type"|"last-child"|"last-of-type")
%%
@@ -43,7 +45,8 @@
{string} {yyTok = STRING; return yyTok;}
{ident} {yyTok = IDENT; return yyTok;}
-{nth} {yyTok = NTH; return yyTok;}
+<nthchild>{nth} {yyTok = NTH; return yyTok;}
+<nthchild>")" {BEGIN(INITIAL); yyTok = *yytext; return yyTok;}
"#"{h}+ {yyTok = HEX; return yyTok;}
"#"{ident} {yyTok = IDSEL; return yyTok;}
@@ -113,6 +116,7 @@
"-webkit-calc(" {yyTok = CALCFUNCTION; return yyTok;}
"-webkit-min(" {yyTok = MINFUNCTION; return yyTok;}
"-webkit-max(" {yyTok = MAXFUNCTION; return yyTok;}
+{nthfunc}"(" {BEGIN(nthchild); yyTok = FUNCTION; return yyTok;}
{ident}"(" {yyTok = FUNCTION; return yyTok;}
U\+{range} {yyTok = UNICODERANGE; return yyTok;}