Update :nth-child(An+B of selector-list) to the latest specification
https://bugs.webkit.org/show_bug.cgi?id=137593

Reviewed by Andreas Kling.

Source/WebCore:

Following my implementation feedback on :nth-child(An+B of selector-list),
the CSS WG decided to change the definition such that the current element on which
the selector is matched must also match the selector list in :nth-child().

This patch updates the implementation accordingly.

Test: fast/selectors/nth-child-of-chained-3.html

* css/SelectorChecker.cpp:
(WebCore::SelectorChecker::checkOne):
(WebCore::SelectorChecker::matchSelectorList):
* css/SelectorChecker.h:
* cssjit/SelectorCompiler.cpp:
(WebCore::SelectorCompiler::SelectorCodeGenerator::generateElementMatchesSelectorList):
(WebCore::SelectorCompiler::SelectorCodeGenerator::generateElementIsNthChildOf):

LayoutTests:

* fast/selectors/nth-child-of-chained-3-expected.txt: Added.
* fast/selectors/nth-child-of-chained-3.html: Added.
This is an interesting new case with the new definition. Since the initial
element must also match the selector, it is now possible to fail even
if the combination An+B can match anything.

* fast/css/nth-child-of-classname-expected.html:
* fast/css/nth-child-of-classname.html:
* fast/css/nth-child-of-compound-selector-expected.html:
* fast/css/nth-child-of-compound-selector.html:
* fast/css/nth-child-of-tagname-expected.html:
* fast/css/nth-child-of-tagname.html:
* fast/selectors/nth-child-of-backtracking-adjacent-2.html:
* fast/selectors/nth-child-of-backtracking-adjacent.html:
* fast/selectors/nth-child-of-basics-2-expected.txt:
* fast/selectors/nth-child-of-basics-2.html:
* fast/selectors/nth-child-of-basics-expected.txt:
* fast/selectors/nth-child-of-basics.html:
* fast/selectors/nth-child-of-chained-2-expected.txt:
* fast/selectors/nth-child-of-chained-2.html:
* fast/selectors/nth-child-of-complex-selectors-expected.txt:
* fast/selectors/nth-child-of-complex-selectors.html:
* fast/selectors/nth-child-of-never-matching-selector-expected.txt:
* fast/selectors/nth-child-of-never-matching-selector.html:
* fast/selectors/nth-child-of-selector-list-expected.txt:
* fast/selectors/nth-child-of-selector-list.html:
Updating the test and tests result for the new definition.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@174613 268f45cc-cd09-0410-ab3c-d52691b4dbfc
27 files changed