Use Traits in SelectorQuery to avoid a lot of code duplication

This CL introduces Traits to SelectorQuery to avoid a lot of code duplication
between the queryFirst / queryAll cases. The code was duplicated in r155068
because this code is hot and we wanted to get rid of the if(firstMatchOnly)
checks at runtime and stop using a Vector for the queryFirst() case.

By using Traits, we can avoid the duplication while maintaining performance.
The if(firstMatchOnly) checks are now optimized out by the compiler because
the condition is a static const variable. Also, we use a Vector for the
result only in the queryAll case, not in the queryFirst one.

This patch also drops the SingleNodeList class and handles the single traverse
root case separately to avoid causing regressions in QueryFirst() now that the
code is shared between QueryFirst() / QueryAll(). We also now use templates
to handle the different simple node list types so that isEmpty() / next() no
longer need to be virtual which is performance-positive.

Running the performance tests, I see the following results on Linux Desktop:
- Parser/query-selector-all-attribute-complex: +4%
- Parser/query-selector-all-attribute: +4%
- Parser/query-selector-all-deep: +4%
- Parser/query-selector-all-id-deep: +15%
- Parser/query-selector-all-id-last: +15%
- The rest is within noise, no major regression or improvement.

This CL is based on the following WebKit commit by <benjamin@webkit.org>:
http://trac.webkit.org/changeset/154370

R=esprehn, eseidel
BUG=336078

Review URL: https://codereview.chromium.org/142513003

git-svn-id: svn://svn.chromium.org/blink/trunk@165679 bbb929c8-8fbe-4397-9dbb-9b2b20218538