LayoutTests/ChangeLog

 12011-02-14 Mike Lawther <mikelawther@chromium.org>
 2
 3 Reviewed by NOBODY (OOPS!).
 4
 5 flex/bison tokens and grammar for CSS calc
 6 https://bugs.webkit.org/show_bug.cgi?id=54412
 7
 8 Only the 'errors' tests pass as ultimately intended right now. As of this
 9 patch, none of the actual calculations are expected to work, since only
 10 the lexing/grammar stage is present.
 11
 12 * css3/calc/calc-errors-expected.txt: Added.
 13 * css3/calc/calc-errors.html: Added.
 14 * css3/calc/simple-calcs-expected.txt: Added.
 15 * css3/calc/simple-calcs.html: Added.
 16 * css3/calc/simple-minmax-expected.txt: Added.
 17 * css3/calc/simple-minmax.html: Added.
 18
1192011-02-13 Shinichiro Hamaji <hamaji@chromium.org>
220
321 Fix chromium's test_expectations

LayoutTests/css3/calc/calc-errors-expected.txt

 1All boxes below should be 100px * 100px and green.
 2
 3zero division => PASS
 4non length => PASS
 5number + length => PASS
 6length - number => PASS
 7length * length => PASS
 8number / length => PASS
 9number mod length => PASS
 10mod10 => PASS
 111mod => PASS
 1270px+40px no whitespace around + => PASS
 1370px +40px no whitespace on right of + => PASS
 1470px+ 40px no whitespace on left of + => PASS
 1570px+-40px no whitespace around + => PASS
 1670px-40px no whitespace around - => PASS
 1770px -40px no whitespace on right of - => PASS
 1870px- 40px no whitespace on left of - => PASS
 1970px-+40px no whitespace around - => PASS
 20too many nests => PASS
 21end with operator => PASS
 22start with operator => PASS
 23no expressions => PASS
 24too many pluses => PASS
 25no binary operator => PASS
 26two binary operators => PASS

LayoutTests/css3/calc/calc-errors.html

 1<html>
 2<head>
 3
 4<style>
 5#test div {
 6 height: 100px;
 7 background-color: red;
 8}
 9</style>
 10
 11<script>
 12if (window.layoutTestController)
 13 layoutTestController.dumpAsText();
 14
 15function test()
 16{
 17 var test = document.getElementById("test");
 18 for (var element = test.firstChild; element; element = element.nextSibling) {
 19 var width = element.offsetWidth;
 20 var error = [];
 21 if (width != 100)
 22 error.push("expected width of 100, but was " + width);
 23 var height = element.offsetHeight;
 24 if (height != 100)
 25 error.push("expected height of 100, but was " + width);
 26
 27 if (error == "") {
 28 element.style.backgroundColor = "green";
 29 element.innerHTML += " => PASS";
 30 } else {
 31 element.innerHTML += " => FAIL: " + error.join(", ");
 32 }
 33 }
 34}
 35</script>
 36</head>
 37
 38<body onload="test()">
 39
 40<p>
 41 All boxes below should be 100px * 100px and green.
 42</p>
 43
 44<div id="test">
 45
 46<!-- zero division -->
 47<div style="width: 100px; width: -webkit-calc(1ex / 0);">zero division</div>
 48
 49<!-- wrong combination -->
 50<div style="width: 100px; width: -webkit-calc(200);">non length</div>
 51<div style="width: 100px; width: -webkit-calc(100 + 100px);">number + length</div>
 52<div style="width: 100px; width: -webkit-calc(300px - 100);">length - number</div>
 53<div style="width: 100px; width: -webkit-calc(100px*100px);">length * length</div>
 54<div style="width: 100px; width: -webkit-calc(100/100px);">number / length</div>
 55<div style="width: 100px; width: -webkit-calc(100 mod 100px);">number mod length</div>
 56
 57<!-- mod, +, - require whitespaces around the operator -->
 58<div style="width: 100px; width: -webkit-calc(1 mod10 * 200px);">mod10 </div>
 59<div style="width: 100px; width: -webkit-calc(1mod 10 * 200px);">1mod</div>
 60<div style="width: 100px; width: -webkit-calc(70px+40px);">70px+40px no whitespace around + </div>
 61<div style="width: 100px; width: -webkit-calc(70px +40px);">70px +40px no whitespace on right of +</div>
 62<div style="width: 100px; width: -webkit-calc(70px+ 40px);">70px+ 40px no whitespace on left of +</div>
 63<div style="width: 100px; width: -webkit-calc(70px+-40px);">70px+-40px no whitespace around + </div>
 64<div style="width: 100px; width: -webkit-calc(70px-40px);">70px-40px no whitespace around - </div>
 65<div style="width: 100px; width: -webkit-calc(70px -40px);">70px -40px no whitespace on right of -</div>
 66<div style="width: 100px; width: -webkit-calc(70px- 40px);">70px- 40px no whitespace on left of -</div>
 67<div style="width: 100px; width: -webkit-calc(70px-+40px);">70px-+40px no whitespace around - </div>
 68
 69<!-- too many nests should be rejected to avoid stack overflow -->
 70<div style="width: 100px; width: -webkit-calc(((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((200px)))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))));">too many nests</div>
 71
 72<!-- invalid formulas -->
 73<div style="width: 100px; width: -webkit-calc(200px*);">end with operator</div>
 74<div style="width: 100px; width: -webkit-calc(+ +200px);">start with operator</div>
 75<div style="width: 100px; width: -webkit-calc();">no expressions</div>
 76<div style="width: 100px; width: -webkit-calc(100px + + +100px);">too many pluses</div>
 77<div style="width: 100px; width: -webkit-calc(200px 200px);">no binary operator</div>
 78<div style="width: 100px; width: -webkit-calc(100px * * 2);">two binary operators</div>
 79
 80</div>
 81
 82</body>
 83
 84</html>

LayoutTests/css3/calc/simple-calcs-expected.txt

 1All boxes below should be 100px * 100px and green.
 2
 350px + 50px => FAIL: expected width of 100, but was 256
 4150px - 50px => FAIL: expected width of 100, but was 256
 550px + 50px (2 spaces around operator) => FAIL: expected width of 100, but was 256
 6150px - 50px (2 spaces around operator) => FAIL: expected width of 100, but was 256
 750px*2 => FAIL: expected width of 100, but was 256
 850px *2 => FAIL: expected width of 100, but was 256
 950px* 2 => FAIL: expected width of 100, but was 256
 10200px/2 => FAIL: expected width of 100, but was 256
 11200px /2 => FAIL: expected width of 100, but was 256
 12200px/ 2 => FAIL: expected width of 100, but was 256
 1350px + 10px * 5 (operation order) => FAIL: expected width of 100, but was 256
 141100px mod 1000 => FAIL: expected width of 100, but was 256
 15100%/2 (where 100% is 200px) => FAIL: expected width of 100, but was 256
 16(100px) => FAIL: expected width of 100, but was 256
 17(50px + 50px) => FAIL: expected width of 100, but was 256
 18(50px) + 50px => FAIL: expected width of 100, but was 256
 1950px + (50px) => FAIL: expected width of 100, but was 256
 2050px + 50px => FAIL: expected width of 100, but was 256
 2150px + 25px * 2 => FAIL: expected width of 100, but was 256
 22(25px + 25px) * 2 => FAIL: expected width of 100, but was 256
 232 * 50px => FAIL: expected width of 100, but was 256
 242 * 100px / 2 => FAIL: expected width of 100, but was 256
 25100px / 50px * 50px => FAIL: expected width of 100, but was 256
 2612 mod 10 * 50px => FAIL: expected width of 100, but was 256
 27(1em - 1em) + 100px => FAIL: expected width of 100, but was 256
 2850px + +50px => FAIL: expected width of 100, but was 256
 29-50px + 150px => FAIL: expected width of 100, but was 256
 30-50px - -150px => FAIL: expected width of 100, but was 256
 31(((((((100px))))))) => FAIL: expected width of 100, but was 256
 32100px => FAIL: expected height of 100, but was 50
 33100% * 2 => FAIL: expected height of 100, but was 50

LayoutTests/css3/calc/simple-calcs.html

 1<html>
 2<head>
 3
 4<style>
 5.width-test {
 6 height: 100px;
 7 width: 256px;
 8 background-color: red;
 9}
 10
 11.height-test {
 12 width: 100px;
 13 height: 50px;
 14 background-color: red;
 15}
 16
 17</style>
 18
 19<script>
 20if (window.layoutTestController)
 21 layoutTestController.dumpAsText();
 22
 23function test()
 24{
 25 var test = document.getElementById("test");
 26 for (var child = test.firstChild; child; child = child.nextSibling) {
 27 var element = child;
 28 if (element.className == "wrapper") {
 29 element = element.firstChild;
 30 while (element.tagName != "DIV") element = element.nextSibling;
 31 }
 32
 33 var width = element.offsetWidth;
 34 var error = [];
 35 if (width != 100)
 36 error.push("expected width of 100, but was " + width);
 37 var height = element.offsetHeight;
 38 if (height != 100)
 39 error.push("expected height of 100, but was " + height);
 40
 41 if (error == "") {
 42 element.style.backgroundColor = "green";
 43 element.innerHTML += " => PASS";
 44 } else
 45 element.innerHTML += " => FAIL: " + error.join(", ");
 46 }
 47}
 48</script>
 49</head>
 50
 51<body onload="test()">
 52
 53<p>
 54 All boxes below should be 100px * 100px and green.
 55</p>
 56
 57<div id="test">
 58
 59<div class="width-test" style="width: -webkit-calc(50px + 50px);">50px + 50px</div>
 60<div class="width-test" style="width: -webkit-calc(150px - 50px);">150px - 50px</div>
 61<div class="width-test" style="width: -webkit-calc(50px + 50px);">50px + 50px (2 spaces around operator)</div>
 62<div class="width-test" style="width: -webkit-calc(150px - 50px);">150px - 50px (2 spaces around operator)</div>
 63<div class="width-test" style="width: -webkit-calc(50px*2);">50px*2</div>
 64<div class="width-test" style="width: -webkit-calc(50px *2);">50px *2</div>
 65<div class="width-test" style="width: -webkit-calc(50px* 2);">50px* 2</div>
 66<div class="width-test" style="width: -webkit-calc(200px/2);">200px/2</div>
 67<div class="width-test" style="width: -webkit-calc(200px /2);">200px /2</div>
 68<div class="width-test" style="width: -webkit-calc(200px/ 2);">200px/ 2</div>
 69<div class="width-test" style="width: -webkit-calc(50px + 10px * 5);">50px + 10px * 5 (operation order)</div>
 70<div class="width-test" style="width: -webkit-calc(1100px mod 1000);">1100px mod 1000</div>
 71<div style="width: 200px; background-color: white;" class="wrapper">
 72 <div class="width-test" style="width: -webkit-calc(100%/2);">100%/2 (where 100% is 200px)</div>
 73</div>
 74<div class="width-test" style="width: -webkit-calc((100px));">(100px)</div>
 75<div class="width-test" style="width: -webkit-calc((50px + 50px));">(50px + 50px)</div>
 76<div class="width-test" style="width: -webkit-calc((50px) + 50px);">(50px) + 50px</div>
 77<div class="width-test" style="width: -webkit-calc(50px + (50px));">50px + (50px)</div>
 78<div class="width-test" style="width: -webkit-calc( 50px + 50px );"> 50px + 50px </div>
 79<div class="width-test" style="width: -webkit-calc( 50px + 25px * 2 );"> 50px + 25px * 2 </div>
 80<div class="width-test" style="width: -webkit-calc( (25px + 25px) * 2 );"> (25px + 25px) * 2 </div>
 81<div class="width-test" style="width: -webkit-calc(2 * 50px);">2 * 50px</div>
 82<div class="width-test" style="width: -webkit-calc(2 * 100px / 2);">2 * 100px / 2</div>
 83<div class="width-test" style="width: -webkit-calc(100px / 50px * 50px);">100px / 50px * 50px</div>
 84<div class="width-test" style="width: -webkit-calc(12 mod 10 * 50px);">12 mod 10 * 50px</div>
 85<div class="width-test" style="width: -webkit-calc((1em - 1em) + 100px);">(1em - 1em) + 100px</div>
 86<div class="width-test" style="width: -webkit-calc(50px + +50px);">50px + +50px</div>
 87<div class="width-test" style="width: -webkit-calc(-50px + 150px);">-50px + 150px</div>
 88<div class="width-test" style="width: -webkit-calc(-50px - -150px);">-50px - -150px</div>
 89<div class="width-test" style="width: -webkit-calc((((((((100px))))))));">(((((((100px)))))))</div>
 90<div class="height-test" style="height: -webkit-calc(100px);">100px</div>
 91<div style="height: 50px; background-color: white;" class="wrapper">
 92 <div class="height-test" style="height: -webkit-calc(100% * 2);">100% * 2</div>
 93</div>
 94
 95</div>
 96
 97</body>
 98
 99</html>

LayoutTests/css3/calc/simple-minmax-expected.txt

 1All boxes below should be 100px * 100px and green.
 2
 3min(100px) => FAIL: expected width of 100, but was 256
 4min( 100px ) => FAIL: expected width of 100, but was 256
 5min((((100px)))) => FAIL: expected width of 100, but was 256
 6min(150px,100px) => FAIL: expected width of 100, but was 256
 7min(150px,100px,200px) => FAIL: expected width of 100, but was 256
 8min( 150px ,100px ,200px) => FAIL: expected width of 100, but was 256
 9min(90px + 50px,100px) => FAIL: expected width of 100, but was 256
 10min(100%,100px) - where 100% is 200px => FAIL: expected width of 100, but was 256
 11min(100px,100%) - where 100% is 200px => FAIL: expected width of 100, but was 256
 12max(100px) => FAIL: expected width of 100, but was 256
 13max(50px,100px) => FAIL: expected width of 100, but was 256
 14max(50px,100px,20px) => FAIL: expected width of 100, but was 256
 15max(120px - 50px,100px) => FAIL: expected width of 100, but was 256
 16max(100%,100px) - where 100% is 50px => FAIL: expected width of 100, but was 256
 17max(100px,100%) - where 100% is 50px => FAIL: expected width of 100, but was 256
 18min(200px,100px) => FAIL: expected height of 100, but was 50

LayoutTests/css3/calc/simple-minmax.html

 1<html>
 2<head>
 3
 4<style>
 5.width-test {
 6 height: 100px;
 7 width: 256px;
 8 background-color: red;
 9}
 10
 11.height-test {
 12 width: 100px;
 13 height: 50px;
 14 background-color: red;
 15}
 16</style>
 17
 18<script>
 19if (window.layoutTestController)
 20 layoutTestController.dumpAsText();
 21
 22function test()
 23{
 24 var test = document.getElementById("test");
 25 for (var child = test.firstChild; child; child = child.nextSibling) {
 26 var element = child;
 27 if (element.className == "wrapper") {
 28 element = element.firstChild;
 29 while (element.tagName != "DIV") element = element.nextSibling;
 30 }
 31
 32 var width = element.offsetWidth;
 33 var error = [];
 34 if (width != 100)
 35 error.push("expected width of 100, but was " + width);
 36 var height = element.offsetHeight;
 37 if (height != 100)
 38 error.push("expected height of 100, but was " + height);
 39
 40 if (error == "") {
 41 element.style.backgroundColor = "green";
 42 element.innerHTML += " => PASS";
 43 } else
 44 element.innerHTML += " => FAIL: " + error.join(", ");
 45 }
 46}
 47</script>
 48</head>
 49
 50<body onload="test()">
 51
 52<p>
 53 All boxes below should be 100px * 100px and green.
 54</p>
 55
 56<div id="test">
 57
 58<div class="width-test" style="width: -webkit-min(100px);">min(100px)</div>
 59<div class="width-test" style="width: -webkit-min( 100px );">min( 100px )</div>
 60<div class="width-test" style="width: -webkit-min((((100px))));">min((((100px))))</div>
 61<div class="width-test" style="width: -webkit-min(150px,100px);">min(150px,100px)</div>
 62<div class="width-test" style="width: -webkit-min(150px,100px,200px);">min(150px,100px,200px)</div>
 63<div class="width-test" style="width: -webkit-min( 150px ,100px ,200px);">min( 150px ,100px ,200px)</div>
 64<div class="width-test" style="width: -webkit-min(90px + 50px,100px);">min(90px + 50px,100px)</div>
 65<div style="width: 200px; background-color: white;" class="wrapper">
 66 <div class="width-test" style="width: -webkit-min(100%,100px);">min(100%,100px) - where 100% is 200px</div>
 67</div>
 68<div style="width: 200px; background-color: white;" class="wrapper">
 69 <div class="width-test" style="width: -webkit-min(100px,100%);">min(100px,100%) - where 100% is 200px</div>
 70</div>
 71
 72<div class="width-test" style="width: -webkit-max(100px);">max(100px)</div>
 73<div class="width-test" style="width: -webkit-max(50px,100px);">max(50px,100px)</div>
 74<div class="width-test" style="width: -webkit-max(50px,100px,20px);">max(50px,100px,20px)</div>
 75<div class="width-test" style="width: -webkit-max(120px - 50px,100px);">max(120px - 50px,100px)</div>
 76<div style="width: 50px; background-color: white;" class="wrapper">
 77 <div class="width-test" style="width: -webkit-max(100%,100px);">max(100%,100px) - where 100% is 50px</div>
 78</div>
 79<div style="width: 50px; background-color: white;" class="wrapper">
 80 <div class="width-test" style="width: -webkit-max(100px,100%);">max(100px,100%) - where 100% is 50px</div>
 81</div>
 82
 83<div class="height-test" style="height: -webkit-min(200px, 100px);">min(200px,100px)</div>
 84
 85</div>
 86
 87</body>
 88
 89</html>

Source/WebCore/ChangeLog

 12011-02-14 Mike Lawther <mikelawther@chromium.org>
 2
 3 Reviewed by NOBODY (OOPS!).
 4
 5 flex/bison tokens and grammar for CSS calc
 6 https://bugs.webkit.org/show_bug.cgi?id=54412
 7
 8 Tests: css3/calc/calc-errors.html
 9 css3/calc/simple-calcs.html
 10 css3/calc/simple-minmax.html
 11
 12 * css/CSSGrammar.y:
 13 * css/CSSParserValues.cpp:
 14 (WebCore::CSSParserValueList::insertValueAt):
 15 (WebCore::CSSParserValueList::append):
 16 * css/CSSParserValues.h:
 17 * css/tokenizer.flex:
 18
1192011-02-13 Andreas Kling <kling@webkit.org>
220
321 Reviewed by Dirk Schulze.

Source/WebCore/css/CSSGrammar.y

@@static int cssyylex(YYSTYPE* yylval, void* parser)
9999
100100%}
101101
102 %expect 51
 102%expect 55
103103
104104%nonassoc LOWEST_PREC
105105

@@static int cssyylex(YYSTYPE* yylval, void* parser)
183183%token <number> HERTZ
184184%token <number> KHERTZ
185185%token <string> DIMEN
 186%token <string> INVALIDDIMEN
186187%token <number> PERCENTAGE
187188%token <number> FLOATTOKEN
188189%token <number> INTEGER

@@static int cssyylex(YYSTYPE* yylval, void* parser)
190191%token <string> URI
191192%token <string> FUNCTION
192193%token <string> NOTFUNCTION
 194%token <string> CALCFUNCTION
 195%token <string> MINFUNCTION
 196%token <string> MAXFUNCTION
193197
194198%token <string> UNICODERANGE
195199

@@static int cssyylex(YYSTYPE* yylval, void* parser)
270274%type <value> term
271275%type <value> unary_term
272276%type <value> function
 277%type <value> calc_func_term
 278%type <character> calc_func_operator
 279%type <valueList> calc_func_expr
 280%type <valueList> calc_func_expr_list
 281%type <valueList> calc_func_paren_expr
 282%type <value> calc_function
 283%type <string> min_or_max
 284%type <value> min_or_max_function
273285
274286%type <string> element_name
275287%type <string> attr_name

@@term:
14211433 | function {
14221434 $$ = $1;
14231435 }
 1436 | calc_function {
 1437 $$ = $1;
 1438 }
 1439 | min_or_max_function {
 1440 $$ = $1;
 1441 }
14241442 | '%' maybe_space { /* Handle width: %; */
14251443 $$.id = 0; $$.unit = 0;
14261444 }

@@function:
14771495 $$.function = f;
14781496 }
14791497 ;
 1498
 1499calc_func_term:
 1500 term
 1501 ;
 1502
 1503calc_func_operator:
 1504 '+' WHITESPACE {
 1505 $$ = '+';
 1506 }
 1507 | '-' WHITESPACE {
 1508 $$ = '-';
 1509 }
 1510 | '*' maybe_space {
 1511 $$ = '*';
 1512 }
 1513 | '/' maybe_space {
 1514 $$ = '/';
 1515 }
 1516 | IDENT maybe_space {
 1517 if (equalIgnoringCase("mod", $1.characters, $1.length))
 1518 $$ = '%';
 1519 else
 1520 YYERROR;
 1521 }
 1522 ;
 1523
 1524calc_func_paren_expr:
 1525 '(' maybe_space calc_func_expr maybe_space ')' maybe_space {
 1526 $$ = $3;
 1527 if ($$) {
 1528 CSSParserValue v;
 1529 v.id = 0;
 1530 v.unit = CSSParserValue::Operator;
 1531 v.iValue = '(';
 1532 $$->insertValueAt(0, v);
 1533 v.iValue = ')';
 1534 $$->addValue(v);
 1535 }
 1536 }
 1537
 1538calc_func_expr:
 1539 calc_func_term maybe_space {
 1540 CSSParser* p = static_cast<CSSParser*>(parser);
 1541 $$ = p->createFloatingValueList();
 1542 $$->addValue(p->sinkFloatingValue($1));
 1543 }
 1544 | calc_func_expr calc_func_operator calc_func_term {
 1545 CSSParser* p = static_cast<CSSParser*>(parser);
 1546 $$ = $1;
 1547 if ($$) {
 1548 if ($2) {
 1549 CSSParserValue v;
 1550 v.id = 0;
 1551 v.unit = CSSParserValue::Operator;
 1552 v.iValue = $2;
 1553 $$->addValue(v);
 1554 }
 1555 $$->addValue(p->sinkFloatingValue($3));
 1556 }
 1557 }
 1558 | calc_func_expr calc_func_operator calc_func_paren_expr {
 1559 $$ = $1;
 1560 if ($$) {
 1561 if ($2) {
 1562 CSSParserValue v;
 1563 v.id = 0;
 1564 v.unit = CSSParserValue::Operator;
 1565 v.iValue = $2;
 1566 $$->addValue(v);
 1567 }
 1568 if ($3)
 1569 $$->append(*($3));
 1570 }
 1571 }
 1572 | calc_func_paren_expr
 1573 | calc_func_expr error {
 1574 $$ = 0;
 1575 }
 1576 ;
 1577
 1578calc_func_expr_list:
 1579 calc_func_expr {
 1580 $$ = $1;
 1581 }
 1582 | calc_func_expr_list ',' maybe_space calc_func_expr {
 1583 $$ = $1;
 1584 if ($$) {
 1585 CSSParserValue v;
 1586 v.id = 0;
 1587 v.unit = CSSParserValue::Operator;
 1588 v.iValue = ',';
 1589 $$->addValue(v);
 1590 $$->append(*($4));
 1591 }
 1592 }
 1593
 1594
 1595calc_function:
 1596 CALCFUNCTION maybe_space calc_func_expr ')' maybe_space {
 1597 CSSParser* p = static_cast<CSSParser*>(parser);
 1598 CSSParserFunction* f = p->createFloatingFunction();
 1599 f->name = $1;
 1600 f->args = p->sinkFloatingValueList($3);
 1601 $$.id = 0;
 1602 $$.unit = CSSParserValue::Function;
 1603 $$.function = f;
 1604 }
 1605 | CALCFUNCTION maybe_space error {
 1606 CSSParser* p = static_cast<CSSParser*>(parser);
 1607 CSSParserFunction* f = p->createFloatingFunction();
 1608 f->name = $1;
 1609 f->args = 0;
 1610 $$.id = 0;
 1611 $$.unit = CSSParserValue::Function;
 1612 $$.function = f;
 1613 }
 1614 ;
 1615
 1616
 1617min_or_max:
 1618 MINFUNCTION {
 1619 $$ = $1;
 1620 }
 1621 | MAXFUNCTION {
 1622 $$ = $1;
 1623 }
 1624 ;
 1625
 1626min_or_max_function:
 1627 min_or_max maybe_space calc_func_expr_list ')' maybe_space {
 1628 CSSParser* p = static_cast<CSSParser*>(parser);
 1629 CSSParserFunction* f = p->createFloatingFunction();
 1630 f->name = $1;
 1631 f->args = p->sinkFloatingValueList($3);
 1632 $$.id = 0;
 1633 $$.unit = CSSParserValue::Function;
 1634 $$.function = f;
 1635 }
 1636 | min_or_max maybe_space error {
 1637 CSSParser* p = static_cast<CSSParser*>(parser);
 1638 CSSParserFunction* f = p->createFloatingFunction();
 1639 f->name = $1;
 1640 f->args = 0;
 1641 $$.id = 0;
 1642 $$.unit = CSSParserValue::Function;
 1643 $$.function = f;
 1644 }
 1645 ;
 1646
14801647/*
14811648 * There is a constraint on the color that it must
14821649 * have either 3 or 6 hex-digits (i.e., [0-9a-fA-F])

Source/WebCore/css/CSSParserValues.cpp

@@void CSSParserValueList::addValue(const CSSParserValue& v)
4343{
4444 m_values.append(v);
4545}
46 
 46
 47void CSSParserValueList::insertValueAt(unsigned i, const CSSParserValue& v)
 48{
 49 m_values.insert(i, v);
 50}
 51
4752void CSSParserValueList::deleteValueAt(unsigned i)
4853{
4954 m_values.remove(i);
5055}
5156
 57void CSSParserValueList::append(CSSParserValueList& right)
 58{
 59 for (unsigned int i = 0; i < right.size(); ++i)
 60 m_values.append(*(right.valueAt(i)));
 61}
 62
5263PassRefPtr<CSSValue> CSSParserValue::createCSSValue()
5364{
5465 RefPtr<CSSValue> parsedValue;

Source/WebCore/css/CSSParserValues.h

@@public:
7171 ~CSSParserValueList();
7272
7373 void addValue(const CSSParserValue&);
 74 void insertValueAt(unsigned, const CSSParserValue&);
7475 void deleteValueAt(unsigned);
 76 void append(CSSParserValueList& right);
7577
7678 unsigned size() const { return m_values.size(); }
7779 CSSParserValue* current() { return m_current < m_values.size() ? &m_values[m_current] : 0; }

Source/WebCore/css/tokenizer.flex

@@nth [\+-]?{intnum}*n([\t\r\n ]*[\+-][\t\r\n ]*{intnum})?
102102{num}Hz {yyTok = HERTZ; return yyTok;}
103103{num}kHz {yyTok = KHERTZ; return yyTok;}
104104{num}{ident} {yyTok = DIMEN; return yyTok;}
 105{num}{ident}\+ {yyTok = INVALIDDIMEN; return yyTok;}
105106{num}%+ {yyTok = PERCENTAGE; return yyTok;}
106107{intnum} {yyTok = INTEGER; return yyTok;}
107108{num} {yyTok = FLOATTOKEN; return yyTok;}

@@nth [\+-]?{intnum}*n([\t\r\n ]*[\+-][\t\r\n ]*{intnum})?
109110"not(" {yyTok = NOTFUNCTION; return yyTok;}
110111"url("{w}{string}{w}")" {yyTok = URI; return yyTok;}
111112"url("{w}{url}{w}")" {yyTok = URI; return yyTok;}
 113"-webkit-calc(" {yyTok = CALCFUNCTION; return yyTok;}
 114"-webkit-min(" {yyTok = MINFUNCTION; return yyTok;}
 115"-webkit-max(" {yyTok = MAXFUNCTION; return yyTok;}
112116{ident}"(" {yyTok = FUNCTION; return yyTok;}
113117
114118U\+{range} {yyTok = UNICODERANGE; return yyTok;}