haikuwebkit/LayoutTests/fast/css/nth-child-of-compound-selec...

27 lines
783 B
HTML
Raw Permalink Normal View History

Add the baseline implementation of :nth-child(An+B of selector-list) https://bugs.webkit.org/show_bug.cgi?id=136975 Patch by Benjamin Poulain <bpoulain@apple.com> on 2014-09-22 Reviewed by Darin Adler. Source/WebCore: Tests: fast/css/nth-child-of-classname.html fast/css/nth-child-of-complex-selector.html fast/css/nth-child-of-compound-selector.html fast/css/nth-child-of-tagname.html fast/selectors/nth-child-of-basics.html fast/selectors/nth-child-of-class-style-update.html fast/selectors/nth-child-of-complex-selectors.html fast/selectors/nth-child-of-selector-list.html * css/SelectorChecker.cpp: (WebCore::SelectorChecker::checkOne): Pretty basic: -Go over the previous siblings. -For each sibling, test the selector list. If it matches, increase the count. * cssjit/SelectorCompiler.cpp: (WebCore::SelectorCompiler::addPseudoClassType): Skip any case of the new selector. This will be implemented separately. LayoutTests: * fast/css/nth-child-of-classname-expected.html: Added. * fast/css/nth-child-of-classname.html: Added. * fast/css/nth-child-of-complex-selector-expected.html: Added. * fast/css/nth-child-of-complex-selector.html: Added. * fast/css/nth-child-of-compound-selector-expected.html: Added. * fast/css/nth-child-of-compound-selector.html: Added. * fast/css/nth-child-of-tagname-expected.html: Added. * fast/css/nth-child-of-tagname.html: Added. Cover basic styling and style sharing. * fast/selectors/nth-child-of-basics-expected.txt: Added. * fast/selectors/nth-child-of-basics.html: Added. * fast/selectors/nth-child-of-complex-selectors-expected.txt: Added. * fast/selectors/nth-child-of-complex-selectors.html: Added. * fast/selectors/nth-child-of-selector-list-expected.txt: Added. * fast/selectors/nth-child-of-selector-list.html: Added. Cover querySelector and styling of various cases. * fast/selectors/nth-child-of-class-style-update-expected.txt: Added. * fast/selectors/nth-child-of-class-style-update.html: Added. Basic case of style invalidation. Canonical link: https://commits.webkit.org/154830@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@173853 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2014-09-22 22:09:13 +00:00
<!doctype html>
<html>
<head>
<style>
/* 3n of paragraph with the class foobar but for which foobar is not the only class. */
p:nth-child(3n+1 of p.foobar:not([class=foobar])) {
background-color: lime;
}
</style>
</head>
<body>
<p class="foobar foo"></p>
<p>This test the styling of paragraphs with :nth-child(An+B of selector). If the test succeed, paragraphs that say "green" should have a green background.</p>
<p class="foobar">White!</p>
<p class="foobar foo">White!</p>
<p>White!</p>
<p class="foo foobar">White!</p>
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. Canonical link: https://commits.webkit.org/155479@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@174613 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2014-10-10 21:23:37 +00:00
<p>White!</p>
Add the baseline implementation of :nth-child(An+B of selector-list) https://bugs.webkit.org/show_bug.cgi?id=136975 Patch by Benjamin Poulain <bpoulain@apple.com> on 2014-09-22 Reviewed by Darin Adler. Source/WebCore: Tests: fast/css/nth-child-of-classname.html fast/css/nth-child-of-complex-selector.html fast/css/nth-child-of-compound-selector.html fast/css/nth-child-of-tagname.html fast/selectors/nth-child-of-basics.html fast/selectors/nth-child-of-class-style-update.html fast/selectors/nth-child-of-complex-selectors.html fast/selectors/nth-child-of-selector-list.html * css/SelectorChecker.cpp: (WebCore::SelectorChecker::checkOne): Pretty basic: -Go over the previous siblings. -For each sibling, test the selector list. If it matches, increase the count. * cssjit/SelectorCompiler.cpp: (WebCore::SelectorCompiler::addPseudoClassType): Skip any case of the new selector. This will be implemented separately. LayoutTests: * fast/css/nth-child-of-classname-expected.html: Added. * fast/css/nth-child-of-classname.html: Added. * fast/css/nth-child-of-complex-selector-expected.html: Added. * fast/css/nth-child-of-complex-selector.html: Added. * fast/css/nth-child-of-compound-selector-expected.html: Added. * fast/css/nth-child-of-compound-selector.html: Added. * fast/css/nth-child-of-tagname-expected.html: Added. * fast/css/nth-child-of-tagname.html: Added. Cover basic styling and style sharing. * fast/selectors/nth-child-of-basics-expected.txt: Added. * fast/selectors/nth-child-of-basics.html: Added. * fast/selectors/nth-child-of-complex-selectors-expected.txt: Added. * fast/selectors/nth-child-of-complex-selectors.html: Added. * fast/selectors/nth-child-of-selector-list-expected.txt: Added. * fast/selectors/nth-child-of-selector-list.html: Added. Cover querySelector and styling of various cases. * fast/selectors/nth-child-of-class-style-update-expected.txt: Added. * fast/selectors/nth-child-of-class-style-update.html: Added. Basic case of style invalidation. Canonical link: https://commits.webkit.org/154830@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@173853 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2014-09-22 22:09:13 +00:00
<p class="foobar foo">Green</p>
<p class="foobar">White!</p>
<p class="foo foobar">White!</p>
<p class="foobar">White!</p>
<p class="foo foobar baz">White!</p>
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. Canonical link: https://commits.webkit.org/155479@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@174613 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2014-10-10 21:23:37 +00:00
<p>White!</p>
Add the baseline implementation of :nth-child(An+B of selector-list) https://bugs.webkit.org/show_bug.cgi?id=136975 Patch by Benjamin Poulain <bpoulain@apple.com> on 2014-09-22 Reviewed by Darin Adler. Source/WebCore: Tests: fast/css/nth-child-of-classname.html fast/css/nth-child-of-complex-selector.html fast/css/nth-child-of-compound-selector.html fast/css/nth-child-of-tagname.html fast/selectors/nth-child-of-basics.html fast/selectors/nth-child-of-class-style-update.html fast/selectors/nth-child-of-complex-selectors.html fast/selectors/nth-child-of-selector-list.html * css/SelectorChecker.cpp: (WebCore::SelectorChecker::checkOne): Pretty basic: -Go over the previous siblings. -For each sibling, test the selector list. If it matches, increase the count. * cssjit/SelectorCompiler.cpp: (WebCore::SelectorCompiler::addPseudoClassType): Skip any case of the new selector. This will be implemented separately. LayoutTests: * fast/css/nth-child-of-classname-expected.html: Added. * fast/css/nth-child-of-classname.html: Added. * fast/css/nth-child-of-complex-selector-expected.html: Added. * fast/css/nth-child-of-complex-selector.html: Added. * fast/css/nth-child-of-compound-selector-expected.html: Added. * fast/css/nth-child-of-compound-selector.html: Added. * fast/css/nth-child-of-tagname-expected.html: Added. * fast/css/nth-child-of-tagname.html: Added. Cover basic styling and style sharing. * fast/selectors/nth-child-of-basics-expected.txt: Added. * fast/selectors/nth-child-of-basics.html: Added. * fast/selectors/nth-child-of-complex-selectors-expected.txt: Added. * fast/selectors/nth-child-of-complex-selectors.html: Added. * fast/selectors/nth-child-of-selector-list-expected.txt: Added. * fast/selectors/nth-child-of-selector-list.html: Added. Cover querySelector and styling of various cases. * fast/selectors/nth-child-of-class-style-update-expected.txt: Added. * fast/selectors/nth-child-of-class-style-update.html: Added. Basic case of style invalidation. Canonical link: https://commits.webkit.org/154830@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@173853 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2014-09-22 22:09:13 +00:00
</body>
</html>