Class name matching should use ASCII case-insensitive matching, not Unicode case folding
https://bugs.webkit.org/show_bug.cgi?id=133292

Reviewed by Anders Carlsson.

Source/WebCore:
Tests: fast/dom/getElementsByClassName/ASCII-case-insensitive.html
       fast/dom/getElementsByClassName/case-sensitive.html

* dom/SpaceSplitString.cpp:
(WebCore::hasNonASCIIOrUpper): Deleted.
(WebCore::tokenizeSpaceSplitString): Use a for loop instead of while.
(WebCore::spaceSplitStringTable): Renamed from sharedDataMap; the new name is supposed
to help us see the analogy with the atomic string table.
(WebCore::SpaceSplitString::set): Removed unneeded special case for null and preflight
since AtomicString::convertToASCIILowercase now handles both of those. Changed to call
convertToASCIILowercase instead of foldCase, since we don't want to fold non-ASCII.
(WebCore::SpaceSplitString::spaceSplitStringContainsValue): Ditto.
(WebCore::SpaceSplitStringData::create): Marked this inline since it's only called in
one place and that place is in this file. Also used auto a bit and used get instead of
find since the value type is a simple pointer.
(WebCore::SpaceSplitStringData::destroy): Removed unneeded check for null. We never
create any SpaceSplitStringData with empty strings, and a null is a kind of empty string.

* dom/SpaceSplitString.h: Removed some unneeded includes and some unneeded uses of the
inline keyword. Changed types from size_t to unsigned in a couple places; we had a mix
of the types and there was no reason to use size_t there.

Source/WTF:
* wtf/text/AtomicString.cpp:
(WTF::AtomicString::addSlowCase): Change to take references instead of pointers since these
arguments can never be null.
(WTF::AtomicString::lower): Rearranged slightly to use PassRef in a more efficient but
slightly uglier way.
(WTF::AtomicString::convertToASCIILowercase): Added.
* wtf/text/AtomicString.h: Updated for above changes.

* wtf/text/StringImpl.cpp:
(WTF::StringImpl::convertToASCIILowercase): Added.
* wtf/text/StringImpl.h: Updated for above.

* wtf/text/WTFString.cpp:
(WTF::String::convertToASCIILowercase): Added.
* wtf/text/WTFString.h: Updated for above.

LayoutTests:
* fast/dom/getElementsByClassName/ASCII-case-insensitive-expected.txt: Added.
* fast/dom/getElementsByClassName/ASCII-case-insensitive.html: Added.
* fast/dom/getElementsByClassName/case-sensitive-expected.txt: Added.
* fast/dom/getElementsByClassName/case-sensitive.html: Added.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@169358 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Split the call to adjustForLocalZoom out into a separate expression.
https://bugs.webkit.org/show_bug.cgi?id=133286

Reviewed by Darin Adler.

This patch ensures that adjustForLocalZoom() always gets called before we look at
zoomFactor's value. (and not rely on the undefined behavior of the order of function argument evaluation)

* dom/Element.cpp:
(WebCore::Element::offsetLeft):
(WebCore::Element::offsetTop):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@169359 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Fix the quirks mode selector matching of the pseudo classes :hover and :active
https://bugs.webkit.org/show_bug.cgi?id=133063

Reviewed by Antti Koivisto.


Source/WebCore: 
Our implementation of the quirks mode of :active and :hover was very wrong. The only
thing it was doing is verify the pseudo class is not the first selector of a fragment
(which was conveniently the only thing that was tested :)).

Since those pseudo class were only checking for the order of the filters, something like
    #target:hover
would succeed because :hover is not the first simple selector, while
    :hover#target
would fail.

That behavior is also a problem for the CSS JIT as it is an implementation detail of SelectorChecker
and compiling something like that with our out-of-order matching would be nonsense.

This patch update the implementation to follow http://quirks.spec.whatwg.org/#the-:active-and-:hover-quirk
Basically, the only cases that do not work in quirks mode are selectors composed only of "*, :hover and :active".

To implement this behavior, I needed to be able to inspect a complete selector fragment, including
what is before and after :hover/:active.
To do that, I replaced the boolean isSubSelector by a pointer to the first selector of the fragment.
When we need to match :active/:hover in quirks mode, we just go over all the selectors in the fragment
to find one of the qualifying match type.

Tests: fast/selectors/active-hover-quirks.html
       fast/selectors/active-quirks.html
       fast/selectors/hover-quirks.html

* css/SelectorChecker.cpp:
(WebCore::SelectorChecker::matchRecursively):
(WebCore::canMatchHoverOrActiveInQuirksMode):
(WebCore::SelectorChecker::checkOne):
* css/SelectorChecker.h:
(WebCore::SelectorChecker::SelectorCheckingContext::SelectorCheckingContext):

LayoutTests: 
The test coverage of :hover and :active was extremly poor.
Those new tests add coverage for the cases fixed by this patch.

* fast/selectors/active-hover-quirks-expected.txt: Added.
* fast/selectors/active-hover-quirks.html: Added.
* fast/selectors/active-hover-strict-expected.txt: Added.
* fast/selectors/active-hover-strict.html: Added.
* fast/selectors/active-quirks-expected.txt: Added.
* fast/selectors/active-quirks.html: Added.
* fast/selectors/active-strict-expected.txt: Added.
* fast/selectors/active-strict.html: Added.
* fast/selectors/hover-quirks-expected.txt: Added.
* fast/selectors/hover-quirks.html: Added.
* fast/selectors/hover-strict-expected.txt: Added.
* fast/selectors/hover-strict.html: Added.
* fast/selectors/resources/hover-active-quirks-utility.js: Added.
* selectors/resources/hover-active-strict-utility.js: Added.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@169360 268f45cc-cd09-0410-ab3c-d52691b4dbfc