[CSS Parser] Fix bugs in the @supports parser
authorhyatt@apple.com <hyatt@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 28 Nov 2016 22:30:11 +0000 (22:30 +0000)
committerhyatt@apple.com <hyatt@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 28 Nov 2016 22:30:11 +0000 (22:30 +0000)
commitf8ddec05ca03db71caa721b86f76ae47d5fecb52
treef2d26ac227036d27a13c35bff09af42c77b51e0c
parentecc6528ee217d4539cb94bf830e2dea2c3738bde
[CSS Parser] Fix bugs in the @supports parser
https://bugs.webkit.org/show_bug.cgi?id=165115

Reviewed by Zalan Bujtas.

* css/parser/CSSParserFastPaths.cpp:
(WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue):
Clean up the display property to match the old parser to ensure
that @supports conditions on display are the same.

* css/parser/CSSSupportsParser.cpp:
(WebCore::CSSSupportsParser::consumeCondition):
(WebCore::CSSSupportsParser::consumeNegation):
(WebCore::CSSSupportsParser::consumeConditionInParenthesis):
* css/parser/CSSSupportsParser.h:
What follows are all bugs in Blink that need to be fixed to pass our
tests.

Fix the supports parser to allow the whitespace after not/or/and to
be optional. Allow the whitespace following parenthetical conditions
to be optional.

With whitespace being optional, this means that "not(" will parse
as a FunctionToken type, as will "or(" and "and(". Handle this situation
by checking for FunctionToken along with IdentToken and parameterizing
consumeConditionInParenthesis to do the right thing when it starts with
a FunctionToken instead of an IdentToken.

Fix the general enclosure FunctionToken for forward compatibility to require that
the function still be enclosed within parentheses.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@209021 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebCore/ChangeLog
Source/WebCore/css/parser/CSSParserFastPaths.cpp
Source/WebCore/css/parser/CSSSupportsParser.cpp
Source/WebCore/css/parser/CSSSupportsParser.h