diff options
author | Bradley T. Hughes <bradley.hughes@nokia.com> | 2009-06-15 09:57:36 (GMT) |
---|---|---|
committer | Bradley T. Hughes <bradley.hughes@nokia.com> | 2009-06-15 09:57:36 (GMT) |
commit | 336dfcef05cb63df0a6d550b59a4badc7a0f01c1 (patch) | |
tree | a218ec97413e0c8ebc9600ac5db9b2adea485b32 /src/3rdparty/webkit/WebCore/css/CSSGrammar.y | |
parent | e44d64510e019e5d3b379b704cfb824e0d7ccc9d (diff) | |
download | Qt-336dfcef05cb63df0a6d550b59a4badc7a0f01c1.zip Qt-336dfcef05cb63df0a6d550b59a4badc7a0f01c1.tar.gz Qt-336dfcef05cb63df0a6d550b59a4badc7a0f01c1.tar.bz2 |
Merge of master
Diffstat (limited to 'src/3rdparty/webkit/WebCore/css/CSSGrammar.y')
-rw-r--r-- | src/3rdparty/webkit/WebCore/css/CSSGrammar.y | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/src/3rdparty/webkit/WebCore/css/CSSGrammar.y b/src/3rdparty/webkit/WebCore/css/CSSGrammar.y index 9ee9c93..4706521 100644 --- a/src/3rdparty/webkit/WebCore/css/CSSGrammar.y +++ b/src/3rdparty/webkit/WebCore/css/CSSGrammar.y @@ -26,6 +26,7 @@ #include "CSSMediaRule.h" #include "CSSParser.h" +#include "CSSPrimitiveValue.h" #include "CSSPropertyNames.h" #include "CSSRuleList.h" #include "CSSSelector.h" @@ -94,6 +95,8 @@ static int cssyylex(YYSTYPE* yylval, void* parser) %expect 49 +%nonassoc LOWEST_PREC + %left UNIMPORTANT_TOK %token WHITESPACE SGML_CD @@ -349,7 +352,7 @@ maybe_charset: closing_brace: '}' - | %prec maybe_sgml TOKEN_EOF + | %prec LOWEST_PREC TOKEN_EOF ; charset: @@ -1095,6 +1098,11 @@ pseudo: CSSParser* p = static_cast<CSSParser*>(parser); if (Document* doc = p->document()) doc->setUsesFirstLineRules(true); + } else if (type == CSSSelector::PseudoBefore || + type == CSSSelector::PseudoAfter) { + CSSParser* p = static_cast<CSSParser*>(parser); + if (Document* doc = p->document()) + doc->setUsesBeforeAfterRules(true); } } | ':' ':' IDENT { @@ -1109,6 +1117,11 @@ pseudo: CSSParser* p = static_cast<CSSParser*>(parser); if (Document* doc = p->document()) doc->setUsesFirstLineRules(true); + } else if (type == CSSSelector::PseudoBefore || + type == CSSSelector::PseudoAfter) { + CSSParser* p = static_cast<CSSParser*>(parser); + if (Document* doc = p->document()) + doc->setUsesBeforeAfterRules(true); } } // used by :nth-*(ax+b) @@ -1168,7 +1181,7 @@ pseudo: } // used by :not | ':' NOTFUNCTION maybe_space simple_selector maybe_space ')' { - if (!$4) + if (!$4 || $4->simpleSelector() || $4->tagHistory()) $$ = 0; else { CSSParser* p = static_cast<CSSParser*>(parser); @@ -1355,10 +1368,10 @@ term: $$.string = $1; } /* We might need to actually parse the number from a dimension, but we can't just put something that uses $$.string into unary_term. */ - | DIMEN maybe_space { $$.id = 0; $$.string = $1; $$.unit = CSSPrimitiveValue::CSS_DIMENSION } - | unary_operator DIMEN maybe_space { $$.id = 0; $$.string = $2; $$.unit = CSSPrimitiveValue::CSS_DIMENSION } + | DIMEN maybe_space { $$.id = 0; $$.string = $1; $$.unit = CSSPrimitiveValue::CSS_DIMENSION; } + | unary_operator DIMEN maybe_space { $$.id = 0; $$.string = $2; $$.unit = CSSPrimitiveValue::CSS_DIMENSION; } | URI maybe_space { $$.id = 0; $$.string = $1; $$.unit = CSSPrimitiveValue::CSS_URI; } - | UNICODERANGE maybe_space { $$.id = 0; $$.string = $1; $$.unit = CSSPrimitiveValue::CSS_UNICODE_RANGE } + | UNICODERANGE maybe_space { $$.id = 0; $$.string = $1; $$.unit = CSSPrimitiveValue::CSS_UNICODE_RANGE; } | hexcolor { $$.id = 0; $$.string = $1; $$.unit = CSSPrimitiveValue::CSS_PARSER_HEXCOLOR; } | '#' maybe_space { $$.id = 0; $$.string = CSSParserString(); $$.unit = CSSPrimitiveValue::CSS_PARSER_HEXCOLOR; } /* Handle error case: "color: #;" */ /* FIXME: according to the specs a function can have a unary_operator in front. I know no case where this makes sense */ @@ -1368,7 +1381,9 @@ term: | variable_reference maybe_space { $$ = $1; } - | '%' maybe_space {} /* Handle width: %; */ + | '%' maybe_space { /* Handle width: %; */ + $$.id = 0; $$.unit = 0; + } ; unary_term: |