CSS JIT: add aliases between :nth-child()/:nth-last-child() and :first-child/:last...
authorbenjamin@webkit.org <benjamin@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 9 Mar 2015 21:10:37 +0000 (21:10 +0000)
committerbenjamin@webkit.org <benjamin@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 9 Mar 2015 21:10:37 +0000 (21:10 +0000)
commitb074fc4defc9dd64800826ea1bad21f389957769
treee1da0b3cb5fa585f368ee959b5606a23463c9cda
parent63090a8d312623051779e072aca3414c93513853
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
LayoutTests/ChangeLog
LayoutTests/fast/selectors/nth-child-matching-first-expected.txt [new file with mode: 0644]
LayoutTests/fast/selectors/nth-child-matching-first-on-root-expected.txt [new file with mode: 0644]
LayoutTests/fast/selectors/nth-child-matching-first-on-root.html [new file with mode: 0644]
LayoutTests/fast/selectors/nth-child-matching-first.html [new file with mode: 0644]
LayoutTests/fast/selectors/nth-last-child-matching-first-expected.txt [new file with mode: 0644]
LayoutTests/fast/selectors/nth-last-child-matching-first-on-root-expected.txt [new file with mode: 0644]
LayoutTests/fast/selectors/nth-last-child-matching-first-on-root.html [new file with mode: 0644]
LayoutTests/fast/selectors/nth-last-child-matching-first.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/cssjit/SelectorCompiler.cpp