CSS JIT: add aliases between :nth-child()/:nth-last-child() and :first-child/:last-child
https://bugs.webkit.org/show_bug.cgi?id=142472
Reviewed by Andreas Kling.
Source/WebCore:
The pseudo class :first-child has weaker tree marking than :nth-child(1).
This patch aliases :nth-child(1) to :first-child in the CSS JIT to take
advantage of that.
The strength of :last-child and :nth-last-child(1) are pretty much identical
but :last-child is a bit simpler so I changed it too. It is also easier
to handle both the same.
Tests: fast/selectors/nth-child-matching-first-on-root.html
fast/selectors/nth-child-matching-first.html
fast/selectors/nth-last-child-matching-first-on-root.html
fast/selectors/nth-last-child-matching-first.html
* cssjit/SelectorCompiler.cpp:
(WebCore::SelectorCompiler::addNthChildType):
(WebCore::SelectorCompiler::addPseudoClassType):
LayoutTests:
* fast/selectors/nth-child-matching-first-expected.txt: Added.
* fast/selectors/nth-child-matching-first-on-root-expected.txt: Added.
* fast/selectors/nth-child-matching-first-on-root.html: Added.
* fast/selectors/nth-child-matching-first.html: Added.
* fast/selectors/nth-last-child-matching-first-expected.txt: Added.
* fast/selectors/nth-last-child-matching-first-on-root-expected.txt: Added.
* fast/selectors/nth-last-child-matching-first-on-root.html: Added.
* fast/selectors/nth-last-child-matching-first.html: Added.
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@181283
268f45cc-cd09-0410-ab3c-
d52691b4dbfc