Changeset 161851 in webkit for trunk/Source/JavaScriptCore


Ignore:
Timestamp:
Jan 12, 2014, 6:29:47 PM (11 years ago)
Author:
Darin Adler
Message:

Add deprecatedCharacters as a synonym for characters and convert most call sites
https://bugs.webkit.org/show_bug.cgi?id=126858

Reviewed by Anders Carlsson.

Source/JavaScriptCore:

  • API/JSStringRef.cpp:

(JSStringGetCharactersPtr):
(JSStringGetUTF8CString):
(JSStringIsEqual):

  • API/JSStringRefCF.cpp:

(JSStringCopyCFString):

  • API/OpaqueJSString.h:

(OpaqueJSString::characters):
(OpaqueJSString::deprecatedCharacters):
(OpaqueJSString::length):
(OpaqueJSString::OpaqueJSString):

  • inspector/InspectorValues.cpp:

(Inspector::InspectorValue::parseJSON):

  • runtime/JSGlobalObjectFunctions.cpp:

(JSC::parseInt):

  • runtime/StringPrototype.cpp:

(JSC::localeCompare):
(JSC::stringProtoFuncFontsize):
(JSC::stringProtoFuncLink):
Use deprecatedCharacters instead of characters.

Source/WebCore:

  • Modules/indexeddb/IDBKeyPath.cpp:

(WebCore::IDBKeyPathLexer::IDBKeyPathLexer):

  • Modules/websockets/ThreadableWebSocketChannelClientWrapper.cpp:

(WebCore::ThreadableWebSocketChannelClientWrapper::setSubprotocol):
(WebCore::ThreadableWebSocketChannelClientWrapper::setExtensions):

  • accessibility/AccessibilityObject.cpp:

(WebCore::AccessibilityObject::hasMisspelling):

  • accessibility/mac/WebAccessibilityObjectWrapperMac.mm:

(-[WebAccessibilityObjectWrapper doAXAttributedStringForTextMarkerRange:]):

  • bindings/js/SerializedScriptValue.cpp:

(WebCore::CloneSerializer::serialize):
(WebCore::CloneSerializer::write):

  • dom/CharacterData.cpp:

(WebCore::CharacterData::parserAppendData):

  • dom/Document.cpp:

(WebCore::Document::parseQualifiedName):

  • editing/Editor.cpp:

(WebCore::Editor::misspelledWordAtCaretOrRange):
(WebCore::Editor::misspelledSelectionString):
(WebCore::Editor::markAllMisspellingsAndBadGrammarInRanges):

  • editing/TextCheckingHelper.cpp:

(WebCore::TextCheckingHelper::findFirstMisspellingOrBadGrammar):
(WebCore::TextCheckingHelper::findFirstBadGrammar):
(WebCore::TextCheckingHelper::guessesForMisspelledOrUngrammaticalRange):

  • editing/TextCheckingHelper.h:

(WebCore::TextCheckingParagraph::textDeprecatedCharacters):

  • editing/TextIterator.cpp:

(WebCore::collapsedSpaceLength):
(WebCore::SimplifiedBackwardsTextIterator::handleTextNode):
(WebCore::containsKanaLetters):
(WebCore::SearchBuffer::SearchBuffer):

  • editing/TextIterator.h:

(WebCore::TextIterator::characters):

  • editing/VisiblePosition.cpp:

(WebCore::VisiblePosition::characterAfter):

  • editing/VisibleUnits.cpp:

(WebCore::wordBreakIteratorForMinOffsetBoundary):
(WebCore::wordBreakIteratorForMaxOffsetBoundary):
(WebCore::visualWordPosition):
(WebCore::previousBoundary):
(WebCore::nextBoundary):

  • fileapi/WebKitBlobBuilder.cpp:

(WebCore::BlobBuilder::append):

  • html/FormDataList.cpp:

(WebCore::FormDataList::appendString):

  • html/canvas/CanvasRenderingContext2D.cpp:

(WebCore::normalizeSpaces):

  • html/parser/HTMLParserIdioms.cpp:

(WebCore::parseImagesWithScaleFromSrcsetAttribute):

  • html/parser/HTMLTreeBuilder.cpp:

(WebCore::HTMLTreeBuilder::ExternalCharacterTokenBuffer::ExternalCharacterTokenBuffer):

  • loader/appcache/ManifestParser.cpp:

(WebCore::parseManifest):

  • page/ContentSecurityPolicy.cpp:

(WebCore::isSourceListNone):
(WebCore::CSPSourceList::parse):
(WebCore::NonceDirective::parse):
(WebCore::MediaListDirective::parse):
(WebCore::CSPDirectiveList::parse):
(WebCore::CSPDirectiveList::parseReportURI):
(WebCore::CSPDirectiveList::parseReflectedXSS):
(WebCore::ContentSecurityPolicy::didReceiveHeader):

  • page/PageSerializer.cpp:

(WebCore::PageSerializer::serializeFrame):
(WebCore::PageSerializer::serializeCSSStyleSheet):

  • platform/Length.cpp:

(WebCore::newCoordsArray):
(WebCore::newLengthArray):

  • platform/LinkHash.cpp:

(WebCore::visitedURL):
(WebCore::visitedLinkHash):

  • platform/SharedBuffer.cpp:

(WebCore::utf8Buffer):

  • platform/URL.cpp:

(WebCore::URL::port):
(WebCore::encodeHostnames):

  • platform/graphics/StringTruncator.cpp:

(WebCore::centerTruncateToBuffer):
(WebCore::rightTruncateToBuffer):
(WebCore::rightClipToCharacterBuffer):
(WebCore::rightClipToWordBuffer):
(WebCore::leftTruncateToBuffer):
(WebCore::truncateString):
(WebCore::StringTruncator::width):

  • platform/graphics/TextRun.h:

(WebCore::TextRun::TextRun):

  • platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:

(WebCore::MediaPlayerPrivateAVFoundationObjC::shouldWaitForLoadingOfResource):

  • platform/network/FormDataBuilder.cpp:

(WebCore::FormDataBuilder::addFilenameToMultiPartHeader):

  • platform/sql/SQLiteStatement.cpp:

(WebCore::SQLiteStatement::bindBlob):
(WebCore::SQLiteStatement::bindText):

  • platform/text/DecodeEscapeSequences.h:

(WebCore::decodeEscapeSequences):

  • platform/text/TextBreakIterator.cpp:

(WebCore::numGraphemeClusters):
(WebCore::numCharactersInGraphemeClusters):

  • platform/text/TextBreakIteratorICU.cpp:

(WebCore::setUpIteratorWithRules):

  • platform/text/TextCodecICU.cpp:

(WebCore::TextCodecICU::encode):

  • rendering/RenderBlock.cpp:

(WebCore::RenderBlock::constructTextRun):

  • rendering/RenderListMarker.cpp:

(WebCore::RenderListMarker::paint):

  • rendering/RenderText.cpp:

(WebCore::maxWordFragmentWidth):
(WebCore::RenderText::computePreferredLogicalWidths):
(WebCore::RenderText::computeCanUseSimpleFontCodePath):

  • rendering/RenderText.h:

(WebCore::RenderText::characters):
(WebCore::RenderText::deprecatedCharacters):

  • rendering/line/BreakingContextInlineHeaders.h:

(WebCore::tryHyphenating):

  • rendering/svg/SVGInlineTextBox.cpp:

(WebCore::SVGInlineTextBox::constructTextRun):

  • rendering/svg/SVGTextLayoutAttributesBuilder.cpp:

(WebCore::processRenderSVGInlineText):

  • rendering/svg/SVGTextLayoutEngine.cpp:

(WebCore::SVGTextLayoutEngine::layoutTextOnLineOrPath):

  • rendering/svg/SVGTextMetrics.cpp:

(WebCore::SVGTextMetrics::measureCharacterRange):
(WebCore::SVGTextMetrics::SVGTextMetrics):

  • rendering/svg/SVGTextMetricsBuilder.cpp:

(WebCore::SVGTextMetricsBuilder::initializeMeasurementWithTextRenderer):

  • svg/SVGAngle.cpp:

(WebCore::SVGAngle::setValueAsString):

  • svg/SVGAnimateMotionElement.cpp:

(WebCore::parsePoint):

  • svg/SVGAnimationElement.cpp:

(WebCore::parseKeySplines):

  • svg/SVGFitToViewBox.cpp:

(WebCore::SVGFitToViewBox::parseViewBox):

  • svg/SVGFontData.cpp:

(WebCore::SVGFontData::applySVGGlyphSelection):

  • svg/SVGGlyphMap.h:

(WebCore::SVGGlyphMap::addGlyph):
(WebCore::SVGGlyphMap::collectGlyphsForString):

  • svg/SVGGlyphRefElement.cpp:

(WebCore::SVGGlyphRefElement::parseAttribute):

  • svg/SVGLength.cpp:

(WebCore::SVGLength::setValueAsString):

  • svg/SVGLengthList.cpp:

(WebCore::SVGLengthList::parse):

  • svg/SVGNumberList.cpp:

(WebCore::SVGNumberList::parse):

  • svg/SVGParserUtilities.cpp:

(WebCore::parseNumberFromString):
(WebCore::parseNumberOptionalNumber):
(WebCore::parseRect):
(WebCore::pointsListFromSVGData):
(WebCore::parseGlyphName):
(WebCore::parseKerningUnicodeString):
(WebCore::parseDelimitedString):

  • svg/SVGPreserveAspectRatio.cpp:

(WebCore::SVGPreserveAspectRatio::parse):

  • svg/SVGStringList.cpp:

(WebCore::SVGStringList::parse):

  • svg/SVGTransformList.cpp:

(WebCore::SVGTransformList::parse):

  • svg/SVGTransformable.cpp:

(WebCore::SVGTransformable::parseTransformType):

  • svg/SVGViewSpec.cpp:

(WebCore::SVGViewSpec::parseViewSpec):

  • svg/SVGZoomAndPan.h:

(WebCore::SVGZoomAndPan::parseAttribute):

  • xml/XMLHttpRequest.cpp:

(WebCore::XMLHttpRequest::send):

  • xml/XSLStyleSheetLibxslt.cpp:

(WebCore::XSLStyleSheet::parseString):

  • xml/XSLTUnicodeSort.cpp:

(WebCore::xsltUnicodeSortFunction):

  • xml/parser/XMLDocumentParserLibxml2.cpp:

(WebCore::XMLDocumentParser::doWrite):
(WebCore::parseAttributes):
Use deprecatedCharacters instead of characters.

Source/WebKit/mac:

  • History/BinaryPropertyList.cpp:

(BinaryPropertyListSerializer::appendStringObject):
Use deprecatedCharacters instead of characters.

Source/WebKit2:

  • Shared/APIString.h:
  • UIProcess/WebPageProxy.cpp:

(WebKit::WebPageProxy::checkTextOfParagraph):
(WebKit::WebPageProxy::checkSpellingOfString):
(WebKit::WebPageProxy::checkGrammarOfString):

  • WebProcess/WebPage/EncoderAdapter.cpp:

(WebKit::EncoderAdapter::encodeString):
Use deprecatedCharacters instead of characters.

Source/WTF:

  • wtf/text/AtomicString.cpp:

(WTF::HashAndUTF8CharactersTranslator::equal):
(WTF::SubstringTranslator::hash):
(WTF::SubstringTranslator::equal):

  • wtf/text/AtomicString.h:

(WTF::AtomicString::characters):

  • wtf/text/Base64.cpp:

(WTF::base64Decode):
(WTF::base64URLDecode):

  • wtf/text/StringBuilder.h:

(WTF::StringBuilder::characters):
(WTF::StringBuilder::deprecatedCharacters):

  • wtf/text/StringImpl.cpp:

(WTF::StringImpl::getData16SlowCase):
(WTF::StringImpl::upper):
(WTF::StringImpl::lower):
(WTF::StringImpl::find):
(WTF::StringImpl::findIgnoringCase):

  • wtf/text/StringImpl.h:

(WTF::StringImpl::characters):
(WTF::StringImpl::deprecatedCharacters):
(WTF::StringImpl::getCharacters<UChar>):
(WTF::equalIgnoringNullity):

  • wtf/text/WTFString.cpp:

(WTF::String::append):
(WTF::String::appendInternal):
(WTF::String::insert):
(WTF::String::truncate):
(WTF::String::percentage):

  • wtf/text/WTFString.h:

(WTF::String::characters):
(WTF::String::deprecatedCharacters):
(WTF::String::getCharactersWithUpconvert<UChar>):
(WTF::append):
Use deprecatedCharacters instead of characters.

Location:
trunk/Source/JavaScriptCore
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/API/JSStringRef.cpp

    r152807 r161851  
    8484const JSChar* JSStringGetCharactersPtr(JSStringRef string)
    8585{
    86     return string->characters();
     86    return string->deprecatedCharacters();
    8787}
    8888
     
    9999
    100100    char* p = buffer;
    101     const UChar* d = string->characters();
     101    const UChar* d = string->deprecatedCharacters();
    102102    ConversionResult result = convertUTF16ToUTF8(&d, d + string->length(), &p, p + bufferSize - 1, true);
    103103    *p++ = '\0';
     
    111111{
    112112    unsigned len = a->length();
    113     return len == b->length() && 0 == memcmp(a->characters(), b->characters(), len * sizeof(UChar));
     113    return len == b->length() && 0 == memcmp(a->deprecatedCharacters(), b->deprecatedCharacters(), len * sizeof(UChar));
    114114}
    115115
  • trunk/Source/JavaScriptCore/API/JSStringRefCF.cpp

    r157688 r161851  
    6262        return CFSTR("");
    6363
    64     return CFStringCreateWithCharacters(alloc, reinterpret_cast<const UniChar*>(string->characters()), string->length());
     64    return CFStringCreateWithCharacters(alloc, reinterpret_cast<const UniChar*>(string->deprecatedCharacters()), string->length());
    6565}
  • trunk/Source/JavaScriptCore/API/OpaqueJSString.h

    r156780 r161851  
    5454    JS_EXPORT_PRIVATE static PassRefPtr<OpaqueJSString> create(const String&);
    5555
    56     const UChar* characters() { return !!this ? m_string.characters() : 0; }
    57     unsigned length() { return !!this ? m_string.length() : 0; }
     56    const UChar* characters() { return deprecatedCharacters(); } // FIXME: Delete this.
     57    const UChar* deprecatedCharacters() { return this ? m_string.deprecatedCharacters() : nullptr; }
     58    unsigned length() { return this ? m_string.length() : 0; }
    5859
    5960    JS_EXPORT_PRIVATE String string() const;
     
    7374
    7475    OpaqueJSString(const LChar* characters, unsigned length)
     76        : m_string(characters, length)
    7577    {
    76         m_string = String(characters, length);
    7778    }
    7879
    7980    OpaqueJSString(const UChar* characters, unsigned length)
     81        : m_string(characters, length)
    8082    {
    81         m_string = String(characters, length);
    8283    }
    8384
  • trunk/Source/JavaScriptCore/ChangeLog

    r161840 r161851  
     12014-01-12  Darin Adler  <[email protected]>
     2
     3        Add deprecatedCharacters as a synonym for characters and convert most call sites
     4        https://bugs.webkit.org/show_bug.cgi?id=126858
     5
     6        Reviewed by Anders Carlsson.
     7
     8        * API/JSStringRef.cpp:
     9        (JSStringGetCharactersPtr):
     10        (JSStringGetUTF8CString):
     11        (JSStringIsEqual):
     12        * API/JSStringRefCF.cpp:
     13        (JSStringCopyCFString):
     14        * API/OpaqueJSString.h:
     15        (OpaqueJSString::characters):
     16        (OpaqueJSString::deprecatedCharacters):
     17        (OpaqueJSString::length):
     18        (OpaqueJSString::OpaqueJSString):
     19        * inspector/InspectorValues.cpp:
     20        (Inspector::InspectorValue::parseJSON):
     21        * runtime/JSGlobalObjectFunctions.cpp:
     22        (JSC::parseInt):
     23        * runtime/StringPrototype.cpp:
     24        (JSC::localeCompare):
     25        (JSC::stringProtoFuncFontsize):
     26        (JSC::stringProtoFuncLink):
     27        Use deprecatedCharacters instead of characters.
     28
    1292014-01-12  Darin Adler  <[email protected]>
    230
  • trunk/Source/JavaScriptCore/inspector/InspectorValues.cpp

    r161840 r161851  
    547547PassRefPtr<InspectorValue> InspectorValue::parseJSON(const String& json)
    548548{
    549     const UChar* start = json.characters();
    550     const UChar* end = json.characters() + json.length();
     549    const UChar* start = json.deprecatedCharacters();
     550    const UChar* end = json.deprecatedCharacters() + json.length();
    551551    const UChar *tokenEnd;
    552552    RefPtr<InspectorValue> value = buildValue(start, end, &tokenEnd, 0);
  • trunk/Source/JavaScriptCore/runtime/JSGlobalObjectFunctions.cpp

    r157330 r161851  
    309309        if (radix == 10) {
    310310            size_t parsedLength;
    311             number = parseDouble(s.characters() + firstDigitPosition, p - firstDigitPosition, parsedLength);
     311            number = parseDouble(s.deprecatedCharacters() + firstDigitPosition, p - firstDigitPosition, parsedLength);
    312312        } else if (radix == 2 || radix == 4 || radix == 8 || radix == 16 || radix == 32)
    313313            number = parseIntOverflow(s.substringSharingImpl(firstDigitPosition, p - firstDigitPosition).utf8().data(), p - firstDigitPosition, radix);
  • trunk/Source/JavaScriptCore/runtime/StringPrototype.cpp

    r160186 r161851  
    238238static inline int localeCompare(const String& a, const String& b)
    239239{
    240     return Collator::userDefault()->collate(reinterpret_cast<const ::UChar*>(a.characters()), a.length(), reinterpret_cast<const ::UChar*>(b.characters()), b.length());
     240    return Collator::userDefault()->collate(reinterpret_cast<const ::UChar*>(a.deprecatedCharacters()), a.length(), reinterpret_cast<const ::UChar*>(b.deprecatedCharacters()), b.length());
    241241}
    242242
     
    14281428        buffer[13] = '"';
    14291429        buffer[14] = '>';
    1430         memcpy(&buffer[15], s.characters(), stringSize * sizeof(UChar));
     1430        memcpy(&buffer[15], s.deprecatedCharacters(), stringSize * sizeof(UChar));
    14311431        buffer[15 + stringSize] = '<';
    14321432        buffer[16 + stringSize] = '/';
     
    14841484    buffer[7] = '=';
    14851485    buffer[8] = '"';
    1486     memcpy(&buffer[9], linkText.characters(), linkTextSize * sizeof(UChar));
     1486    memcpy(&buffer[9], linkText.deprecatedCharacters(), linkTextSize * sizeof(UChar));
    14871487    buffer[9 + linkTextSize] = '"';
    14881488    buffer[10 + linkTextSize] = '>';
    1489     memcpy(&buffer[11 + linkTextSize], s.characters(), stringSize * sizeof(UChar));
     1489    memcpy(&buffer[11 + linkTextSize], s.deprecatedCharacters(), stringSize * sizeof(UChar));
    14901490    buffer[11 + linkTextSize + stringSize] = '<';
    14911491    buffer[12 + linkTextSize + stringSize] = '/';
Note: See TracChangeset for help on using the changeset viewer.