WebCore::findAtomicString(PropertyName) always convert the name to 16bits
authorbenjamin@webkit.org <benjamin@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 11 Aug 2012 21:12:27 +0000 (21:12 +0000)
committerbenjamin@webkit.org <benjamin@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 11 Aug 2012 21:12:27 +0000 (21:12 +0000)
commite6b04b71d922df0beec15eaeac237e724de41dc1
treeae0188a85cbbc52efa0fb8c32c657e1fc9b2621c
parent51153eba3cdfad1e8f4af94e00c38548425911c3
WebCore::findAtomicString(PropertyName) always convert the name to 16bits
https://bugs.webkit.org/show_bug.cgi?id=93685

Reviewed by Geoffrey Garen.

Source/WebCore:

* bindings/js/JSDOMBinding.cpp:
(WebCore::findAtomicString):
Use the new AtomicString::find() to avoid calling StringImpl::characters().

Source/WTF:

Previously, WebCore::findAtomicString() was causing a conversion for the 8bit property name
to a 16bits due to the call to StringImpl::character16().

This patch fixes the issue by adding support for both 8bits and 16bits string in AtomicString::find().

* wtf/text/AtomicString.cpp:
(HashAndCharacters):
(WTF::HashAndCharactersTranslator::hash):
(WTF::HashAndCharactersTranslator::equal):
(WTF::HashAndCharactersTranslator::translate):
Use a template to make the struct and the translator independant of the CharacterType.

(WTF::AtomicString::add):
(WTF::findString):
(WTF::AtomicString::find): Change the API to take a StringImpl*. AtomicString can use
it efficiently to find the right string.
* wtf/text/AtomicString.h:
(AtomicString):
* wtf/text/StringImpl.h:
(StringImpl): Adapt the friends translator to support the template.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@125356 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WTF/ChangeLog
Source/WTF/wtf/text/AtomicString.cpp
Source/WTF/wtf/text/AtomicString.h
Source/WTF/wtf/text/StringImpl.h
Source/WebCore/ChangeLog
Source/WebCore/bindings/js/JSDOMBinding.cpp