Stop having HTMLNameCollection override HTMLCollection::virtualItemAfter()

Stop having HTMLNameCollection override HTMLCollection::virtualItemAfter(). It
is not really needed as the same DOM tree traversal code. Instead, we simply
create 2 subclasses called DocumentNameCollection and WindowNameCollection that
define an elementMatches() method that is called from HTMLCollection, similarly
to other HTMLCollection subclasses.

This avoids having a virtual function call, brings support for efficient
backward traversal of these collections and leverages optimizations in
HTMLCollection.

This CL is inspired from WebKit r149652 from rniwa@webkit.org:
http://trac.webkit.org/changeset/149652

R=esprehn@chromium.org, adamk@chromium.org

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

git-svn-id: svn://svn.chromium.org/blink/trunk@175476 bbb929c8-8fbe-4397-9dbb-9b2b20218538
Optimize SelectorChecker's containsHTMLSpace() utility function

Avoid calling is8Bit() for every character in SelectorChecker's
containsHTMLSpace() by doing the check once at the beginning and then call a
templated containsHTMLSpaceTemplate() for the corresponding character type that
will iterate over the raw string array.

String::operator[] is not ideal here because:
- It checks if the String's StringImpl is non-null
- It does array bound checking
- It calls is8Bit() to access the right raw string array

The new implementation avoids doing these checks for every character in the
string being checked.

I see a 2.5% progression on cssquery-jquery's div[class~=dialog] subtest
(7152.80 -> 7331.60 +/- 0.5%):
http://dromaeo.com/?id=222400,222406

R=esprehn@chromium.org, eseidel@chromium.org

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

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