CSS4 Selectors: Add the pseudo class :any-link
https://bugs.webkit.org/show_bug.cgi?id=138128

Reviewed by Andreas Kling.

Source/WebCore:

Defined here: http://dev.w3.org/csswg/selectors4/#the-any-link-pseudo

After :link and :-webkit-any-link were fixed, :any-link behaves
exactly like :-webkit-any-link. All I had left to do here was
make them synonyms when evaluating selectors.

Defined here: http://dev.w3.org/csswg/selectors4/#the-any-link-pseudo

After :link and :-webkit-any-link were fixed, :any-link behaves
exactly like :-webkit-any-link. All I had left to do here was
make them synonyms when evaluating selectors.

Tests: fast/selectors/any-link-basics-2.html
       fast/selectors/any-link-basics.html
       fast/selectors/any-link-styling.html

* css/CSSSelector.cpp:
(WebCore::CSSSelector::selectorText):
* css/CSSSelector.h:
* css/RuleSet.cpp:
(WebCore::RuleSet::addRule):
* css/SelectorChecker.cpp:
(WebCore::SelectorChecker::checkOne):
* css/SelectorChecker.h:
(WebCore::SelectorChecker::isCommonPseudoClassSelector):
* css/SelectorPseudoClassAndCompatibilityElementMap.in:
* cssjit/SelectorCompiler.cpp:
(WebCore::SelectorCompiler::addPseudoClassType):
(WebCore::SelectorCompiler::SelectorCodeGenerator::generateElementLinkMatching):

LayoutTests:

Story time: I implement only half of the patch and run
fast/selectors/webkit-any-link.html to make sure it fails...
and the test happily PASS.

I look into it and sure enough, a last minute change in
html-link-type-tests.js made it test nothing but :link.

I update html-link-type-tests.js to actually test the desired selector,
run the test again: PASS.

I debug a bit and I find why my code is not tested: html-link-type-tests.js
uses Element.matches() and that does not use the CSS JIT.

Fair enough, I add a querySelectorAll("#target' + selector + '") to run
through the JIT: PASS.

Since that selector is simple-#id + simple selector, we go through a fast
path for ids and skip the JIT. Arrrrg!

Finally, I added querySelectorAll(".target' + selector + '"), which covers
the CSS JIT.

The nice thing is: all those cases are tested now :)

* fast/css/css-selector-text-expected.txt:
* fast/css/css-selector-text.html:
* fast/css/css-set-selector-text-expected.txt:
* fast/css/css-set-selector-text.html:
* fast/selectors/any-link-basics-2-expected.txt: Added.
* fast/selectors/any-link-basics-2.html: Added.
* fast/selectors/any-link-basics-expected.txt: Added.
* fast/selectors/any-link-basics.html: Added.
* fast/selectors/any-link-styling-expected.html: Added.
* fast/selectors/any-link-styling.html: Added.
* fast/selectors/images-with-usemap-should-not-match-link-expected.txt:
* fast/selectors/images-with-usemap-should-not-match-link.html:
* fast/selectors/link-basics-expected.txt:
* fast/selectors/link-basics-xhtml-expected.txt:
* fast/selectors/resources/html-link-type-tests.js:
(testHTMLElement):
(testHTMLTagsForLink):
* fast/selectors/webkit-any-link-basics-expected.txt:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@175301 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/WebCore/css/RuleSet.cpp b/Source/WebCore/css/RuleSet.cpp
index de9b729..698e0ca 100644
--- a/Source/WebCore/css/RuleSet.cpp
+++ b/Source/WebCore/css/RuleSet.cpp
@@ -242,7 +242,10 @@
             switch (selector->pseudoClassType()) {
             case CSSSelector::PseudoClassLink:
             case CSSSelector::PseudoClassVisited:
+#if ENABLE(CSS_SELECTORS_LEVEL4)
             case CSSSelector::PseudoClassAnyLink:
+#endif
+            case CSSSelector::PseudoClassAnyLinkDeprecated:
                 linkSelector = selector;
                 break;
             case CSSSelector::PseudoClassFocus: