Add initial parsing functionality of :lang pseudo class in Selectors Level 4.
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 1 Nov 2014 03:06:27 +0000 (03:06 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 1 Nov 2014 03:06:27 +0000 (03:06 +0000)
commit6cdf55e0ed3ecc7e037d36d3855e2d680dbc6649
treeff697e8c4c740fbb23ec4110adebb3eae4c4f206
parentc722c6479afc57371e8a8a1563e4ca6fe9137416
Add initial parsing functionality of :lang pseudo class in Selectors Level 4.
https://bugs.webkit.org/show_bug.cgi?id=138170

Patch by Dhi Aurrahman <diorahman@rockybars.com> on 2014-10-31
Reviewed by Benjamin Poulain.

Source/WebCore:

Add initial parsing functionality of :lang pseudo class in Selectors Level 4,
as specified in [1].

It parses comma-separated list of string arguments. Currently, it throws error
on arguments with "*" (e.g. :lang(zh, *-hant)).

Add additional test file fast/selectors/lang-invalid.html along side the
fast/css/css-selector-text.html.

[1] http://dev.w3.org/csswg/selectors4/#the-lang-pseudo

Test: fast/selectors/lang-invalid.html

* css/CSSGrammar.y.in:
* css/CSSParser.cpp:
(WebCore::CSSParser::detectFunctionTypeToken):
* css/CSSParserValues.cpp:
(WebCore::CSSParserSelector::setArgumentList):
* css/CSSParserValues.h:
* css/CSSSelector.cpp:
(WebCore::appendArgumentList):
(WebCore::CSSSelector::selectorText):
(WebCore::CSSSelector::setArgumentList):
* css/CSSSelector.h:
(WebCore::CSSSelector::argumentList):
* css/SelectorChecker.cpp:
(WebCore::SelectorChecker::checkOne):
* cssjit/SelectorCompiler.cpp:
(WebCore::SelectorCompiler::addPseudoClassType):

LayoutTests:

Add tests for comma-separated list arguments for :lang

* fast/css/css-selector-text-expected.txt: Updated.
* fast/css/css-selector-text.html: Updated.
* fast/selectors/lang-invalid-expected.txt: Added.
* fast/selectors/lang-invalid.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@175446 268f45cc-cd09-0410-ab3c-d52691b4dbfc
14 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/css/css-selector-text-expected.txt
LayoutTests/fast/css/css-selector-text.html
LayoutTests/fast/selectors/lang-invalid-expected.txt [new file with mode: 0644]
LayoutTests/fast/selectors/lang-invalid.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/css/CSSGrammar.y.in
Source/WebCore/css/CSSParser.cpp
Source/WebCore/css/CSSParserValues.cpp
Source/WebCore/css/CSSParserValues.h
Source/WebCore/css/CSSSelector.cpp
Source/WebCore/css/CSSSelector.h
Source/WebCore/css/SelectorChecker.cpp
Source/WebCore/cssjit/SelectorCompiler.cpp