⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 293703 in webkit


Ignore:
Timestamp:
May 2, 2022, 5:37:42 PM (4 years ago)
Author:
Chris Dumez
Message:

Drop some unused StringImpl / AtomStringImpl / AtomString API
​https://bugs.webkit.org/show_bug.cgi?id=239912

Reviewed by Yusuke Suzuki.

Simplifies our API a bit and encourages people to write more efficient
code.

  • Tools/TestWebKitAPI/Tests/WTF/StringImpl.cpp:

(TestWebKitAPI::TEST):

  • Tools/TestWebKitAPI/Tests/WTF/StringOperators.cpp:

(TestWebKitAPI::TEST):

  • Tools/TestWebKitAPI/Tests/WTF/StringView.cpp:

(TestWebKitAPI::TEST):

  • Tools/TestWebKitAPI/Tests/WTF/cocoa/URLExtras.mm:

(TestWebKitAPI::TEST):

  • Source/JavaScriptCore/API/JSValue.mm:

(createStructHandlerMap):

  • Source/JavaScriptCore/runtime/CachedTypes.cpp:

(JSC::CachedUniquedStringImplBase::decode const):

  • Source/JavaScriptCore/runtime/Identifier.cpp:

(JSC::Identifier::addLiteral): Deleted.

  • Source/JavaScriptCore/runtime/Identifier.h:

(JSC::Identifier::Identifier):
(JSC::Identifier::add):

  • Source/JavaScriptCore/runtime/ObjectPrototype.cpp:

(JSC::inferBuiltinTag):
(JSC::objectPrototypeToString):

  • Source/JavaScriptCore/runtime/SmallStrings.cpp:

(JSC::SmallStrings::initializeCommonStrings):
(JSC::SmallStrings::initialize):

  • Source/JavaScriptCore/runtime/SmallStrings.h:
  • Source/WTF/wtf/text/AtomString.h:

(WTF::AtomString::AtomString):

  • Source/WTF/wtf/text/AtomStringImpl.cpp:

(WTF::CStringTranslator::hash): Deleted.
(WTF::CStringTranslator::equal): Deleted.
(WTF::CStringTranslator::translate): Deleted.

  • Source/WTF/wtf/text/AtomStringImpl.h:
  • Source/WTF/wtf/text/StringImpl.cpp:
  • Source/WTF/wtf/text/StringImpl.h:

(WTF::StringImpl::create):
(WTF::StringImpl::createFromCString):
(WTF::lengthOfNullTerminatedString): Deleted.

  • Source/WTF/wtf/text/WTFString.cpp:

(WTF::String::String):

  • Source/WTF/wtf/text/WTFString.h:
  • Source/WebCore/rendering/mathml/RenderMathMLFenced.cpp:

(WebCore::RenderMathMLFenced::updateFromElement):

Canonical link: ​https://commits.webkit.org/250194@main

Location:
trunk
Files:
22 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/API/JSValue.mm

    r292929 r293703  
    11601160        {
    11611161            auto type = adoptSystem<char[]>(method_copyArgumentType(method, 2));
    1162             structHandlers->add(StringImpl::create(type.get()), (StructTagHandler) { selector, 0 });
     1162            structHandlers->add(StringImpl::createFromCString(type.get()), (StructTagHandler) { selector, 0 });
    11631163        }
    11641164    });
  • trunk/Source/JavaScriptCore/runtime/CachedTypes.cpp

    r292929 r293703  
    756756            if (m_isSymbol)
    757757                return &SymbolImpl::createNullSymbol().leakRef();
    758             return AtomStringImpl::add("").leakRef();
     758            return RefPtr { emptyAtom().impl() }.leakRef();
    759759        }
    760760
  • trunk/Source/JavaScriptCore/runtime/Identifier.cpp

    r292193 r293703  
    2727
    2828namespace JSC {
    29 
    30 Ref<AtomStringImpl> Identifier::addLiteral(VM& vm, const char* literal, size_t length)
    31 {
    32     if (length == 1)
    33         return vm.smallStrings.singleCharacterStringRep(literal[0]);
    34 
    35     return AtomStringImpl::addLiteral(literal, length);
    36 }
    3729
    3830Ref<AtomStringImpl> Identifier::add8(VM& vm, const UChar* s, int length)
  • trunk/Source/JavaScriptCore/runtime/Identifier.h

    r293292 r293703  
    170170    Identifier(VM& vm, const LChar* s, int length) : m_string(add(vm, s, length)) { ASSERT(m_string.impl()->isAtom()); }
    171171    Identifier(VM& vm, const UChar* s, int length) : m_string(add(vm, s, length)) { ASSERT(m_string.impl()->isAtom()); }
    172     ALWAYS_INLINE Identifier(VM& vm, ASCIILiteral literal) : m_string(addLiteral(vm, literal.characters(), literal.length())) { ASSERT(m_string.impl()->isAtom()); }
     172    ALWAYS_INLINE Identifier(VM& vm, ASCIILiteral literal) : m_string(add(vm, literal)) { ASSERT(m_string.impl()->isAtom()); }
    173173    Identifier(VM&, AtomStringImpl*);
    174174    Identifier(VM&, const AtomString&);
    … …  
    195195
    196196    static Ref<AtomStringImpl> add(VM&, StringImpl*);
    197     JS_EXPORT_PRIVATE static Ref<AtomStringImpl> addLiteral(VM&, const char*, size_t length);
     197    static Ref<AtomStringImpl> add(VM&, ASCIILiteral);
    198198
    199199#ifndef NDEBUG
    … …  
    227227
    228228    return *AtomStringImpl::add(s, length);
     229}
     230
     231inline Ref<AtomStringImpl> Identifier::add(VM& vm, ASCIILiteral literal)
     232{
     233    if (literal.length() == 1)
     234        return vm.smallStrings.singleCharacterStringRep(literal.characterAt(0));
     235    return AtomStringImpl::add(literal);
    229236}
    230237
  • trunk/Source/JavaScriptCore/runtime/ObjectPrototype.cpp

    r292929 r293703  
    322322#endif
    323323
    324 inline const char* inferBuiltinTag(JSGlobalObject* globalObject, JSObject* object)
     324inline ASCIILiteral inferBuiltinTag(JSGlobalObject* globalObject, JSObject* object)
    325325{
    326326    VM& vm = globalObject->vm();
    … …  
    332332    auto scope = DECLARE_THROW_SCOPE(vm);
    333333    bool objectIsArray = isArray(globalObject, object);
    334     RETURN_IF_EXCEPTION(scope, nullptr);
     334    RETURN_IF_EXCEPTION(scope, { });
    335335    if (objectIsArray)
    336         return "Array";
     336        return "Array"_s;
    337337    if (object->isCallable())
    338         return "Function";
     338        return "Function"_s;
    339339    JSType type = object->type();
    340340    if (TypeInfo::isArgumentsType(type)
    … …  
    347347        || type == RegExpObjectType)
    348348        return object->className();
    349     return "Object";
     349    return "Object"_s;
    350350}
    351351
    … …  
    367367        return asString(result);
    368368
    369     const char* tag = inferBuiltinTag(globalObject, thisObject);
     369    ASCIILiteral tag = inferBuiltinTag(globalObject, thisObject);
    370370    RETURN_IF_EXCEPTION(scope, nullptr);
    371371    JSString* jsTag = nullptr;
    … …  
    382382
    383383    if (!jsTag)
    384         jsTag = jsString(vm, AtomStringImpl::add(tag).releaseNonNull());
     384        jsTag = jsString(vm, AtomStringImpl::add(tag));
    385385
    386386    JSString* jsResult = jsString(globalObject, vm.smallStrings.objectStringStart(), jsTag, vm.smallStrings.singleCharacterString(']'));
  • trunk/Source/JavaScriptCore/runtime/SmallStrings.cpp

    r291946 r293703  
    5353    }
    5454
    55 #define JSC_COMMON_STRINGS_ATTRIBUTE_INITIALIZE(name) initialize(&vm, m_##name, #name);
     55#define JSC_COMMON_STRINGS_ATTRIBUTE_INITIALIZE(name) initialize(&vm, m_##name, #name ## _s);
    5656    JSC_COMMON_STRINGS_EACH_NAME(JSC_COMMON_STRINGS_ATTRIBUTE_INITIALIZE)
    5757#undef JSC_COMMON_STRINGS_ATTRIBUTE_INITIALIZE
    58     initialize(&vm, m_objectStringStart, "[object ");
    59     initialize(&vm, m_nullObjectString, "[object Null]");
    60     initialize(&vm, m_undefinedObjectString, "[object Undefined]");
    61     initialize(&vm, m_boundPrefixString, "bound ");
    62     initialize(&vm, m_notEqualString, "not-equal");
    63     initialize(&vm, m_timedOutString, "timed-out");
    64     initialize(&vm, m_okString, "ok");
    65     initialize(&vm, m_sentinelString, "$");
     58    initialize(&vm, m_objectStringStart, "[object "_s);
     59    initialize(&vm, m_nullObjectString, "[object Null]"_s);
     60    initialize(&vm, m_undefinedObjectString, "[object Undefined]"_s);
     61    initialize(&vm, m_boundPrefixString, "bound "_s);
     62    initialize(&vm, m_notEqualString, "not-equal"_s);
     63    initialize(&vm, m_timedOutString, "timed-out"_s);
     64    initialize(&vm, m_okString, "ok"_s);
     65    initialize(&vm, m_sentinelString, "$"_s);
    6666
    6767    setIsInitialized(true);
    … …  
    103103}
    104104
    105 void SmallStrings::initialize(VM* vm, JSString*& string, const char* value)
     105void SmallStrings::initialize(VM* vm, JSString*& string, ASCIILiteral value)
    106106{
    107     string = JSString::create(*vm, AtomStringImpl::add(value).releaseNonNull());
     107    string = JSString::create(*vm, AtomStringImpl::add(value));
    108108    ASSERT(m_needsToBeVisited);
    109109}
  • trunk/Source/JavaScriptCore/runtime/SmallStrings.h

    r283098 r293703  
    132132    static constexpr unsigned singleCharacterStringCount = maxSingleCharacterString + 1;
    133133
    134     void initialize(VM*, JSString*&, const char* value);
     134    void initialize(VM*, JSString*&, ASCIILiteral value);
    135135
    136136    JSString* m_emptyString { nullptr };
  • trunk/Source/WTF/wtf/text/AtomString.h

    r293701 r293703  
    4141    AtomString(const LChar*, unsigned length);
    4242    AtomString(const UChar*, unsigned length);
    43     AtomString(const UChar*);
    4443
    4544    ALWAYS_INLINE static AtomString fromLatin1(const char* characters) { return AtomString(characters); }
    … …  
    143142
    144143    AtomString(const wchar_t* characters)
    145         : AtomString(ucharFrom(characters)) { }
     144        : AtomString(characters, characters ? wcslen(characters) : 0) { }
    146145#endif
    147146
    … …  
    204203
    205204inline AtomString::AtomString(const char* string)
    206     : m_string(AtomStringImpl::add(string))
     205    : m_string(AtomStringImpl::addCString(string))
    207206{
    208207}
    … …  
    215214inline AtomString::AtomString(const UChar* string, unsigned length)
    216215    : m_string(AtomStringImpl::add(string, length))
    217 {
    218 }
    219 
    220 inline AtomString::AtomString(const UChar* string)
    221     : m_string(AtomStringImpl::add(string))
    222216{
    223217}
  • trunk/Source/WTF/wtf/text/AtomStringImpl.cpp

    r293656 r293703  
    8989}
    9090
    91 struct CStringTranslator {
    92     static unsigned hash(const LChar* characters)
    93     {
    94         return StringHasher::computeHashAndMaskTop8Bits(characters);
    95     }
    96 
    97     static inline bool equal(PackedPtr<StringImpl> str, const LChar* characters)
    98     {
    99         return WTF::equal(str.get(), characters);
    100     }
    101 
    102     static void translate(PackedPtr<StringImpl>& location, const LChar* const& characters, unsigned hash)
    103     {
    104         auto* pointer = &StringImpl::create(characters).leakRef();
    105         pointer->setHash(hash);
    106         pointer->setIsAtom(true);
    107         location = pointer;
    108     }
    109 };
    110 
    111 RefPtr<AtomStringImpl> AtomStringImpl::add(const LChar* characters)
    112 {
    113     if (!characters)
    114         return nullptr;
    115     if (!*characters)
    116         return static_cast<AtomStringImpl*>(StringImpl::empty());
    117 
    118     return addToStringTable<const LChar*, CStringTranslator>(characters);
    119 }
    120 
    12191using UCharBuffer = HashTranslatorCharBuffer<UChar>;
    12292struct UCharBufferTranslator {
    … …  
    222192}
    223193
    224 RefPtr<AtomStringImpl> AtomStringImpl::add(const UChar* characters)
    225 {
    226     if (!characters)
    227         return nullptr;
    228 
    229     unsigned length = 0;
    230     while (characters[length] != UChar(0))
    231         ++length;
    232 
    233     if (!length)
    234         return static_cast<AtomStringImpl*>(StringImpl::empty());
    235 
    236     UCharBuffer buffer { characters, length };
    237     return addToStringTable<UCharBuffer, UCharBufferTranslator>(buffer);
    238 }
    239 
    240194struct SubstringLocation {
    241195    StringImpl* baseString;
  • trunk/Source/WTF/wtf/text/AtomStringImpl.h

    r293656 r293703  
    4040    static void remove(AtomStringImpl*);
    4141
    42     WTF_EXPORT_PRIVATE static RefPtr<AtomStringImpl> add(const LChar*);
    43     ALWAYS_INLINE static RefPtr<AtomStringImpl> add(const char* s) { return add(reinterpret_cast<const LChar*>(s)); };
    4442    WTF_EXPORT_PRIVATE static RefPtr<AtomStringImpl> add(const LChar*, unsigned length);
    4543    WTF_EXPORT_PRIVATE static RefPtr<AtomStringImpl> add(const UChar*, unsigned length);
    46     ALWAYS_INLINE static RefPtr<AtomStringImpl> add(const char* s, unsigned length) { return add(reinterpret_cast<const LChar*>(s), length); };
    47     WTF_EXPORT_PRIVATE static RefPtr<AtomStringImpl> add(const UChar*);
     44    ALWAYS_INLINE static RefPtr<AtomStringImpl> add(const char* s, unsigned length) { return add(reinterpret_cast<const LChar*>(s), length); }
    4845    WTF_EXPORT_PRIVATE static RefPtr<AtomStringImpl> add(StringImpl*, unsigned offset, unsigned length);
    4946    ALWAYS_INLINE static RefPtr<AtomStringImpl> add(StringImpl* string)
    … …  
    6057    }
    6158    WTF_EXPORT_PRIVATE static RefPtr<AtomStringImpl> add(const StaticStringImpl*);
    62     WTF_EXPORT_PRIVATE static Ref<AtomStringImpl> addLiteral(const char* characters, unsigned length);
     59    ALWAYS_INLINE static Ref<AtomStringImpl> add(ASCIILiteral literal) { return addLiteral(literal.characters(), literal.length()); }
     60
     61    // Not using the add() naming to encourage developers to call add(ASCIILiteral) when they have a string literal.
     62    ALWAYS_INLINE static RefPtr<AtomStringImpl> addCString(const char* s) { return s ? add(s, strlen(s)) : nullptr; }
    6363
    6464    // Returns null if the input data contains an invalid UTF-8 sequence.
    … …  
    102102    }
    103103
     104    WTF_EXPORT_PRIVATE static Ref<AtomStringImpl> addLiteral(const char* characters, unsigned length);
     105
    104106    ALWAYS_INLINE static Ref<AtomStringImpl> add(AtomStringTable& stringTable, StringImpl& string)
    105107    {
  • trunk/Source/WTF/wtf/text/StringImpl.cpp

    r293639 r293703  
    320320}
    321321
    322 Ref<StringImpl> StringImpl::create8BitIfPossible(const UChar* string)
    323 {
    324     return StringImpl::create8BitIfPossible(string, lengthOfNullTerminatedString(string));
    325 }
    326 
    327 Ref<StringImpl> StringImpl::create(const LChar* string)
    328 {
    329     if (!string)
    330         return *empty();
    331     size_t length = strlen(reinterpret_cast<const char*>(string));
    332     if (length > MaxLength)
    333         CRASH();
    334     return create(string, length);
    335 }
    336 
    337322Ref<StringImpl> StringImpl::substring(unsigned start, unsigned length)
    338323{
  • trunk/Source/WTF/wtf/text/StringImpl.h

    r293639 r293703  
    238238    WTF_EXPORT_PRIVATE static Ref<StringImpl> create(const UChar*, unsigned length);
    239239    WTF_EXPORT_PRIVATE static Ref<StringImpl> create(const LChar*, unsigned length);
     240    ALWAYS_INLINE static Ref<StringImpl> create(const char* characters, unsigned length) { return create(reinterpret_cast<const LChar*>(characters), length); }
    240241    WTF_EXPORT_PRIVATE static Ref<StringImpl> create8BitIfPossible(const UChar*, unsigned length);
    241242    template<size_t inlineCapacity> static Ref<StringImpl> create8BitIfPossible(const Vector<UChar, inlineCapacity>&);
    242     WTF_EXPORT_PRIVATE static Ref<StringImpl> create8BitIfPossible(const UChar*);
    243 
    244     ALWAYS_INLINE static Ref<StringImpl> create(const char* characters, unsigned length) { return create(reinterpret_cast<const LChar*>(characters), length); }
    245     WTF_EXPORT_PRIVATE static Ref<StringImpl> create(const LChar*);
    246     ALWAYS_INLINE static Ref<StringImpl> create(const char* string) { return create(reinterpret_cast<const LChar*>(string)); }
     243
     244    // Not using create() naming to encourage developers to call create(ASCIILiteral) when they have a string literal.
     245    ALWAYS_INLINE static Ref<StringImpl> createFromCString(const char* characters) { return create(characters, strlen(characters)); }
    247246
    248247    static Ref<StringImpl> createSubstringSharingImpl(StringImpl&, unsigned offset, unsigned length);
    … …  
    610609bool isNotSpaceOrNewline(UChar32);
    611610
    612 template<typename CharacterType> unsigned lengthOfNullTerminatedString(const CharacterType*);
    613 
    614611// StringHashd is the default hash for StringImpl* and RefPtr<StringImpl>
    615612template<typename> struct DefaultHash;
    … …  
    774771{
    775772    return !isSpaceOrNewline(character);
    776 }
    777 
    778 template<typename CharacterType> inline unsigned lengthOfNullTerminatedString(const CharacterType* string)
    779 {
    780     ASSERT(string);
    781     size_t length = 0;
    782     while (string[length])
    783         ++length;
    784 
    785     RELEASE_ASSERT(length < StringImpl::MaxLength);
    786     return static_cast<unsigned>(length);
    787773}
    788774
  • trunk/Source/WTF/wtf/text/WTFString.cpp

    r293301 r293703  
    4747}
    4848
    49 // Construct a string with UTF-16 data, from a null-terminated source.
    50 String::String(const UChar* nullTerminatedString)
    51 {
    52     if (nullTerminatedString)
    53         m_impl = StringImpl::create(nullTerminatedString, lengthOfNullTerminatedString(nullTerminatedString));
    54 }
    55 
    5649// Construct a string with latin1 data.
    5750String::String(const LChar* characters, unsigned length)
    … …  
    7164{
    7265    if (nullTerminatedString)
    73         m_impl = StringImpl::create(reinterpret_cast<const LChar*>(nullTerminatedString));
     66        m_impl = StringImpl::createFromCString(nullTerminatedString);
    7467}
    7568
  • trunk/Source/WTF/wtf/text/WTFString.h

    r293656 r293703  
    7474    explicit String(const Vector<UChar, inlineCapacity, OverflowHandler>&);
    7575
    76     // Construct a string with UTF-16 data, from a null-terminated source.
    77     WTF_EXPORT_PRIVATE String(const UChar*);
    78 
    7976    // Construct a string with Latin-1 data.
    8077    WTF_EXPORT_PRIVATE String(const LChar* characters, unsigned length);
    … …  
    276273
    277274    String(const wchar_t* characters)
    278         : String(ucharFrom(characters)) { }
     275        : String(characters, characters ? wcslen(characters) : 0) { }
    279276
    280277    WTF_EXPORT_PRIVATE Vector<wchar_t> wideCharacters() const;
  • trunk/Source/WebCore/platform/win/ClipboardUtilitiesWin.cpp

    r293326 r293703  
    8484    if (title) {
    8585        PathRemoveExtension(filename);
    86         *title = String((UChar*)filename);
     86        *title = String(filename);
    8787    }
    8888   
    89     url = String((UChar*)urlBuffer);
     89    url = String(urlBuffer);
    9090    succeeded = true;
    9191
    … …  
    449449    if (SUCCEEDED(dataObject->GetData(urlWFormat(), &store))) {
    450450        // URL using Unicode
    451         UChar* data = static_cast<UChar*>(GlobalLock(store.hGlobal));
     451        auto* data = static_cast<wchar_t*>(GlobalLock(store.hGlobal));
    452452        url = extractURL(String(data), title);
    453453        GlobalUnlock(store.hGlobal);
    … …  
    520520    if (SUCCEEDED(dataObject->GetData(plainTextWFormat(), &store))) {
    521521        // Unicode text
    522         UChar* data = static_cast<UChar*>(GlobalLock(store.hGlobal));
     522        auto* data = static_cast<wchar_t*>(GlobalLock(store.hGlobal));
    523523        text = String(data);
    524524        GlobalUnlock(store.hGlobal);
    … …  
    555555    String html;
    556556    if (SUCCEEDED(data->GetData(texthtmlFormat(), &store))) {
    557         UChar* data = static_cast<UChar*>(GlobalLock(store.hGlobal));
     557        auto* data = static_cast<wchar_t*>(GlobalLock(store.hGlobal));
    558558        html = String(data);
    559559        GlobalUnlock(store.hGlobal);
  • trunk/Source/WebCore/platform/win/PasteboardWin.cpp

    r293484 r293703  
    631631
    632632    if (extension.isEmpty())
    633         return String(fsPathBuffer);
     633        return String(wcharFrom(fsPathBuffer));
    634634
    635635    if (!isLink && usedURL) {
    636636        PathRenameExtension(wcharFrom(fsPathBuffer), extension.wideCharacters().data());
    637         return String(fsPathBuffer);
     637        return String(wcharFrom(fsPathBuffer));
    638638    }
    639639
    … …  
    830830    if (::IsClipboardFormatAvailable(CF_UNICODETEXT) && ::OpenClipboard(m_owner)) {
    831831        if (HANDLE cbData = ::GetClipboardData(CF_UNICODETEXT)) {
    832             text.text = static_cast<UChar*>(GlobalLock(cbData));
     832            text.text = static_cast<wchar_t*>(GlobalLock(cbData));
    833833            GlobalUnlock(cbData);
    834834            ::CloseClipboard();
    … …  
    873873            HANDLE cbData = ::GetClipboardData(CF_UNICODETEXT);
    874874            if (cbData) {
    875                 UChar* buffer = static_cast<UChar*>(GlobalLock(cbData));
     875                auto* buffer = static_cast<wchar_t*>(GlobalLock(cbData));
    876876                String str(buffer);
    877877                GlobalUnlock(cbData);
  • trunk/Source/WebCore/rendering/mathml/RenderMathMLFenced.cpp

    r292810 r293703  
    7676    } else {
    7777        // The separator defaults to a single comma.
    78         m_separators = StringImpl::create(",");
     78        m_separators = StringImpl::createFromLiteral(","_s);
    7979    }
    8080
  • trunk/Source/WebKitLegacy/win/DOMCoreClasses.cpp

    r278253 r293703  
    417417{
    418418    auto webListener = WebEventListener::create(listener);
    419     m_node->addEventListener(ucharFrom(type), WTFMove(webListener), useCapture);
     419    m_node->addEventListener(String(type), WTFMove(webListener), useCapture);
    420420
    421421    return S_OK;
    … …  
    429429        return E_FAIL;
    430430    auto webListener = WebEventListener::create(listener);
    431     m_node->removeEventListener(ucharFrom(type), webListener, useCapture);
     431    m_node->removeEventListener(String(type), webListener, useCapture);
    432432    return S_OK;
    433433}
    … …  
    927927        return E_FAIL;
    928928    auto webListener = WebEventListener::create(listener);
    929     m_window->addEventListener(ucharFrom(type), WTFMove(webListener), useCapture);
     929    m_window->addEventListener(String(type), WTFMove(webListener), useCapture);
    930930    return S_OK;
    931931}
    … …  
    938938        return E_FAIL;
    939939    auto webListener = WebEventListener::create(listener);
    940     m_window->removeEventListener(ucharFrom(type), webListener, useCapture);
     940    m_window->removeEventListener(String(type), webListener, useCapture);
    941941    return S_OK;
    942942}
  • trunk/Tools/TestWebKitAPI/Tests/WTF/StringImpl.cpp

    r293639 r293703  
    120120    auto c = StringImpl::createFromLiteral("abcdefg"_s);
    121121    constexpr auto d = "aBcDeFG"_s;
    122     auto empty = StringImpl::create(reinterpret_cast<const LChar*>(""));
     122    auto empty = StringImpl::create(reinterpret_cast<const LChar*>(""), 0);
    123123    auto shorter = StringImpl::createFromLiteral("abcdef"_s);
    124124    auto different = StringImpl::createFromLiteral("abcrefg"_s);
    … …  
    163163TEST(WTF, StringImplEqualIgnoringASCIICaseWithEmpty)
    164164{
    165     auto a = StringImpl::create(reinterpret_cast<const LChar*>(""));
    166     auto b = StringImpl::create(reinterpret_cast<const LChar*>(""));
     165    auto a = StringImpl::create(reinterpret_cast<const LChar*>(""), 0);
     166    auto b = StringImpl::create(reinterpret_cast<const LChar*>(""), 0);
    167167    ASSERT_TRUE(equalIgnoringASCIICase(a.ptr(), b.ptr()));
    168168    ASSERT_TRUE(equalIgnoringASCIICase(b.ptr(), a.ptr()));
    … …  
    342342{
    343343    auto reference = stringFromUTF8("ABCÉEFG");
    344     auto empty = StringImpl::create(reinterpret_cast<const LChar*>(""));
     344    auto empty = StringImpl::create(reinterpret_cast<const LChar*>(""), 0);
    345345    EXPECT_EQ(static_cast<size_t>(0), reference->findIgnoringASCIICase(empty.ptr()));
    346346    EXPECT_EQ(static_cast<size_t>(0), reference->findIgnoringASCIICase(empty.ptr(), 0));
    … …  
    418418    ASSERT_FALSE(reference->startsWithIgnoringASCIICase(StringView { }));
    419419
    420     auto empty = StringImpl::create(reinterpret_cast<const LChar*>(""));
     420    auto empty = StringImpl::create(reinterpret_cast<const LChar*>(""), 0);
    421421    ASSERT_FALSE(empty->startsWithIgnoringASCIICase(StringView { }));
    422422}
    … …  
    425425{
    426426    auto reference = StringImpl::createFromLiteral("aBcDeFG"_s);
    427     auto empty = StringImpl::create(reinterpret_cast<const LChar*>(""));
     427    auto empty = StringImpl::create(reinterpret_cast<const LChar*>(""), 0);
    428428    ASSERT_TRUE(reference->startsWithIgnoringASCIICase(empty.ptr()));
    429429    ASSERT_TRUE(reference->startsWithIgnoringASCIICase(*empty.ptr()));
    … …  
    507507    ASSERT_FALSE(reference->endsWithIgnoringASCIICase(StringView { }));
    508508
    509     auto empty = StringImpl::create(reinterpret_cast<const LChar*>(""));
     509    auto empty = StringImpl::create(reinterpret_cast<const LChar*>(""), 0);
    510510    ASSERT_FALSE(empty->endsWithIgnoringASCIICase(StringView { }));
    511511}
    … …  
    514514{
    515515    auto reference = StringImpl::createFromLiteral("aBcDeFG"_s);
    516     auto empty = StringImpl::create(reinterpret_cast<const LChar*>(""));
     516    auto empty = StringImpl::create(reinterpret_cast<const LChar*>(""), 0);
    517517    ASSERT_TRUE(reference->endsWithIgnoringASCIICase(empty.ptr()));
    518518    ASSERT_TRUE(reference->endsWithIgnoringASCIICase(*empty.ptr()));
  • trunk/Tools/TestWebKitAPI/Tests/WTF/StringOperators.cpp

    r292810 r293703  
    259259    String concatenation16 = ucharArray + emptyString;
    260260    ASSERT_EQ(static_cast<unsigned>(4), concatenation16.length());
    261     ASSERT_TRUE(concatenation16 == String(ucharArray));
     261    ASSERT_TRUE(concatenation16 == String(ucharArray, 4));
    262262
    263263    LChar lcharArray[] = { 't', 'e', 's', 't' };
  • trunk/Tools/TestWebKitAPI/Tests/WTF/StringView.cpp

    r293639 r293703  
    340340    RefPtr<StringImpl> c = StringImpl::createFromLiteral("abcdefg"_s);
    341341    constexpr auto d = "aBcDeFG"_s;
    342     RefPtr<StringImpl> empty = StringImpl::create(reinterpret_cast<const LChar*>(""));
     342    RefPtr<StringImpl> empty = StringImpl::create(reinterpret_cast<const LChar*>(""), 0);
    343343    RefPtr<StringImpl> shorter = StringImpl::createFromLiteral("abcdef"_s);
    344344    RefPtr<StringImpl> different = StringImpl::createFromLiteral("abcrefg"_s);
    … …  
    385385TEST(WTF, StringViewEqualIgnoringASCIICaseWithEmpty)
    386386{
    387     RefPtr<StringImpl> a = StringImpl::create(reinterpret_cast<const LChar*>(""));
    388     RefPtr<StringImpl> b = StringImpl::create(reinterpret_cast<const LChar*>(""));
     387    RefPtr<StringImpl> a = StringImpl::create(reinterpret_cast<const LChar*>(""), 0);
     388    RefPtr<StringImpl> b = StringImpl::create(reinterpret_cast<const LChar*>(""), 0);
    389389    StringView stringViewA(*a.get());
    390390    StringView stringViewB(*b.get());
    … …  
    395395TEST(WTF, StringViewEqualIgnoringASCIICaseWithLatin1Characters)
    396396{
    397     RefPtr<StringImpl> a = StringImpl::create(reinterpret_cast<const LChar*>("aBcéeFG"));
    398     RefPtr<StringImpl> b = StringImpl::create(reinterpret_cast<const LChar*>("ABCÉEFG"));
    399     RefPtr<StringImpl> c = StringImpl::create(reinterpret_cast<const LChar*>("ABCéEFG"));
    400     RefPtr<StringImpl> d = StringImpl::create(reinterpret_cast<const LChar*>("abcéefg"));
     397    RefPtr<StringImpl> a = StringImpl::create(reinterpret_cast<const LChar*>("aBcéeFG"), 7);
     398    RefPtr<StringImpl> b = StringImpl::create(reinterpret_cast<const LChar*>("ABCÉEFG"), 7);
     399    RefPtr<StringImpl> c = StringImpl::create(reinterpret_cast<const LChar*>("ABCéEFG"), 7);
     400    RefPtr<StringImpl> d = StringImpl::create(reinterpret_cast<const LChar*>("abcéefg"), 7);
    401401    StringView stringViewA(*a.get());
    402402    StringView stringViewB(*b.get());
    … …  
    983983    EXPECT_FALSE(StringView(String::fromLatin1("📱")).isAllASCII());
    984984    EXPECT_FALSE(StringView(String::fromLatin1("\u0080")).isAllASCII());
    985     EXPECT_TRUE(StringView(String(bitwise_cast<const UChar*>(u"Hello"))).isAllASCII());
     985    EXPECT_TRUE(StringView(String(bitwise_cast<const UChar*>(u"Hello"), 0)).isAllASCII());
    986986}
    987987
  • trunk/Tools/TestWebKitAPI/Tests/WTF/cocoa/URLExtras.mm

    r292856 r293703  
    235235
    236236    std::array<UChar, 3> utf16 { 0xC2, 0xB6, 0x00 };
    237     WTF::URL url3 { String(utf16.data()) };
     237    WTF::URL url3 { String(utf16.data(), utf16.size()) };
    238238    EXPECT_FALSE(url3.string().is8Bit());
    239239    EXPECT_FALSE(url3.isValid());
Note: See TracChangeset for help on using the changeset viewer.