WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
Patch
bug-130318-20140317093015.patch (text/plain), 108.67 KB, created by
Darin Adler
on 2014-03-17 09:30:37 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Darin Adler
Created:
2014-03-17 09:30:37 PDT
Size:
108.67 KB
patch
obsolete
>Subversion Revision: 165724 >diff --git a/Source/WTF/ChangeLog b/Source/WTF/ChangeLog >index df6fa7328024f6b93aab86dcdad452dd2ba164bc..d63f18352eefe1f8674ecb5a8507b7ed14283a65 100644 >--- a/Source/WTF/ChangeLog >+++ b/Source/WTF/ChangeLog >@@ -1,3 +1,13 @@ >+2014-03-17 Darin Adler <darin@apple.com> >+ >+ Reduce use of deprecatedCharacters in WebCore >+ https://bugs.webkit.org/show_bug.cgi?id=130318 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * wtf/text/WTFString.h: Export another overload of charactersToFloat since it's used >+ in WebCore now. >+ > 2014-03-16 Darin Adler <darin@apple.com> > > Remove most uses of deprecatedCharacter in WTF >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 862685057b17fc06f533c56608e37aa0538ad135..6e0c5f58ba3c51bb916d74c140e062dbc28d6b46 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,5 +1,254 @@ > 2014-03-17 Darin Adler <darin@apple.com> > >+ Reduce use of deprecatedCharacters in WebCore >+ https://bugs.webkit.org/show_bug.cgi?id=130318 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * Modules/indexeddb/IDBKeyPath.cpp: >+ (WebCore::IDBKeyPathLexer::IDBKeyPathLexer): Use StringView for parsing. >+ (WebCore::IDBKeyPathLexer::lex): Ditto. >+ (WebCore::IDBKeyPathLexer::lexIdentifier): Ditto. >+ >+ * Modules/indexeddb/leveldb/IDBLevelDBCoding.cpp: >+ (WebCore::IDBLevelDBCoding::encodeString): Index directly into string instead of >+ using deprecatedCharacters. >+ >+ * Modules/websockets/ThreadableWebSocketChannelClientWrapper.cpp: >+ (WebCore::ThreadableWebSocketChannelClientWrapper::setSubprotocol): Use >+ StringView::getCharactersWithUpconvert. >+ (WebCore::ThreadableWebSocketChannelClientWrapper::setExtensions): Ditto. >+ >+ * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm: >+ (-[WebAccessibilityObjectWrapper arrayOfTextForTextMarkers:attributed:]): >+ Use operator NSString * instead of explicitly creating an NSString. >+ >+ * bindings/js/SerializedScriptValue.cpp: >+ (WebCore::writeLittleEndianUInt16): Added. >+ (WebCore::CloneSerializer::serialize): Added a separate code path for 8-bit strings. >+ (WebCore::CloneSerializer::write): Ditto. >+ >+ * bindings/objc/WebScriptObject.mm: >+ (+[WebScriptObject _convertValueToObjcValue:JSC::originRootObject:rootObject:]): >+ Use operator NSString * instead of explicitly creating an NSString. >+ >+ * dom/Document.cpp: >+ (WebCore::Document::parseQualifiedName): Index directly into string instead of >+ using deprecatedCharacters. >+ * editing/CompositeEditCommand.cpp: >+ (WebCore::containsOnlyWhitespace): Ditto. >+ * editing/SmartReplace.cpp: >+ (WebCore::addAllCodePoints): Ditto. >+ (WebCore::getSmartSet): Use StringView::upconvertedCharacters. >+ >+ * editing/TextIterator.cpp: >+ (WebCore::foldQuoteMarksAndSoftHyphens): Changed to return a value so it can be >+ used in initialization rather than assignment. >+ (WebCore::SearchBuffer::SearchBuffer): Use StringView::upconvertedCharacters. >+ >+ * editing/TypingCommand.cpp: >+ (WebCore::TypingCommand::insertText): Index directly into string instead of using >+ deprecatedCharacters. >+ * editing/VisiblePosition.cpp: >+ (WebCore::VisiblePosition::characterAfter): Ditto. >+ * editing/VisibleUnits.cpp: >+ (WebCore::startOfParagraph): Ditto. >+ (WebCore::endOfParagraph): Ditto. >+ >+ * fileapi/WebKitBlobBuilder.cpp: >+ (WebCore::BlobBuilder::append): Pass a StringView to TextEncoding::encode. >+ >+ * html/BaseDateAndTimeInputType.cpp: >+ (WebCore::BaseDateAndTimeInputType::parseToDateComponents): Use >+ StringView::upconvertedCharacters. >+ >+ * html/FormDataList.cpp: >+ (WebCore::FormDataList::appendString): Pass a StringView to TextEncoding::encode. >+ >+ * html/canvas/CanvasRenderingContext2D.cpp: >+ (WebCore::normalizeSpaces): Use StringView::getCharactersWithUpconvert. >+ >+ * html/parser/HTMLParserIdioms.cpp: >+ (WebCore::stripLeadingAndTrailingHTMLSpaces): Use characters16 for a code path >+ that already handled 8-bit characters separately. >+ (WebCore::parseHTMLNonNegativeInteger): Ditto. >+ (WebCore::parseDescriptors): Added an 8-bit code path. >+ >+ * inspector/InspectorStyleSheet.cpp: >+ (WebCore::InspectorStyle::newLineAndWhitespaceDelimiters): Index directly into >+ string instead of using deprecatedCharacters. >+ * inspector/InspectorStyleTextEditor.cpp: >+ (WebCore::InspectorStyleTextEditor::insertProperty): Ditto. >+ (WebCore::InspectorStyleTextEditor::internalReplaceProperty): Ditto. >+ >+ * page/ContentSecurityPolicy.cpp: >+ (WebCore::isSourceListNone): Use StringView::upconvertedCharacters. >+ (WebCore::CSPSourceList::parse): Ditto. >+ (WebCore::NonceDirective::parse): Ditto. >+ (WebCore::MediaListDirective::parse): Ditto. >+ (WebCore::CSPDirectiveList::parse): Ditto. >+ (WebCore::CSPDirectiveList::parseReportURI): Ditto. >+ (WebCore::CSPDirectiveList::parseReflectedXSS): Ditto. >+ (WebCore::ContentSecurityPolicy::didReceiveHeader): Ditto. >+ >+ * page/PageSerializer.cpp: >+ (WebCore::PageSerializer::serializeFrame): Pass a StringView into >+ TextEncoding::encode. >+ (WebCore::PageSerializer::serializeCSSStyleSheet): Ditto. >+ >+ * platform/Length.cpp: >+ (WebCore::countCharacter): Index directly into string instead of using >+ deprecatedCharacters. Also changed to take a StringImpl&. >+ (WebCore::newCoordsArray): Ditto. Call countCharacter the new way, and >+ use StringView::upconvertedCharacters. >+ (WebCore::newLengthArray): Ditto. >+ >+ * platform/LinkHash.cpp: >+ (WebCore::visitedLinkHash): Use characters16 for the 16-bit path. >+ Also removed unused visitedURL function. >+ * platform/LinkHash.h: Removed unused visitedURL function. >+ >+ * platform/SharedBuffer.cpp: >+ (WebCore::utf8Buffer): Added an 8-bit code path. >+ * platform/URL.cpp: >+ (WebCore::URL::port): Ditto. >+ (WebCore::encodeRelativeString): Use StringView to call TextEncoding::encode. >+ >+ * platform/graphics/Color.cpp: >+ (WebCore::Color::parseHexColor): Use characteres16 in the 16-bit path. >+ (WebCore::Color::Color): Ditto. >+ >+ * platform/graphics/StringTruncator.cpp: >+ (WebCore::centerTruncateToBuffer): Use StringView::getCharactersWithUpconvert. >+ (WebCore::rightTruncateToBuffer): Ditto. >+ (WebCore::rightClipToCharacterBuffer): Ditto. >+ (WebCore::rightClipToWordBuffer): Ditto. >+ (WebCore::leftTruncateToBuffer): Ditto. >+ (WebCore::truncateString): Ditto. >+ >+ * platform/graphics/TextRun.h: >+ (WebCore::TextRun::TextRun): Use characters16 in the 16-bit code path. >+ >+ * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm: >+ (WebCore::MediaPlayerPrivateAVFoundationObjC::shouldWaitForLoadingOfResource): >+ Use StringView::upconvertedCharacters. >+ >+ * platform/network/FormDataBuilder.cpp: >+ (WebCore::FormDataBuilder::addFilenameToMultiPartHeader): Use StrinView to call >+ TextEncoding::encode. >+ >+ * platform/sql/SQLiteStatement.cpp: >+ (WebCore::SQLiteStatement::bindBlob): Use StringView::upconvertedCharacters. >+ (WebCore::SQLiteStatement::bindText): Ditto. >+ >+ * platform/text/DecodeEscapeSequences.h: >+ (WebCore::Unicode16BitEscapeSequence::decodeRun): Changed to take a StringView. >+ (WebCore::URLEscapeSequence::decodeRun): Ditto. >+ (WebCore::decodeEscapeSequences): Pass StringView to decodeRun. >+ >+ * platform/text/Hyphenation.cpp: >+ (WebCore::lastHyphenLocation): Take a StringView. >+ * platform/text/Hyphenation.h: Make lastHyphenLocation take a StringView. >+ >+ * platform/text/TextBreakIterator.cpp: >+ (WebCore::initializeIteratorWithRules): Use StringView::upconvertedCharacters. >+ >+ * platform/text/TextEncoding.cpp: >+ (WebCore::TextEncoding::encode): Use StringView::upconvertedCharacters. >+ Change argument type to StringView. >+ * platform/text/TextEncoding.h: Ditto. >+ >+ * platform/text/TextEncodingRegistry.cpp: >+ (WebCore::atomicCanonicalTextEncodingName): Use characters16 for the 16-bit path. >+ >+ * platform/text/cf/HyphenationCF.cpp: >+ (WebCore::lastHyphenLocation): Use StringView::text.createCFStringWithoutCopying. >+ Change argument type to StringView. >+ >+ * rendering/RenderBlock.cpp: >+ (WebCore::RenderBlock::constructTextRun): Use characters16 for the 16-bit path. >+ >+ * rendering/RenderCombineText.cpp: >+ (WebCore::RenderCombineText::width): Removed check for null characters pointer, >+ since the pointer will never be null, and even if it was there would be no need >+ for an early exit. >+ >+ * rendering/RenderText.cpp: >+ (WebCore::maxWordFragmentWidth): Take a StringView. >+ (WebCore::RenderText::computePreferredLogicalWidths): Pass in a StringView. >+ * rendering/line/BreakingContextInlineHeaders.h: >+ (WebCore::tryHyphenating): Ditto. >+ >+ * rendering/svg/SVGTextLayoutEngine.cpp: >+ (WebCore::SVGTextLayoutEngine::layoutTextOnLineOrPath): Use >+ StringView::upconvertedCharacters. >+ >+ * rendering/svg/SVGTextMetrics.cpp: >+ (WebCore::SVGTextMetrics::SVGTextMetrics): Use String::substring. >+ >+ * svg/SVGAngle.cpp: >+ (WebCore::SVGAngle::setValueAsString): Use StringView::upconvertedCharacters. >+ * svg/SVGAnimateMotionElement.cpp: >+ (WebCore::parsePoint): Ditto. >+ * svg/SVGAnimationElement.cpp: >+ (WebCore::parseKeySplines): Ditto. >+ * svg/SVGFitToViewBox.cpp: >+ (WebCore::SVGFitToViewBox::parseViewBox): Ditto. >+ >+ * svg/SVGFontData.cpp: >+ (WebCore::SVGFontData::applySVGGlyphSelection): Pass StringView to >+ createStringWIthMirroredCharacters. >+ (WebCore::createStringWithMirroredCharacters): Changed to use StringView and >+ use indexing into that instead of a characters pointer. >+ >+ * svg/SVGFontData.h: Removed createStringWithMirroredCharacters member function, >+ since it has nothing to do with the SVGFontData object. Now it's just a private >+ helper function in the SVGFontData.cpp source file. >+ >+ * svg/SVGFontElement.cpp: >+ (WebCore::SVGFontElement::registerLigaturesInGlyphCache): Index into the string >+ instead of using deprecatedCharacters. >+ >+ * svg/SVGGlyphMap.h: >+ (WebCore::SVGGlyphMap::addGlyph): Use StringView::upconvertedCharacters. >+ (WebCore::SVGGlyphMap::collectGlyphsForString): Ditto. >+ * svg/SVGGlyphRefElement.cpp: >+ (WebCore::SVGGlyphRefElement::parseAttribute): Ditto. >+ * svg/SVGLength.cpp: >+ (WebCore::SVGLength::setValueAsString): Ditto. >+ * svg/SVGLengthList.cpp: >+ (WebCore::SVGLengthList::parse): Ditto. >+ * svg/SVGNumberList.cpp: >+ (WebCore::SVGNumberList::parse): Ditto. >+ * svg/SVGParserUtilities.cpp: >+ (WebCore::parseNumberFromString): Ditto. >+ (WebCore::parseNumberOptionalNumber): Ditto. >+ (WebCore::parseRect): Ditto. >+ (WebCore::pointsListFromSVGData): Ditto. >+ (WebCore::parseGlyphName): Ditto. >+ (WebCore::parseKerningUnicodeString): Ditto. >+ (WebCore::parseDelimitedString): Ditto. >+ * svg/SVGPreserveAspectRatio.cpp: >+ (WebCore::SVGPreserveAspectRatio::parse): Ditto. >+ * svg/SVGStringList.cpp: >+ (WebCore::SVGStringList::parse): Ditto. >+ * svg/SVGTransformList.cpp: >+ (WebCore::SVGTransformList::parse): Ditto. >+ * svg/SVGTransformable.cpp: >+ (WebCore::SVGTransformable::parseTransformType): Ditto. >+ * svg/SVGViewSpec.cpp: >+ (WebCore::SVGViewSpec::parseViewSpec): Ditto. >+ * svg/SVGZoomAndPan.h: >+ (WebCore::SVGZoomAndPan::parseAttribute): Ditto. >+ >+ * xml/XMLHttpRequest.cpp: >+ (WebCore::XMLHttpRequest::send): Pass a StringView to TextEncoding::encode. >+ >+ * xml/XSLStyleSheetLibxslt.cpp: >+ (WebCore::XSLStyleSheet::parseString): Use StringView::upconvertedCharacters. >+ >+2014-03-17 Darin Adler <darin@apple.com> >+ > Stop using deprecatedCharacters in HTMLTreeBuilder > https://bugs.webkit.org/show_bug.cgi?id=130323 > >diff --git a/Source/WTF/wtf/text/WTFString.h b/Source/WTF/wtf/text/WTFString.h >index f329fe5c09f955d509d5ef0d921e01df7eb20a17..4441573ce1bef1653304878015d8ef0f76ee2e04 100644 >--- a/Source/WTF/wtf/text/WTFString.h >+++ b/Source/WTF/wtf/text/WTFString.h >@@ -66,7 +66,7 @@ intptr_t charactersToIntPtr(const UChar*, size_t, bool* ok = 0); // ignores trai > // It would be better if these were more consistent with the above functions instead. > WTF_EXPORT_STRING_API double charactersToDouble(const LChar*, size_t, bool* ok = 0); > WTF_EXPORT_STRING_API double charactersToDouble(const UChar*, size_t, bool* ok = 0); >-float charactersToFloat(const LChar*, size_t, bool* ok = 0); >+WTF_EXPORT_STRING_API float charactersToFloat(const LChar*, size_t, bool* ok = 0); > WTF_EXPORT_STRING_API float charactersToFloat(const UChar*, size_t, bool* ok = 0); > WTF_EXPORT_STRING_API float charactersToFloat(const LChar*, size_t, size_t& parsedLength); > WTF_EXPORT_STRING_API float charactersToFloat(const UChar*, size_t, size_t& parsedLength); >diff --git a/Source/WebCore/Modules/indexeddb/IDBKeyPath.cpp b/Source/WebCore/Modules/indexeddb/IDBKeyPath.cpp >index d93c0af10f108d3e5e61325f6c828c003180f1cc..85ea97606c1faca7f73d4d0880b938afe6a366d5 100644 >--- a/Source/WebCore/Modules/indexeddb/IDBKeyPath.cpp >+++ b/Source/WebCore/Modules/indexeddb/IDBKeyPath.cpp >@@ -45,8 +45,7 @@ public: > > explicit IDBKeyPathLexer(const String& s) > : m_string(s) >- , m_ptr(s.deprecatedCharacters()) >- , m_end(s.deprecatedCharacters() + s.length()) >+ , m_remainingText(s) > , m_currentTokenType(TokenError) > { > } >@@ -64,23 +63,23 @@ public: > private: > TokenType lex(String&); > TokenType lexIdentifier(String&); >+ > String m_currentElement; >- String m_string; >- const UChar* m_ptr; >- const UChar* m_end; >+ const String m_string; >+ StringView m_remainingText; > TokenType m_currentTokenType; > }; > > IDBKeyPathLexer::TokenType IDBKeyPathLexer::lex(String& element) > { >- if (m_ptr >= m_end) >+ if (m_remainingText.isEmpty()) > return TokenEnd; >- ASSERT_WITH_SECURITY_IMPLICATION(m_ptr < m_end); > >- if (*m_ptr == '.') { >- ++m_ptr; >+ if (m_remainingText[0] == '.') { >+ m_remainingText = m_remainingText.substring(1); > return TokenDot; > } >+ > return lexIdentifier(element); > } > >@@ -108,16 +107,16 @@ static inline bool isIdentifierCharacter(UChar c) > > IDBKeyPathLexer::TokenType IDBKeyPathLexer::lexIdentifier(String& element) > { >- const UChar* start = m_ptr; >- if (m_ptr < m_end && isIdentifierStartCharacter(*m_ptr)) >- ++m_ptr; >+ StringView start = m_remainingText; >+ if (!m_remainingText.isEmpty() && isIdentifierStartCharacter(m_remainingText[0])) >+ m_remainingText = m_remainingText.substring(1); > else > return TokenError; > >- while (m_ptr < m_end && isIdentifierCharacter(*m_ptr)) >- ++m_ptr; >+ while (!m_remainingText.isEmpty() && isIdentifierCharacter(m_remainingText[0])) >+ m_remainingText = m_remainingText.substring(1); > >- element = String(start, m_ptr - start); >+ element = start.substring(0, start.length() - m_remainingText.length()).toString(); > return TokenIdentifier; > } > >diff --git a/Source/WebCore/Modules/indexeddb/leveldb/IDBLevelDBCoding.cpp b/Source/WebCore/Modules/indexeddb/leveldb/IDBLevelDBCoding.cpp >index 86e9fae6d47c2936e7cf1967839585f91ce85147..33606d05be3569ef50aeb3e00a6cf2c92befce37 100644 >--- a/Source/WebCore/Modules/indexeddb/leveldb/IDBLevelDBCoding.cpp >+++ b/Source/WebCore/Modules/indexeddb/leveldb/IDBLevelDBCoding.cpp >@@ -297,10 +297,9 @@ Vector<char> encodeString(const String& s) > size_t length = s.length(); > Vector<char> ret(length * sizeof(UChar)); > >- const UChar* src = s.deprecatedCharacters(); > UChar* dst = reinterpret_cast<UChar*>(ret.data()); > for (unsigned i = 0; i < length; ++i) >- *dst++ = htons(*src++); >+ *dst++ = htons(s[i]); > > return ret; > } >diff --git a/Source/WebCore/Modules/websockets/ThreadableWebSocketChannelClientWrapper.cpp b/Source/WebCore/Modules/websockets/ThreadableWebSocketChannelClientWrapper.cpp >index 0ab3c5eb1e40202b4d5a9543939cac4273c2e6b3..52e1d6f5d292039a8b23110052e9672d59ce0717 100644 >--- a/Source/WebCore/Modules/websockets/ThreadableWebSocketChannelClientWrapper.cpp >+++ b/Source/WebCore/Modules/websockets/ThreadableWebSocketChannelClientWrapper.cpp >@@ -38,6 +38,7 @@ > #include "WebSocketChannelClient.h" > #include <wtf/PassRefPtr.h> > #include <wtf/RefPtr.h> >+#include <wtf/text/StringView.h> > > namespace WebCore { > >@@ -110,8 +111,7 @@ void ThreadableWebSocketChannelClientWrapper::setSubprotocol(const String& subpr > { > unsigned length = subprotocol.length(); > m_subprotocol.resize(length); >- if (length) >- memcpy(m_subprotocol.data(), subprotocol.deprecatedCharacters(), sizeof(UChar) * length); >+ StringView(subprotocol).getCharactersWithUpconvert(m_subprotocol.data()); > } > > String ThreadableWebSocketChannelClientWrapper::extensions() const >@@ -125,8 +125,7 @@ void ThreadableWebSocketChannelClientWrapper::setExtensions(const String& extens > { > unsigned length = extensions.length(); > m_extensions.resize(length); >- if (length) >- memcpy(m_extensions.data(), extensions.deprecatedCharacters(), sizeof(UChar) * length); >+ StringView(extensions).getCharactersWithUpconvert(m_extensions.data()); > } > > ThreadableWebSocketChannel::SendResult ThreadableWebSocketChannelClientWrapper::sendRequestResult() const >diff --git a/Source/WebCore/accessibility/ios/WebAccessibilityObjectWrapperIOS.mm b/Source/WebCore/accessibility/ios/WebAccessibilityObjectWrapperIOS.mm >index 8bfd197d81f5c6c6208fd6a00bd9771230c291b0..7ffbb443fd1aa2c3e1453faaed09c7cc7b30b8c4 100644 >--- a/Source/WebCore/accessibility/ios/WebAccessibilityObjectWrapperIOS.mm >+++ b/Source/WebCore/accessibility/ios/WebAccessibilityObjectWrapperIOS.mm >@@ -1660,7 +1660,7 @@ - (NSArray *)arrayOfTextForTextMarkers:(NSArray *)markers attributed:(BOOL)attri > String listMarkerText = m_object->listMarkerTextForNodeAndPosition(node, VisiblePosition(it.range()->startPosition())); > > if (!listMarkerText.isEmpty()) >- [array addObject:[NSString stringWithCharacters:listMarkerText.deprecatedCharacters() length:listMarkerText.length()]]; >+ [array addObject:listMarkerText]; > // There was not an element representation, so just return the text. > [array addObject:it.text().createNSString().get()]; > } >diff --git a/Source/WebCore/bindings/js/SerializedScriptValue.cpp b/Source/WebCore/bindings/js/SerializedScriptValue.cpp >index 7de2c5271fbd8a383cc78d52d26cfcdbe8105675..2d18b80106abee29adf61696e651d31d92f25dcd 100644 >--- a/Source/WebCore/bindings/js/SerializedScriptValue.cpp >+++ b/Source/WebCore/bindings/js/SerializedScriptValue.cpp >@@ -447,6 +447,19 @@ template <typename T> static bool writeLittleEndian(Vector<uint8_t>& buffer, con > return true; > } > >+static bool writeLittleEndianUInt16(Vector<uint8_t>& buffer, const LChar* values, uint32_t length) >+{ >+ if (length > std::numeric_limits<uint32_t>::max() / 2) >+ return false; >+ >+ for (unsigned i = 0; i < length; ++i) { >+ buffer.append(values[i]); >+ buffer.append(0); >+ } >+ >+ return true; >+} >+ > template <> bool writeLittleEndian<uint8_t>(Vector<uint8_t>& buffer, const uint8_t* values, uint32_t length) > { > buffer.append(values, length); >@@ -472,7 +485,9 @@ public: > } > writeLittleEndian<uint8_t>(out, StringTag); > writeLittleEndian(out, s.length()); >- return writeLittleEndian(out, s.impl()->deprecatedCharacters(), s.length()); >+ if (s.is8Bit()) >+ return writeLittleEndianUInt16(out, s.characters8(), s.length()); >+ return writeLittleEndian(out, s.characters16(), s.length()); > } > > static void serializeUndefined(Vector<uint8_t>& out) >@@ -969,21 +984,28 @@ private: > return; > } > >+ unsigned length = str.length(); >+ > // This condition is unlikely to happen as they would imply an ~8gb > // string but we should guard against it anyway >- if (str.length() >= StringPoolTag) { >+ if (length >= StringPoolTag) { > fail(); > return; > } > > // Guard against overflow >- if (str.length() > (std::numeric_limits<uint32_t>::max() - sizeof(uint32_t)) / sizeof(UChar)) { >+ if (length > (std::numeric_limits<uint32_t>::max() - sizeof(uint32_t)) / sizeof(UChar)) { > fail(); > return; > } > >- writeLittleEndian<uint32_t>(m_buffer, str.length()); >- if (!writeLittleEndian<uint16_t>(m_buffer, reinterpret_cast<const uint16_t*>(str.deprecatedCharacters()), str.length())) >+ writeLittleEndian<uint32_t>(m_buffer, length); >+ if (!length || str.is8Bit()) { >+ if (!writeLittleEndianUInt16(m_buffer, str.characters8(), length)) >+ fail(); >+ return; >+ } >+ if (!writeLittleEndian(m_buffer, str.characters16(), length)) > fail(); > } > >diff --git a/Source/WebCore/bindings/objc/WebScriptObject.mm b/Source/WebCore/bindings/objc/WebScriptObject.mm >index 58c7adea7c263c149703a6b5eb749a5fafcd0020..0427cb6a92fc768d14613814fa45efd37ed79e38 100644 >--- a/Source/WebCore/bindings/objc/WebScriptObject.mm >+++ b/Source/WebCore/bindings/objc/WebScriptObject.mm >@@ -546,11 +546,8 @@ + (id)_convertValueToObjcValue:(JSC::JSValue)value originRootObject:(RootObject* > return [WebScriptObject scriptObjectForJSObject:toRef(object) originRootObject:originRootObject rootObject:rootObject]; > } > >- if (value.isString()) { >- ExecState* exec = rootObject->globalObject()->globalExec(); >- const String& u = asString(value)->value(exec); >- return [NSString stringWithCharacters:u.deprecatedCharacters() length:u.length()]; >- } >+ if (value.isString()) >+ return asString(value)->value(rootObject->globalObject()->globalExec()); > > if (value.isNumber()) > return [NSNumber numberWithDouble:value.asNumber()]; >diff --git a/Source/WebCore/dom/Document.cpp b/Source/WebCore/dom/Document.cpp >index dde6c3b6279519a5a01f00737283a52c13420661..9ecc32c39c043971495de58ad59f492a30cce244 100644 >--- a/Source/WebCore/dom/Document.cpp >+++ b/Source/WebCore/dom/Document.cpp >@@ -3972,10 +3972,9 @@ bool Document::parseQualifiedName(const String& qualifiedName, String& prefix, S > bool sawColon = false; > int colonPos = 0; > >- const UChar* s = qualifiedName.deprecatedCharacters(); > for (unsigned i = 0; i < length;) { > UChar32 c; >- U16_NEXT(s, i, length, c) >+ U16_NEXT(qualifiedName, i, length, c) > if (c == ':') { > if (sawColon) { > ec = NAMESPACE_ERR; >diff --git a/Source/WebCore/editing/CompositeEditCommand.cpp b/Source/WebCore/editing/CompositeEditCommand.cpp >index 5ce2fc0719ff9eae31118a0ee3d542c52a8999a5..304c22d768987e781050472cd66707518278e9b4 100644 >--- a/Source/WebCore/editing/CompositeEditCommand.cpp >+++ b/Source/WebCore/editing/CompositeEditCommand.cpp >@@ -667,7 +667,7 @@ void CompositeEditCommand::setNodeAttribute(PassRefPtr<Element> element, const Q > static inline bool containsOnlyWhitespace(const String& text) > { > for (unsigned i = 0; i < text.length(); ++i) { >- if (!isWhitespace(text.deprecatedCharacters()[i])) >+ if (!isWhitespace(text[i])) > return false; > } > >diff --git a/Source/WebCore/editing/SmartReplace.cpp b/Source/WebCore/editing/SmartReplace.cpp >index 2b044e3ee3c623e7e85a0b9e592f0f38d6859200..0b4764cc0d10b53cb6ff08a8717fa2a6c9bcf944 100644 >--- a/Source/WebCore/editing/SmartReplace.cpp >+++ b/Source/WebCore/editing/SmartReplace.cpp >@@ -34,15 +34,14 @@ > > #include <unicode/uset.h> > #include <wtf/Assertions.h> >-#include <wtf/text/WTFString.h> >+#include <wtf/text/StringView.h> > > namespace WebCore { > > static void addAllCodePoints(USet* smartSet, const String& string) > { >- const UChar* characters = string.deprecatedCharacters(); > for (size_t i = 0; i < string.length(); i++) >- uset_add(smartSet, characters[i]); >+ uset_add(smartSet, string[i]); > } > > // This is mostly a port of the code in WebCore/editing/SmartReplaceCF.cpp >@@ -56,7 +55,7 @@ static USet* getSmartSet(bool isPreviousCharacter) > // Whitespace and newline (kCFCharacterSetWhitespaceAndNewline) > UErrorCode ec = U_ZERO_ERROR; > String whitespaceAndNewline = ASCIILiteral("[[:WSpace:] [\\u000A\\u000B\\u000C\\u000D\\u0085]]"); >- smartSet = uset_openPattern(whitespaceAndNewline.deprecatedCharacters(), whitespaceAndNewline.length(), &ec); >+ smartSet = uset_openPattern(StringView(whitespaceAndNewline).upconvertedCharacters(), whitespaceAndNewline.length(), &ec); > ASSERT(U_SUCCESS(ec)); > > // CJK ranges >@@ -83,7 +82,7 @@ static USet* getSmartSet(bool isPreviousCharacter) > // Punctuation (kCFCharacterSetPunctuation) > UErrorCode ec = U_ZERO_ERROR; > String punctuationClass = ASCIILiteral("[:P:]"); >- USet* icuPunct = uset_openPattern(punctuationClass.deprecatedCharacters(), punctuationClass.length(), &ec); >+ USet* icuPunct = uset_openPattern(StringView(punctuationClass).upconvertedCharacters(), punctuationClass.length(), &ec); > ASSERT(U_SUCCESS(ec)); > uset_addAll(smartSet, icuPunct); > uset_close(icuPunct); >diff --git a/Source/WebCore/editing/TextIterator.cpp b/Source/WebCore/editing/TextIterator.cpp >index 4dd2e93ac66c9e701cac65f7a88bf0386a574824..77ff794bdfde40fb12f9d1bdee57578387e3141b 100644 >--- a/Source/WebCore/editing/TextIterator.cpp >+++ b/Source/WebCore/editing/TextIterator.cpp >@@ -92,7 +92,8 @@ private: > bool isBadMatch(const UChar*, size_t length) const; > bool isWordStartMatch(size_t start, size_t length) const; > >- String m_target; >+ const String m_target; >+ const StringView::UpconvertedCharacters m_targetCharacters; > FindOptions m_options; > > Vector<UChar> m_buffer; >@@ -101,7 +102,7 @@ private: > bool m_atBreak; > bool m_needsMoreContext; > >- bool m_targetRequiresKanaWorkaround; >+ const bool m_targetRequiresKanaWorkaround; > Vector<UChar> m_normalizedTarget; > mutable Vector<UChar> m_normalizedMatch; > >@@ -1649,17 +1650,22 @@ static inline UChar foldQuoteMarkOrSoftHyphen(UChar c) > } > } > >-static inline void foldQuoteMarksAndSoftHyphens(String& s) >+// FIXME: We'd like to tailor the searcher to fold quote marks for us instead >+// of doing it in a separate replacement pass here, but ICU doesn't offer a way >+// to add tailoring on top of the locale-specific tailoring as of this writing. >+static inline String foldQuoteMarksAndSoftHyphens(String string) > { >- s.replace(hebrewPunctuationGeresh, '\''); >- s.replace(hebrewPunctuationGershayim, '"'); >- s.replace(leftDoubleQuotationMark, '"'); >- s.replace(leftSingleQuotationMark, '\''); >- s.replace(rightDoubleQuotationMark, '"'); >- s.replace(rightSingleQuotationMark, '\''); >- // Replace soft hyphen with an ignorable character so that their presence or absence will >- // not affect string comparison. >- s.replace(softHyphen, 0); >+ string.replace(hebrewPunctuationGeresh, '\''); >+ string.replace(hebrewPunctuationGershayim, '"'); >+ string.replace(leftDoubleQuotationMark, '"'); >+ string.replace(leftSingleQuotationMark, '\''); >+ string.replace(rightDoubleQuotationMark, '"'); >+ string.replace(rightSingleQuotationMark, '\''); >+ >+ // Replace soft hyphens with an ignorable character so that presence or absence will not affect string comparison. >+ string.replace(softHyphen, 0); >+ >+ return string; > } > > #if !UCONFIG_NO_COLLATION >@@ -1943,7 +1949,8 @@ static inline bool isSeparator(UChar32 character) > } > > inline SearchBuffer::SearchBuffer(const String& target, FindOptions options) >- : m_target(target) >+ : m_target(foldQuoteMarksAndSoftHyphens(target)) >+ , m_targetCharacters(StringView(m_target).upconvertedCharacters()) > , m_options(options) > , m_prefixLength(0) > , m_atBreak(true) >@@ -1952,11 +1959,6 @@ inline SearchBuffer::SearchBuffer(const String& target, FindOptions options) > { > ASSERT(!m_target.isEmpty()); > >- // FIXME: We'd like to tailor the searcher to fold quote marks for us instead >- // of doing it in a separate replacement pass here, but ICU doesn't offer a way >- // to add tailoring on top of the locale-specific tailoring as of this writing. >- foldQuoteMarksAndSoftHyphens(m_target); >- > size_t targetLength = m_target.length(); > m_buffer.reserveInitialCapacity(std::max(targetLength * 8, minimumSearchBufferSize)); > m_overlap = m_buffer.capacity() / 4; >@@ -2000,12 +2002,12 @@ inline SearchBuffer::SearchBuffer(const String& target, FindOptions options) > usearch_setAttribute(searcher, USEARCH_ELEMENT_COMPARISON, comparator, &status); > ASSERT(status == U_ZERO_ERROR); > >- usearch_setPattern(searcher, m_target.deprecatedCharacters(), targetLength, &status); >+ usearch_setPattern(searcher, m_targetCharacters, targetLength, &status); > ASSERT(status == U_ZERO_ERROR); > > // The kana workaround requires a normalized copy of the target string. > if (m_targetRequiresKanaWorkaround) >- normalizeCharacters(m_target.deprecatedCharacters(), m_target.length(), m_normalizedTarget); >+ normalizeCharacters(m_targetCharacters, targetLength, m_normalizedTarget); > } > > inline SearchBuffer::~SearchBuffer() >diff --git a/Source/WebCore/editing/TypingCommand.cpp b/Source/WebCore/editing/TypingCommand.cpp >index 3a6dba37279bdd05cb48f07c4e2171f40bbd8599..9329cdf39139bbbe293c79568da4b436694ea805 100644 >--- a/Source/WebCore/editing/TypingCommand.cpp >+++ b/Source/WebCore/editing/TypingCommand.cpp >@@ -155,7 +155,7 @@ void TypingCommand::insertText(Document& document, const String& text, Options o > ASSERT(frame); > > if (!text.isEmpty()) >- frame->editor().updateMarkersForWordsAffectedByEditing(isSpaceOrNewline(text.deprecatedCharacters()[0])); >+ frame->editor().updateMarkersForWordsAffectedByEditing(isSpaceOrNewline(text[0])); > > insertText(document, text, frame->selection().selection(), options, composition); > } >diff --git a/Source/WebCore/editing/VisiblePosition.cpp b/Source/WebCore/editing/VisiblePosition.cpp >index 10ca164cbe2e4e82fb599757d0a7e4f31a75b025..fd8cc4dd774f6516f5f998a8133b193f9ad08aee 100644 >--- a/Source/WebCore/editing/VisiblePosition.cpp >+++ b/Source/WebCore/editing/VisiblePosition.cpp >@@ -590,8 +590,7 @@ UChar32 VisiblePosition::characterAfter() const > return 0; > > UChar32 ch; >- const UChar* characters = textNode->data().deprecatedCharacters(); >- U16_NEXT(characters, offset, length, ch); >+ U16_NEXT(textNode->data(), offset, length, ch); > return ch; > } > >diff --git a/Source/WebCore/editing/VisibleUnits.cpp b/Source/WebCore/editing/VisibleUnits.cpp >index f9a3068773a4dcd821e9a2f9e663627d864c915e..6c0561b4f17934a4321de8004f413a4d04672c0c 100644 >--- a/Source/WebCore/editing/VisibleUnits.cpp >+++ b/Source/WebCore/editing/VisibleUnits.cpp >@@ -1155,13 +1155,13 @@ VisiblePosition startOfParagraph(const VisiblePosition& c, EditingBoundaryCrossi > ASSERT_WITH_SECURITY_IMPLICATION(n->isTextNode()); > type = Position::PositionIsOffsetInAnchor; > if (style.preserveNewline()) { >- const UChar* chars = toRenderText(r)->deprecatedCharacters(); >- int i = toRenderText(r)->textLength(); >+ StringImpl& text = *toRenderText(r)->text(); >+ int i = text.length(); > int o = offset; > if (n == startNode && o < i) > i = std::max(0, o); > while (--i >= 0) { >- if (chars[i] == '\n') >+ if (text[i] == '\n') > return VisiblePosition(Position(toText(n), i + 1), DOWNSTREAM); > } > } >@@ -1236,13 +1236,13 @@ VisiblePosition endOfParagraph(const VisiblePosition& c, EditingBoundaryCrossing > // FIXME: We avoid returning a position where the renderer can't accept the caret. > if (r->isText() && toRenderText(r)->hasRenderedText()) { > ASSERT_WITH_SECURITY_IMPLICATION(n->isTextNode()); >- int length = toRenderText(r)->textLength(); > type = Position::PositionIsOffsetInAnchor; > if (style.preserveNewline()) { >- const UChar* chars = toRenderText(r)->deprecatedCharacters(); >+ StringImpl& text = *toRenderText(r)->text(); > int o = n == startNode ? offset : 0; >+ int length = text.length(); > for (int i = o; i < length; ++i) { >- if (chars[i] == '\n') >+ if (text[i] == '\n') > return VisiblePosition(Position(toText(n), i), DOWNSTREAM); > } > } >diff --git a/Source/WebCore/fileapi/WebKitBlobBuilder.cpp b/Source/WebCore/fileapi/WebKitBlobBuilder.cpp >index 8a458053f7f77dd6a7fcf9c877a1dbcd3c374747..658b6a45de56c450ef58427c68128a4a29124e3c 100644 >--- a/Source/WebCore/fileapi/WebKitBlobBuilder.cpp >+++ b/Source/WebCore/fileapi/WebKitBlobBuilder.cpp >@@ -44,6 +44,7 @@ > #include <wtf/Vector.h> > #include <wtf/text/AtomicString.h> > #include <wtf/text/CString.h> >+#include <wtf/text/StringView.h> > > namespace WebCore { > >@@ -71,7 +72,7 @@ Vector<char>& BlobBuilder::getBuffer() > > void BlobBuilder::append(const String& text, const String& endingType) > { >- CString utf8Text = UTF8Encoding().encode(text.deprecatedCharacters(), text.length(), EntitiesForUnencodables); >+ CString utf8Text = UTF8Encoding().encode(text, EntitiesForUnencodables); > > Vector<char>& buffer = getBuffer(); > size_t oldSize = buffer.size(); >diff --git a/Source/WebCore/html/BaseDateAndTimeInputType.cpp b/Source/WebCore/html/BaseDateAndTimeInputType.cpp >index bdcde185cdb2f475d129eaae48ef042e94e878fe..0ca7a34281c945a4350fca7cb1fcb8176f821351 100644 >--- a/Source/WebCore/html/BaseDateAndTimeInputType.cpp >+++ b/Source/WebCore/html/BaseDateAndTimeInputType.cpp >@@ -108,7 +108,7 @@ bool BaseDateAndTimeInputType::parseToDateComponents(const String& source, DateC > DateComponents ignoredResult; > if (!out) > out = &ignoredResult; >- return parseToDateComponentsInternal(source.deprecatedCharacters(), source.length(), out); >+ return parseToDateComponentsInternal(source.upconvertedCharacters(), source.length(), out); > } > > String BaseDateAndTimeInputType::serialize(const Decimal& value) const >diff --git a/Source/WebCore/html/FormDataList.cpp b/Source/WebCore/html/FormDataList.cpp >index 48fc629693db1112cdaa24fd84b7148d90158474..136b6af7b50607b03e1a479bbdb5e47a7ee768b6 100644 >--- a/Source/WebCore/html/FormDataList.cpp >+++ b/Source/WebCore/html/FormDataList.cpp >@@ -22,6 +22,7 @@ > #include "FormDataList.h" > > #include "LineEnding.h" >+#include <wtf/text/StringView.h> > > namespace WebCore { > >@@ -32,7 +33,7 @@ FormDataList::FormDataList(const TextEncoding& c) > > void FormDataList::appendString(const String& s) > { >- CString cstr = m_encoding.encode(s.deprecatedCharacters(), s.length(), EntitiesForUnencodables); >+ CString cstr = m_encoding.encode(s, EntitiesForUnencodables); > m_items.append(normalizeLineEndingsToCRLF(cstr)); > } > >diff --git a/Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp b/Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp >index 9c119234f4df6e01969c485c03d7dc347102488c..47b8730a1642e090c2b5aa8061ea9dbbf7e7b9a9 100755 >--- a/Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp >+++ b/Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp >@@ -2167,7 +2167,7 @@ static void normalizeSpaces(String& text) > > unsigned textLength = text.length(); > Vector<UChar> charVector(textLength); >- memcpy(charVector.data(), text.deprecatedCharacters(), textLength * sizeof(UChar)); >+ StringView(text).getCharactersWithUpconvert(charVector.data()); > > charVector[i++] = ' '; > >diff --git a/Source/WebCore/html/parser/HTMLParserIdioms.cpp b/Source/WebCore/html/parser/HTMLParserIdioms.cpp >index 6c99b255fb7314c3c8b21c4f1ddd6c6154228d56..a2186b117b9e7f1ce52eaaee58ed70bf627d5143 100644 >--- a/Source/WebCore/html/parser/HTMLParserIdioms.cpp >+++ b/Source/WebCore/html/parser/HTMLParserIdioms.cpp >@@ -71,7 +71,7 @@ String stripLeadingAndTrailingHTMLSpaces(const String& string) > if (string.is8Bit()) > return stripLeadingAndTrailingHTMLSpaces(string, string.characters8(), length); > >- return stripLeadingAndTrailingHTMLSpaces(string, string.deprecatedCharacters(), length); >+ return stripLeadingAndTrailingHTMLSpaces(string, string.characters16(), length); > } > > String serializeForNumberType(const Decimal& number) >@@ -267,12 +267,12 @@ bool parseHTMLNonNegativeInteger(const String& input, unsigned& value) > // Step 1 > // Step 2 > unsigned length = input.length(); >- if (length && input.is8Bit()) { >+ if (!length || input.is8Bit()) { > const LChar* start = input.characters8(); > return parseHTMLNonNegativeIntegerInternal(start, start + length, value); > } > >- const UChar* start = input.deprecatedCharacters(); >+ const UChar* start = input.characters16(); > return parseHTMLNonNegativeIntegerInternal(start, start + length, value); > } > >@@ -326,7 +326,10 @@ static bool parseDescriptors(const String& attribute, size_t start, size_t end, > if (isFoundScaleFactor) > return false; > >- imageScaleFactor = charactersToFloat(attribute.deprecatedCharacters() + descriptorStart, descriptorEnd - descriptorStart, &isValid); >+ if (attribute.is8Bit()) >+ imageScaleFactor = charactersToFloat(attribute.characters8() + descriptorStart, descriptorEnd - descriptorStart, &isValid); >+ else >+ imageScaleFactor = charactersToFloat(attribute.characters16() + descriptorStart, descriptorEnd - descriptorStart, &isValid); > isFoundScaleFactor = true; > } > >diff --git a/Source/WebCore/inspector/InspectorStyleSheet.cpp b/Source/WebCore/inspector/InspectorStyleSheet.cpp >index c635c582189d0bf0052e17febc947a658b47060e..08776d7adce5fae715152694385c2404529f3838 100644 >--- a/Source/WebCore/inspector/InspectorStyleSheet.cpp >+++ b/Source/WebCore/inspector/InspectorStyleSheet.cpp >@@ -712,14 +712,13 @@ NewLineAndWhitespace& InspectorStyle::newLineAndWhitespaceDelimiters() const > int propertyIndex = 0; > bool isFullPrefixScanned = false; > bool lineFeedTerminated = false; >- const UChar* characters = text.deprecatedCharacters(); > while (propertyIndex < propertyCount) { > const WebCore::CSSPropertySourceData& currentProperty = sourcePropertyData->at(propertyIndex++); > > bool processNextProperty = false; > int scanEnd = currentProperty.range.start; > for (int i = scanStart; i < scanEnd; ++i) { >- UChar ch = characters[i]; >+ UChar ch = text[i]; > bool isLineFeed = isHTMLLineBreak(ch); > if (isLineFeed) { > if (!lineFeedTerminated) >diff --git a/Source/WebCore/inspector/InspectorStyleTextEditor.cpp b/Source/WebCore/inspector/InspectorStyleTextEditor.cpp >index c17c3de41df5b65041b26fd4b31020e2989a9dd2..3ce5cb62e073d60755f98d0c98c0b6f0e2a93da3 100644 >--- a/Source/WebCore/inspector/InspectorStyleTextEditor.cpp >+++ b/Source/WebCore/inspector/InspectorStyleTextEditor.cpp >@@ -82,12 +82,10 @@ void InspectorStyleTextEditor::insertProperty(unsigned index, const String& prop > if (insertLast && !insertFirstInSource) { > propertyStart = styleBodyLength; > if (propertyStart && textToSet.length()) { >- const UChar* characters = m_styleText.deprecatedCharacters(); >- > long curPos = propertyStart - 1; // The last position of style declaration, since propertyStart points past one. >- while (curPos && isHTMLSpace(characters[curPos])) >+ while (curPos && isHTMLSpace(m_styleText[curPos])) > --curPos; >- if (curPos && characters[curPos] != ';') { >+ if (curPos && m_styleText[curPos] != ';') { > // Prepend a ";" to the property text if appending to a style declaration where > // the last property has no trailing ";". > textToSet.insert(";", 0); >@@ -230,7 +228,6 @@ void InspectorStyleTextEditor::internalReplaceProperty(const InspectorStylePrope > const SourceRange& range = property.sourceData.range; > long replaceRangeStart = range.start; > long replaceRangeEnd = range.end; >- const UChar* characters = m_styleText.deprecatedCharacters(); > long newTextLength = newText.length(); > String finalNewText = newText; > >@@ -241,14 +238,14 @@ void InspectorStyleTextEditor::internalReplaceProperty(const InspectorStylePrope > if (replaceRangeStart >= fullPrefixLength && m_styleText.substring(replaceRangeStart - fullPrefixLength, fullPrefixLength) == fullPrefix) > replaceRangeStart -= fullPrefixLength; > } else if (newTextLength) { >- if (isHTMLLineBreak(newText.deprecatedCharacters()[newTextLength - 1])) { >+ if (isHTMLLineBreak(newText[newTextLength - 1])) { > // Coalesce newlines of the original and new property values (to avoid a lot of blank lines while incrementally applying property values). > bool foundNewline = false; > bool isLastNewline = false; > int i; > int textLength = m_styleText.length(); >- for (i = replaceRangeEnd; i < textLength && isSpaceOrNewline(characters[i]); ++i) { >- isLastNewline = isHTMLLineBreak(characters[i]); >+ for (i = replaceRangeEnd; i < textLength && isSpaceOrNewline(m_styleText[i]); ++i) { >+ isLastNewline = isHTMLLineBreak(m_styleText[i]); > if (isLastNewline) > foundNewline = true; > else if (foundNewline && !isLastNewline) { >diff --git a/Source/WebCore/page/ContentSecurityPolicy.cpp b/Source/WebCore/page/ContentSecurityPolicy.cpp >index 5a5a7f7a870c7307ac7ac528b3f94de24055e789..58d63679cf1d4d4e3b91494edce9b9ffc284d819 100644 >--- a/Source/WebCore/page/ContentSecurityPolicy.cpp >+++ b/Source/WebCore/page/ContentSecurityPolicy.cpp >@@ -189,8 +189,9 @@ static void skipWhile(const UChar*& position, const UChar* end) > > static bool isSourceListNone(const String& value) > { >- const UChar* begin = value.deprecatedCharacters(); >- const UChar* end = value.deprecatedCharacters() + value.length(); >+ auto characters = StringView(value).upconvertedCharacters(); >+ const UChar* begin = characters; >+ const UChar* end = characters + value.length(); > skipWhile<isASCIISpace>(begin, end); > > const UChar* position = begin; >@@ -339,7 +340,8 @@ void CSPSourceList::parse(const String& value) > // We represent 'none' as an empty m_list. > if (isSourceListNone(value)) > return; >- parse(value.deprecatedCharacters(), value.deprecatedCharacters() + value.length()); >+ auto characters = StringView(value).upconvertedCharacters(); >+ parse(characters, characters + value.length()); > } > > bool CSPSourceList::matches(const URL& url) >@@ -680,7 +682,8 @@ private: > void parse(const String& value) > { > String nonce; >- const UChar* position = value.deprecatedCharacters(); >+ auto characters = StringView(value).upconvertedCharacters(); >+ const UChar* position = characters; > const UChar* end = position + value.length(); > > skipWhile<isASCIISpace>(position, end); >@@ -723,7 +726,8 @@ public: > private: > void parse(const String& value) > { >- const UChar* begin = value.deprecatedCharacters(); >+ auto characters = StringView(value).upconvertedCharacters(); >+ const UChar* begin = characters; > const UChar* position = begin; > const UChar* end = begin + value.length(); > >@@ -1211,7 +1215,8 @@ void CSPDirectiveList::parse(const String& policy) > if (policy.isEmpty()) > return; > >- const UChar* position = policy.deprecatedCharacters(); >+ auto characters = StringView(policy).upconvertedCharacters(); >+ const UChar* position = characters; > const UChar* end = position + policy.length(); > > while (position < end) { >@@ -1290,7 +1295,9 @@ void CSPDirectiveList::parseReportURI(const String& name, const String& value) > m_policy->reportDuplicateDirective(name); > return; > } >- const UChar* position = value.deprecatedCharacters(); >+ >+ auto characters = StringView(name).upconvertedCharacters(); >+ const UChar* position = characters; > const UChar* end = position + value.length(); > > while (position < end) { >@@ -1344,7 +1351,8 @@ void CSPDirectiveList::parseReflectedXSS(const String& name, const String& value > return; > } > >- const UChar* position = value.deprecatedCharacters(); >+ auto characters = StringView(value).upconvertedCharacters(); >+ const UChar* position = characters; > const UChar* end = position + value.length(); > > skipWhile<isASCIISpace>(position, end); >@@ -1443,7 +1451,8 @@ void ContentSecurityPolicy::didReceiveHeader(const String& header, HeaderType ty > // RFC2616, section 4.2 specifies that headers appearing multiple times can > // be combined with a comma. Walk the header string, and parse each comma > // separated chunk as a separate header. >- const UChar* begin = header.deprecatedCharacters(); >+ auto characters = StringView(header).upconvertedCharacters(); >+ const UChar* begin = characters; > const UChar* position = begin; > const UChar* end = begin + header.length(); > while (position < end) { >diff --git a/Source/WebCore/page/PageSerializer.cpp b/Source/WebCore/page/PageSerializer.cpp >index b721a647de451011f6bd8c8183dc5b6095ecf477..c80259cf100f682808716683176203bb01e3d77f 100644 >--- a/Source/WebCore/page/PageSerializer.cpp >+++ b/Source/WebCore/page/PageSerializer.cpp >@@ -216,7 +216,7 @@ void PageSerializer::serializeFrame(Frame* frame) > return; > } > String text = accumulator.serializeNodes(*document->documentElement(), 0, IncludeNode); >- CString frameHTML = textEncoding.encode(text.deprecatedCharacters(), text.length(), EntitiesForUnencodables); >+ CString frameHTML = textEncoding.encode(text, EntitiesForUnencodables); > m_resources->append(Resource(url, document->suggestedMIMEType(), SharedBuffer::create(frameHTML.data(), frameHTML.length()))); > m_resourceURLs.add(url); > >@@ -283,7 +283,7 @@ void PageSerializer::serializeCSSStyleSheet(CSSStyleSheet* styleSheet, const URL > TextEncoding textEncoding(styleSheet->contents().charset()); > ASSERT(textEncoding.isValid()); > String textString = cssText.toString(); >- CString text = textEncoding.encode(textString.deprecatedCharacters(), textString.length(), EntitiesForUnencodables); >+ CString text = textEncoding.encode(textString, EntitiesForUnencodables); > m_resources->append(Resource(url, String("text/css"), SharedBuffer::create(text.data(), text.length()))); > m_resourceURLs.add(url); > } >diff --git a/Source/WebCore/platform/Length.cpp b/Source/WebCore/platform/Length.cpp >index dc0579f0cad433ac4112bdaf59a989cdbb7f0c9d..f8404b0c7f34f603d7f53f9da2c0d2f8fab5a1c2 100644 >--- a/Source/WebCore/platform/Length.cpp >+++ b/Source/WebCore/platform/Length.cpp >@@ -30,7 +30,7 @@ > #include <wtf/Assertions.h> > #include <wtf/StdLibExtras.h> > #include <wtf/text/StringBuffer.h> >-#include <wtf/text/WTFString.h> >+#include <wtf/text/StringView.h> > > using namespace WTF; > >@@ -77,21 +77,21 @@ static Length parseLength(const UChar* data, unsigned length) > return Length(0, Relative); > } > >-static int countCharacter(const UChar* data, unsigned length, UChar character) >+static unsigned countCharacter(StringImpl& string, UChar character) > { >- int count = 0; >- for (int i = 0; i < static_cast<int>(length); ++i) >- count += data[i] == character; >+ unsigned count = 0; >+ unsigned length = string.length(); >+ for (unsigned i = 0; i < length; ++i) >+ count += string[i] == character; > return count; > } > > std::unique_ptr<Length[]> newCoordsArray(const String& string, int& len) > { > unsigned length = string.length(); >- const UChar* data = string.deprecatedCharacters(); > StringBuffer<UChar> spacified(length); > for (unsigned i = 0; i < length; i++) { >- UChar cc = data[i]; >+ UChar cc = string[i]; > if (cc > '9' || (cc < '0' && cc != '-' && cc != '*' && cc != '.')) > spacified[i] = ' '; > else >@@ -101,18 +101,19 @@ std::unique_ptr<Length[]> newCoordsArray(const String& string, int& len) > > str = str->simplifyWhiteSpace(); > >- len = countCharacter(str->deprecatedCharacters(), str->length(), ' ') + 1; >+ len = countCharacter(*str, ' ') + 1; > auto r = std::make_unique<Length[]>(len); > > int i = 0; > unsigned pos = 0; > size_t pos2; > >+ auto upconvertedCharacters = StringView(str.get()).upconvertedCharacters(); > while ((pos2 = str->find(' ', pos)) != notFound) { >- r[i++] = parseLength(str->deprecatedCharacters() + pos, pos2 - pos); >+ r[i++] = parseLength(upconvertedCharacters + pos, pos2 - pos); > pos = pos2+1; > } >- r[i] = parseLength(str->deprecatedCharacters() + pos, str->length() - pos); >+ r[i] = parseLength(upconvertedCharacters + pos, str->length() - pos); > > ASSERT(i == len - 1); > >@@ -127,15 +128,16 @@ std::unique_ptr<Length[]> newLengthArray(const String& string, int& len) > return nullptr; > } > >- len = countCharacter(str->deprecatedCharacters(), str->length(), ',') + 1; >+ len = countCharacter(*str, ',') + 1; > auto r = std::make_unique<Length[]>(len); > > int i = 0; > unsigned pos = 0; > size_t pos2; > >+ auto upconvertedCharacters = StringView(str.get()).upconvertedCharacters(); > while ((pos2 = str->find(',', pos)) != notFound) { >- r[i++] = parseLength(str->deprecatedCharacters() + pos, pos2 - pos); >+ r[i++] = parseLength(upconvertedCharacters + pos, pos2 - pos); > pos = pos2+1; > } > >@@ -143,7 +145,7 @@ std::unique_ptr<Length[]> newLengthArray(const String& string, int& len) > > // IE Quirk: If the last comma is the last char skip it and reduce len by one. > if (str->length()-pos > 0) >- r[i] = parseLength(str->deprecatedCharacters() + pos, str->length() - pos); >+ r[i] = parseLength(upconvertedCharacters + pos, str->length() - pos); > else > len--; > >diff --git a/Source/WebCore/platform/LinkHash.cpp b/Source/WebCore/platform/LinkHash.cpp >index 5f24b20c9d078e84e23e1233c34f596a023013d9..ece933faa5194124069e8f8383940c99c5377125 100644 >--- a/Source/WebCore/platform/LinkHash.cpp >+++ b/Source/WebCore/platform/LinkHash.cpp >@@ -214,10 +214,9 @@ static ALWAYS_INLINE LinkHash visitedLinkHashInline(const CharacterType* url, un > LinkHash visitedLinkHash(const String& url) > { > unsigned length = url.length(); >- >- if (length && url.is8Bit()) >+ if (!length || url.is8Bit()) > return visitedLinkHashInline(url.characters8(), length); >- return visitedLinkHashInline(url.deprecatedCharacters(), length); >+ return visitedLinkHashInline(url.characters16(), length); > } > > LinkHash visitedLinkHash(const UChar* url, unsigned length) >@@ -284,11 +283,6 @@ static ALWAYS_INLINE void visitedURLInline(const URL& base, const CharacterType* > return; > } > >-void visitedURL(const URL& base, const AtomicString& attributeURL, Vector<UChar, 512>& buffer) >-{ >- return visitedURLInline(base, attributeURL.string().deprecatedCharacters(), attributeURL.length(), buffer); >-} >- > LinkHash visitedLinkHash(const URL& base, const AtomicString& attributeURL) > { > if (attributeURL.isEmpty()) >diff --git a/Source/WebCore/platform/LinkHash.h b/Source/WebCore/platform/LinkHash.h >index 14fdbedef1ad028a304f86bfe10f591f38423a4e..039942f26276d6957746b2918f4fac313b633af5 100644 >--- a/Source/WebCore/platform/LinkHash.h >+++ b/Source/WebCore/platform/LinkHash.h >@@ -63,12 +63,6 @@ LinkHash visitedLinkHash(const UChar* url, unsigned length); > // look like a relative URL. > LinkHash visitedLinkHash(const URL& base, const AtomicString& attributeURL); > >-// Resolves the potentially relative URL "attributeURL" relative to the given >-// base URL, and returns the hash of the string that will be used for visited. >-// It will return an empty Vector in case of errors. >-void visitedURL(const URL& base, const AtomicString& attributeURL, Vector<UChar, 512>&); >- >- > } // namespace WebCore > > #endif // LinkHash_h >diff --git a/Source/WebCore/platform/SharedBuffer.cpp b/Source/WebCore/platform/SharedBuffer.cpp >index c70b4d2dcf8b0cf17b995782ddcf688a14f08749..c5ff23a0676db2a5ce69ea10f8152765f562ac3b 100644 >--- a/Source/WebCore/platform/SharedBuffer.cpp >+++ b/Source/WebCore/platform/SharedBuffer.cpp >@@ -522,10 +522,18 @@ PassRefPtr<SharedBuffer> utf8Buffer(const String& string) > > // Convert to runs of 8-bit characters. > char* p = buffer.data(); >- const UChar* d = string.deprecatedCharacters(); >- WTF::Unicode::ConversionResult result = WTF::Unicode::convertUTF16ToUTF8(&d, d + length, &p, p + buffer.size(), true); >- if (result != WTF::Unicode::conversionOK) >- return 0; >+ WTF::Unicode::ConversionResult result; >+ if (length) { >+ if (string.is8Bit()) { >+ const LChar* d = string.characters8(); >+ result = WTF::Unicode::convertLatin1ToUTF8(&d, d + length, &p, p + buffer.size()); >+ } else { >+ const UChar* d = string.characters16(); >+ result = WTF::Unicode::convertUTF16ToUTF8(&d, d + length, &p, p + buffer.size(), true); >+ } >+ if (result != WTF::Unicode::conversionOK) >+ return nullptr; >+ } > > buffer.shrink(p - buffer.data()); > return SharedBuffer::adoptVector(buffer); >diff --git a/Source/WebCore/platform/URL.cpp b/Source/WebCore/platform/URL.cpp >index 9469f1a8b48e28faefdda2a6d4eebf5dff4d2901..94dddcac14d2de5bf6901240bdddca723b4dd650 100644 >--- a/Source/WebCore/platform/URL.cpp >+++ b/Source/WebCore/platform/URL.cpp >@@ -588,7 +588,11 @@ unsigned short URL::port() const > return 0; > > bool ok = false; >- unsigned number = charactersToUIntStrict(m_string.deprecatedCharacters() + m_hostEnd + 1, m_portEnd - m_hostEnd - 1, &ok); >+ unsigned number; >+ if (m_string.is8Bit()) >+ number = charactersToUIntStrict(m_string.characters8() + m_hostEnd + 1, m_portEnd - m_hostEnd - 1, &ok); >+ else >+ number = charactersToUIntStrict(m_string.characters16() + m_hostEnd + 1, m_portEnd - m_hostEnd - 1, &ok); > if (!ok || number > maximumValidPortNumber) > return invalidPortNumber; > return number; >@@ -1666,14 +1670,14 @@ static void encodeRelativeString(const String& rel, const TextEncoding& encoding > } > > if (pathEnd == -1) { >- CString decoded = pathEncoding.encode(s.data(), s.size(), URLEncodedEntitiesForUnencodables); >+ CString decoded = pathEncoding.encode(StringView(s.data(), s.size()), URLEncodedEntitiesForUnencodables); > output.resize(decoded.length()); > memcpy(output.data(), decoded.data(), decoded.length()); > } else { >- CString pathDecoded = pathEncoding.encode(s.data(), pathEnd, URLEncodedEntitiesForUnencodables); >+ CString pathDecoded = pathEncoding.encode(StringView(s.data(), pathEnd), URLEncodedEntitiesForUnencodables); > // Unencodable characters in URLs are represented by converting > // them to XML entities and escaping non-alphanumeric characters. >- CString otherDecoded = encoding.encode(s.data() + pathEnd, s.size() - pathEnd, URLEncodedEntitiesForUnencodables); >+ CString otherDecoded = encoding.encode(StringView(s.data() + pathEnd, s.size() - pathEnd), URLEncodedEntitiesForUnencodables); > > output.resize(pathDecoded.length() + otherDecoded.length()); > memcpy(output.data(), pathDecoded.data(), pathDecoded.length()); >diff --git a/Source/WebCore/platform/graphics/Color.cpp b/Source/WebCore/platform/graphics/Color.cpp >index db5eb8ee7793cbb720ec66f5066a83b506f13d82..8bc71469421dbd8ee9884309514f44c901543b42 100644 >--- a/Source/WebCore/platform/graphics/Color.cpp >+++ b/Source/WebCore/platform/graphics/Color.cpp >@@ -165,7 +165,7 @@ bool Color::parseHexColor(const String& name, RGBA32& rgb) > return false; > if (name.is8Bit()) > return parseHexColor(name.characters8(), name.length(), rgb); >- return parseHexColor(name.deprecatedCharacters(), name.length(), rgb); >+ return parseHexColor(name.characters16(), name.length(), rgb); > } > > int differenceSquared(const Color& c1, const Color& c2) >@@ -182,7 +182,7 @@ Color::Color(const String& name) > if (name.is8Bit()) > m_valid = parseHexColor(name.characters8() + 1, name.length() - 1, m_color); > else >- m_valid = parseHexColor(name.deprecatedCharacters() + 1, name.length() - 1, m_color); >+ m_valid = parseHexColor(name.characters16() + 1, name.length() - 1, m_color); > } else > setNamedColor(name); > } >diff --git a/Source/WebCore/platform/graphics/StringTruncator.cpp b/Source/WebCore/platform/graphics/StringTruncator.cpp >index edc54546901f7bc4209a8ecdf797420994bc2d94..e6640bd7ca7674ffa633d53c211a2aca079b562e 100644 >--- a/Source/WebCore/platform/graphics/StringTruncator.cpp >+++ b/Source/WebCore/platform/graphics/StringTruncator.cpp >@@ -89,12 +89,10 @@ static unsigned centerTruncateToBuffer(const String& string, unsigned length, un > unsigned truncatedLength = shouldInsertEllipsis ? omitStart + 1 + (length - omitEnd) : length - (omitEnd - omitStart); > ASSERT(truncatedLength <= length); > >- memcpy(buffer, string.deprecatedCharacters(), sizeof(UChar) * omitStart); >- if (shouldInsertEllipsis) { >- buffer[omitStart] = horizontalEllipsis; >- memcpy(&buffer[omitStart + 1], &string.deprecatedCharacters()[omitEnd], sizeof(UChar) * (length - omitEnd)); >- } else >- memcpy(&buffer[omitStart], &string.deprecatedCharacters()[omitEnd], sizeof(UChar) * (length - omitEnd)); >+ StringView(string).substring(0, omitStart).getCharactersWithUpconvert(buffer); >+ if (shouldInsertEllipsis) >+ buffer[omitStart++] = horizontalEllipsis; >+ StringView(string).substring(omitEnd, length - omitEnd).getCharactersWithUpconvert(&buffer[omitStart + 1]); > return truncatedLength; > } > >@@ -119,7 +117,7 @@ static unsigned rightTruncateToBuffer(const String& string, unsigned length, uns > unsigned keepLength = textBreakAtOrPreceding(it, keepCount); > unsigned truncatedLength = shouldInsertEllipsis ? keepLength + 1 : keepLength; > >- memcpy(buffer, string.deprecatedCharacters(), sizeof(UChar) * keepLength); >+ StringView(string).substring(0, keepLength).getCharactersWithUpconvert(buffer); > if (shouldInsertEllipsis) > buffer[keepLength] = horizontalEllipsis; > >@@ -133,7 +131,7 @@ static unsigned rightClipToCharacterBuffer(const String& string, unsigned length > > NonSharedCharacterBreakIterator it(StringView(string).substring(0, length)); > unsigned keepLength = textBreakAtOrPreceding(it, keepCount); >- memcpy(buffer, string.deprecatedCharacters(), sizeof(UChar) * keepLength); >+ StringView(string).substring(0, keepLength).getCharactersWithUpconvert(buffer); > > return keepLength; > } >@@ -145,7 +143,7 @@ static unsigned rightClipToWordBuffer(const String& string, unsigned length, uns > > TextBreakIterator* it = wordBreakIterator(StringView(string).substring(0, length)); > unsigned keepLength = textBreakAtOrPreceding(it, keepCount); >- memcpy(buffer, string.deprecatedCharacters(), sizeof(UChar) * keepLength); >+ StringView(string).substring(0, keepLength).getCharactersWithUpconvert(buffer); > > #if PLATFORM(IOS) > // FIXME: We should guard this code behind an editing behavior. Then we can remove the PLATFORM(IOS)-guard. >@@ -178,10 +176,10 @@ static unsigned leftTruncateToBuffer(const String& string, unsigned length, unsi > > if (shouldInsertEllipsis) { > buffer[0] = horizontalEllipsis; >- memcpy(&buffer[1], &string.deprecatedCharacters()[adjustedStartIndex], sizeof(UChar) * (length - adjustedStartIndex + 1)); >+ StringView(string).substring(adjustedStartIndex, length - adjustedStartIndex + 1).getCharactersWithUpconvert(&buffer[1]); > return length - adjustedStartIndex + 1; > } >- memcpy(&buffer[0], &string.deprecatedCharacters()[adjustedStartIndex], sizeof(UChar) * (length - adjustedStartIndex + 1)); >+ StringView(string).substring(adjustedStartIndex, length - adjustedStartIndex + 1).getCharactersWithUpconvert(&buffer[0]); > return length - adjustedStartIndex; > } > >@@ -218,7 +216,7 @@ static String truncateString(const String& string, float maxWidth, const Font& f > truncatedLength = centerTruncateToBuffer(string, length, keepCount, stringBuffer, shouldInsertEllipsis); > } else { > keepCount = length; >- memcpy(stringBuffer, string.deprecatedCharacters(), sizeof(UChar) * length); >+ StringView(string).getCharactersWithUpconvert(stringBuffer); > truncatedLength = length; > } > >diff --git a/Source/WebCore/platform/graphics/TextRun.h b/Source/WebCore/platform/graphics/TextRun.h >index 698541e5da5693c5b98f41a871e66f8beb1c01d4..0b34bed24a676a4b66936de42496a908b85e6f15 100644 >--- a/Source/WebCore/platform/graphics/TextRun.h >+++ b/Source/WebCore/platform/graphics/TextRun.h >@@ -116,11 +116,11 @@ public: > , m_disableSpacing(false) > , m_tabSize(0) > { >- if (m_charactersLength && s.is8Bit()) { >+ if (!m_charactersLength || s.is8Bit()) { > m_data.characters8 = s.characters8(); > m_is8Bit = true; > } else { >- m_data.characters16 = s.deprecatedCharacters(); >+ m_data.characters16 = s.characters16(); > m_is8Bit = false; > } > } >diff --git a/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm b/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm >index 1f4d79aa139349d8abc92efe291b0240bb5f0493..6801424ec2650cf4a310bb778079b73fae6be592 100644 >--- a/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm >+++ b/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm >@@ -1240,7 +1240,7 @@ bool MediaPlayerPrivateAVFoundationObjC::shouldWaitForLoadingOfResource(AVAssetR > initDataView->set<uint32_t>(0, keyURISize, true); > > RefPtr<Uint16Array> keyURIArray = Uint16Array::create(initDataBuffer, 4, keyURI.length()); >- keyURIArray->setRange(keyURI.deprecatedCharacters(), keyURI.length() / sizeof(unsigned char), 0); >+ keyURIArray->setRange(StringView(keyURI).upconvertedCharacters(), keyURI.length() / sizeof(unsigned char), 0); > > #if ENABLE(ENCRYPTED_MEDIA) > if (!player()->keyNeeded("com.apple.lskd", emptyString(), static_cast<const unsigned char*>(initDataBuffer->data()), initDataBuffer->byteLength())) >diff --git a/Source/WebCore/platform/network/FormDataBuilder.cpp b/Source/WebCore/platform/network/FormDataBuilder.cpp >index a76916ebdf510e7827698b1968ea35b0ba86e904..acad8e0a77468d1c19b33b539325d3d00bf9ec38 100644 >--- a/Source/WebCore/platform/network/FormDataBuilder.cpp >+++ b/Source/WebCore/platform/network/FormDataBuilder.cpp >@@ -28,12 +28,12 @@ > #include "Blob.h" > #include "Document.h" > #include "TextEncoding.h" >- > #include <limits> > #include <wtf/Assertions.h> > #include <wtf/HexNumber.h> >-#include <wtf/text/CString.h> > #include <wtf/RandomNumber.h> >+#include <wtf/text/CString.h> >+#include <wtf/text/StringView.h> > > namespace WebCore { > >@@ -61,12 +61,11 @@ static void appendQuotedString(Vector<char>& buffer, const CString& string) > size_t length = string.length(); > for (size_t i = 0; i < length; ++i) { > char c = string.data()[i]; >- > switch (c) { >- case 0x0a: >+ case 0xA: > append(buffer, "%0A"); > break; >- case 0x0d: >+ case 0xD: > append(buffer, "%0D"); > break; > case '"': >@@ -86,11 +85,9 @@ TextEncoding FormDataBuilder::encodingFromAcceptCharset(const String& acceptChar > Vector<String> charsets; > normalizedAcceptCharset.split(' ', charsets); > >- TextEncoding encoding; >- >- Vector<String>::const_iterator end = charsets.end(); >- for (Vector<String>::const_iterator it = charsets.begin(); it != end; ++it) { >- if ((encoding = TextEncoding(*it)).isValid()) >+ for (auto& charset : charsets) { >+ TextEncoding encoding(charset); >+ if (encoding.isValid()) > return encoding; > } > >@@ -165,7 +162,7 @@ void FormDataBuilder::addFilenameToMultiPartHeader(Vector<char>& buffer, const T > // FIXME: This loses data irreversibly if the filename includes characters you can't encode > // in the website's character set. > append(buffer, "; filename=\""); >- appendQuotedString(buffer, encoding.encode(filename.deprecatedCharacters(), filename.length(), QuestionMarksForUnencodables)); >+ appendQuotedString(buffer, encoding.encode(filename, QuestionMarksForUnencodables)); > append(buffer, '"'); > } > >diff --git a/Source/WebCore/platform/sql/SQLiteStatement.cpp b/Source/WebCore/platform/sql/SQLiteStatement.cpp >index 4b2b77160edf03f8291be778befe49b975fb7fb0..ee1b88f31ed7405dec929cfdf59775c928ac9daf 100644 >--- a/Source/WebCore/platform/sql/SQLiteStatement.cpp >+++ b/Source/WebCore/platform/sql/SQLiteStatement.cpp >@@ -30,7 +30,7 @@ > #include "SQLValue.h" > #include <sqlite3.h> > #include <wtf/Assertions.h> >-#include <wtf/text/StringImpl.h> >+#include <wtf/text/StringView.h> > > // SQLite 3.6.16 makes sqlite3_prepare_v2 automatically retry preparing the statement > // once if the database scheme has changed. We rely on this behavior. >@@ -177,12 +177,13 @@ int SQLiteStatement::bindBlob(int index, const String& text) > { > // String::characters() returns 0 for the empty string, which SQLite > // treats as a null, so we supply a non-null pointer for that case. >+ auto upconvertedCharacters = StringView(text).upconvertedCharacters(); > UChar anyCharacter = 0; > const UChar* characters; > if (text.isEmpty() && !text.isNull()) > characters = &anyCharacter; > else >- characters = text.deprecatedCharacters(); >+ characters = upconvertedCharacters; > > return bindBlob(index, characters, text.length() * sizeof(UChar)); > } >@@ -195,12 +196,13 @@ int SQLiteStatement::bindText(int index, const String& text) > > // String::characters() returns 0 for the empty string, which SQLite > // treats as a null, so we supply a non-null pointer for that case. >+ auto upconvertedCharacters = StringView(text).upconvertedCharacters(); > UChar anyCharacter = 0; > const UChar* characters; > if (text.isEmpty() && !text.isNull()) > characters = &anyCharacter; > else >- characters = text.deprecatedCharacters(); >+ characters = upconvertedCharacters; > > return sqlite3_bind_text16(m_statement, index, characters, sizeof(UChar) * text.length(), SQLITE_TRANSIENT); > } >diff --git a/Source/WebCore/platform/text/DecodeEscapeSequences.h b/Source/WebCore/platform/text/DecodeEscapeSequences.h >index 2fa6e4658918c6411b1c11657c6d70daa69f02f6..c8a2892fa2d00a556dc097a6039ac99cfde14b98 100644 >--- a/Source/WebCore/platform/text/DecodeEscapeSequences.h >+++ b/Source/WebCore/platform/text/DecodeEscapeSequences.h >@@ -51,19 +51,19 @@ struct Unicode16BitEscapeSequence { > } > return runEnd; > } >- static String decodeRun(const UChar* run, size_t runLength, const TextEncoding&) >+ static String decodeRun(StringView run, const TextEncoding&) > { > // Each %u-escape sequence represents a UTF-16 code unit. > // See <http://www.w3.org/International/iri-edit/draft-duerst-iri.html#anchor29>. > // For 16-bit escape sequences, we know that findEndOfRun() has given us a contiguous run of sequences > // without any intervening characters, so decode the run without additional checks. >- size_t numberOfSequences = runLength / sequenceSize; >+ auto numberOfSequences = run.length() / sequenceSize; > StringBuilder builder; > builder.reserveCapacity(numberOfSequences); > while (numberOfSequences--) { > UChar codeUnit = (toASCIIHexValue(run[2]) << 12) | (toASCIIHexValue(run[3]) << 8) | (toASCIIHexValue(run[4]) << 4) | toASCIIHexValue(run[5]); > builder.append(codeUnit); >- run += sequenceSize; >+ run = run.substring(sequenceSize); > } > return builder.toString(); > } >@@ -96,21 +96,20 @@ struct URLEscapeSequence { > } > return runEnd; > } >- static String decodeRun(const UChar* run, size_t runLength, const TextEncoding& encoding) >+ static String decodeRun(StringView run, const TextEncoding& encoding) > { > // For URL escape sequences, we know that findEndOfRun() has given us a run where every %-sign introduces > // a valid escape sequence, but there may be characters between the sequences. > Vector<char, 512> buffer; >- buffer.resize(runLength); // Unescaping hex sequences only makes the length smaller. >+ buffer.resize(run.length()); // Unescaping hex sequences only makes the length smaller. > char* p = buffer.data(); >- const UChar* runEnd = run + runLength; >- while (run < runEnd) { >+ while (!run.isEmpty()) { > if (run[0] == '%') { > *p++ = (toASCIIHexValue(run[1]) << 4) | toASCIIHexValue(run[2]); >- run += sequenceSize; >+ run = run.substring(sequenceSize); > } else { > *p++ = run[0]; >- run += 1; >+ run = run.substring(1); > } > } > ASSERT(buffer.size() >= static_cast<size_t>(p - buffer.data())); // Prove buffer not overrun. >@@ -134,7 +133,7 @@ String decodeEscapeSequences(const String& string, const TextEncoding& encoding) > continue; > } > >- String decoded = EscapeSequence::decodeRun(string.deprecatedCharacters() + encodedRunPosition, encodedRunEnd - encodedRunPosition, encoding); >+ String decoded = EscapeSequence::decodeRun(StringView(string).substring(encodedRunPosition, encodedRunEnd - encodedRunPosition), encoding); > if (decoded.isEmpty()) > continue; > >diff --git a/Source/WebCore/platform/text/Hyphenation.cpp b/Source/WebCore/platform/text/Hyphenation.cpp >index 89f64386a9ebc887699bbee01f8e99ea1b2eec2d..abda744f90cf32d41ae92330cd26a1a6885e695c 100644 >--- a/Source/WebCore/platform/text/Hyphenation.cpp >+++ b/Source/WebCore/platform/text/Hyphenation.cpp >@@ -35,7 +35,7 @@ bool canHyphenate(const AtomicString& /* localeIdentifier */) > return false; > } > >-size_t lastHyphenLocation(const UChar* /* characters */, size_t /* length */, size_t /* beforeIndex */, const AtomicString& /* localeIdentifier */) >+size_t lastHyphenLocation(StringView, size_t /* beforeIndex */, const AtomicString& /* localeIdentifier */) > { > ASSERT_NOT_REACHED(); > return 0; >diff --git a/Source/WebCore/platform/text/Hyphenation.h b/Source/WebCore/platform/text/Hyphenation.h >index 20882dca54d6434eb6cdcd2b63c8283cfbe5df70..38f2af136ae15a08e2f91cc1cad57ab448b50646 100644 >--- a/Source/WebCore/platform/text/Hyphenation.h >+++ b/Source/WebCore/platform/text/Hyphenation.h >@@ -32,7 +32,7 @@ > namespace WebCore { > > bool canHyphenate(const AtomicString& localeIdentifier); >-size_t lastHyphenLocation(const UChar*, size_t length, size_t beforeIndex, const AtomicString& localeIdentifier); >+size_t lastHyphenLocation(StringView, size_t beforeIndex, const AtomicString& localeIdentifier); > > } // namespace WebCore > >diff --git a/Source/WebCore/platform/text/TextBreakIterator.cpp b/Source/WebCore/platform/text/TextBreakIterator.cpp >index 108d3b65dc7955bc045215566175612ea20f3aff..478608343f4e70033492f3c0859e17cd277e1549 100644 >--- a/Source/WebCore/platform/text/TextBreakIterator.cpp >+++ b/Source/WebCore/platform/text/TextBreakIterator.cpp >@@ -28,7 +28,6 @@ > #include <mutex> > #include <wtf/Atomics.h> > #include <wtf/text/StringView.h> >-#include <wtf/text/WTFString.h> > > namespace WebCore { > >@@ -43,16 +42,19 @@ static TextBreakIterator* initializeIterator(UBreakIteratorType type, const char > } > > #if !PLATFORM(IOS) >+ > static TextBreakIterator* initializeIteratorWithRules(const char* breakRules) > { > UParseError parseStatus; > UErrorCode openStatus = U_ZERO_ERROR; >- String rules(breakRules); >- TextBreakIterator* iterator = reinterpret_cast<TextBreakIterator*>(ubrk_openRules(rules.deprecatedCharacters(), rules.length(), 0, 0, &parseStatus, &openStatus)); >+ unsigned length = strlen(breakRules); >+ auto upconvertedCharacters = StringView(reinterpret_cast<const LChar*>(breakRules), length).upconvertedCharacters(); >+ TextBreakIterator* iterator = reinterpret_cast<TextBreakIterator*>(ubrk_openRules(upconvertedCharacters, length, 0, 0, &parseStatus, &openStatus)); > ASSERT_WITH_MESSAGE(U_SUCCESS(openStatus), "ICU could not open a break iterator: %s (%d)", u_errorName(openStatus), openStatus); > return iterator; > } >-#endif // !PLATFORM(IOS) >+ >+#endif > > > // Iterator text setting >diff --git a/Source/WebCore/platform/text/TextEncoding.cpp b/Source/WebCore/platform/text/TextEncoding.cpp >index 5666255733fef92d523c91b758d6b152e85869c0..db82bd7590f857f7c793218fed45cdfb02981942 100644 >--- a/Source/WebCore/platform/text/TextEncoding.cpp >+++ b/Source/WebCore/platform/text/TextEncoding.cpp >@@ -34,7 +34,7 @@ > #include <wtf/OwnPtr.h> > #include <wtf/StdLibExtras.h> > #include <wtf/text/CString.h> >-#include <wtf/text/WTFString.h> >+#include <wtf/text/StringView.h> > > namespace WebCore { > >@@ -64,20 +64,22 @@ String TextEncoding::decode(const char* data, size_t length, bool stopOnError, b > return newTextCodec(*this)->decode(data, length, true, stopOnError, sawError); > } > >-CString TextEncoding::encode(const UChar* characters, size_t length, UnencodableHandling handling) const >+CString TextEncoding::encode(StringView text, UnencodableHandling handling) const > { > if (!m_name) > return CString(); > >- if (!length) >+ if (text.isEmpty()) > return ""; > > // FIXME: What's the right place to do normalization? > // It's a little strange to do it inside the encode function. > // Perhaps normalization should be an explicit step done before calling encode. > >- const UChar* source = characters; >- size_t sourceLength = length; >+ auto upconvertedCharacters = text.upconvertedCharacters(); >+ >+ const UChar* source = upconvertedCharacters; >+ size_t sourceLength = text.length(); > > Vector<UChar> normalizedCharacters; > >@@ -85,17 +87,18 @@ CString TextEncoding::encode(const UChar* characters, size_t length, Unencodable > if (unorm_quickCheck(source, sourceLength, UNORM_NFC, &err) != UNORM_YES) { > // First try using the length of the original string, since normalization to NFC rarely increases length. > normalizedCharacters.grow(sourceLength); >- int32_t normalizedLength = unorm_normalize(source, length, UNORM_NFC, 0, normalizedCharacters.data(), length, &err); >+ int32_t normalizedLength = unorm_normalize(source, sourceLength, UNORM_NFC, 0, normalizedCharacters.data(), sourceLength, &err); > if (err == U_BUFFER_OVERFLOW_ERROR) { > err = U_ZERO_ERROR; > normalizedCharacters.resize(normalizedLength); >- normalizedLength = unorm_normalize(source, length, UNORM_NFC, 0, normalizedCharacters.data(), normalizedLength, &err); >+ normalizedLength = unorm_normalize(source, sourceLength, UNORM_NFC, 0, normalizedCharacters.data(), normalizedLength, &err); > } > ASSERT(U_SUCCESS(err)); > > source = normalizedCharacters.data(); > sourceLength = normalizedLength; > } >+ > return newTextCodec(*this)->encode(source, sourceLength, handling); > } > >diff --git a/Source/WebCore/platform/text/TextEncoding.h b/Source/WebCore/platform/text/TextEncoding.h >index 1a1fab42cec493ac41d60b9b77a7ca7ff68888b2..c9cf6c2459884ba729f7af76c6e9f0df57b8a048 100644 >--- a/Source/WebCore/platform/text/TextEncoding.h >+++ b/Source/WebCore/platform/text/TextEncoding.h >@@ -69,7 +69,7 @@ namespace WebCore { > return decode(str, length, false, ignored); > } > String decode(const char*, size_t length, bool stopOnError, bool& sawError) const; >- CString encode(const UChar*, size_t length, UnencodableHandling) const; >+ CString encode(StringView, UnencodableHandling) const; > > UChar backslashAsCurrencySymbol() const; > >diff --git a/Source/WebCore/platform/text/TextEncodingRegistry.cpp b/Source/WebCore/platform/text/TextEncodingRegistry.cpp >index f53671f54b79d6501d2c98e5ad0f7bffc2c0ea08..b8b2999760df3d7e3d408aaacaf3c215469e4d7a 100644 >--- a/Source/WebCore/platform/text/TextEncodingRegistry.cpp >+++ b/Source/WebCore/platform/text/TextEncodingRegistry.cpp >@@ -336,12 +336,12 @@ const char* atomicCanonicalTextEncodingName(const CharacterType* characters, siz > const char* atomicCanonicalTextEncodingName(const String& alias) > { > if (!alias.length()) >- return 0; >+ return nullptr; > > if (alias.is8Bit()) >- return atomicCanonicalTextEncodingName<LChar>(alias.characters8(), alias.length()); >+ return atomicCanonicalTextEncodingName(alias.characters8(), alias.length()); > >- return atomicCanonicalTextEncodingName<UChar>(alias.deprecatedCharacters(), alias.length()); >+ return atomicCanonicalTextEncodingName(alias.characters16(), alias.length()); > } > > bool noExtendedTextEncodingNameUsed() >diff --git a/Source/WebCore/platform/text/cf/HyphenationCF.cpp b/Source/WebCore/platform/text/cf/HyphenationCF.cpp >index c7802b9b019a15406673a57b877a53fceb2ef379..a344bd85336e4947e30ff7e472bb5a52192b1622 100644 >--- a/Source/WebCore/platform/text/cf/HyphenationCF.cpp >+++ b/Source/WebCore/platform/text/cf/HyphenationCF.cpp >@@ -31,6 +31,7 @@ > #include "TextBreakIteratorInternalICU.h" > #include <wtf/ListHashSet.h> > #include <wtf/RetainPtr.h> >+#include <wtf/text/StringView.h> > > namespace WebCore { > >@@ -73,15 +74,13 @@ bool canHyphenate(const AtomicString& localeIdentifier) > #endif // PLATFORM(IOS) > } > >-size_t lastHyphenLocation(const UChar* characters, size_t length, size_t beforeIndex, const AtomicString& localeIdentifier) >+size_t lastHyphenLocation(StringView text, size_t beforeIndex, const AtomicString& localeIdentifier) > { >- RetainPtr<CFStringRef> string = adoptCF(CFStringCreateWithCharactersNoCopy(kCFAllocatorDefault, reinterpret_cast<const UniChar*>(characters), length, kCFAllocatorNull)); >- > RetainPtr<CFLocaleRef> locale = cfLocaleCache().get(localeIdentifier); > ASSERT(locale); > > CFOptionFlags searchAcrossWordBoundaries = 1; >- CFIndex result = CFStringGetHyphenationLocationBeforeIndex(string.get(), beforeIndex, CFRangeMake(0, length), searchAcrossWordBoundaries, locale.get(), 0); >+ CFIndex result = CFStringGetHyphenationLocationBeforeIndex(text.createCFStringWithoutCopying().get(), beforeIndex, CFRangeMake(0, text.length()), searchAcrossWordBoundaries, locale.get(), 0); > return result == kCFNotFound ? 0 : result; > } > >diff --git a/Source/WebCore/rendering/RenderBlock.cpp b/Source/WebCore/rendering/RenderBlock.cpp >index 3bcda723fb8a1a62feebb2448e6e70f86ecdeeff..8ddb655aaf5d892b3282d9239ce6b3854a7f87b3 100644 >--- a/Source/WebCore/rendering/RenderBlock.cpp >+++ b/Source/WebCore/rendering/RenderBlock.cpp >@@ -5277,9 +5277,9 @@ TextRun RenderBlock::constructTextRun(RenderObject* context, const Font& font, c > { > unsigned length = string.length(); > >- if (length && string.is8Bit()) >+ if (!length || string.is8Bit()) > return constructTextRunInternal(context, font, string.characters8(), length, style, expansion, flags); >- return constructTextRunInternal(context, font, string.deprecatedCharacters(), length, style, expansion, flags); >+ return constructTextRunInternal(context, font, string.characters16(), length, style, expansion, flags); > } > > RenderBlock* RenderBlock::createAnonymousWithParentRendererAndDisplay(const RenderObject* parent, EDisplay display) >diff --git a/Source/WebCore/rendering/RenderCombineText.cpp b/Source/WebCore/rendering/RenderCombineText.cpp >index ffee00f17366831ea6cb1ad228ef0b0ac7bd797a..11f8b9762e5d49c7c73ce7a7b1d6e52114532cb3 100644 >--- a/Source/WebCore/rendering/RenderCombineText.cpp >+++ b/Source/WebCore/rendering/RenderCombineText.cpp >@@ -60,9 +60,6 @@ void RenderCombineText::setTextInternal(const String& text) > > float RenderCombineText::width(unsigned from, unsigned length, const Font& font, float xPosition, HashSet<const SimpleFontData*>* fallbackFonts, GlyphOverflow* glyphOverflow) const > { >- if (!deprecatedCharacters()) >- return 0; >- > if (m_isCombined) > return font.size(); > >diff --git a/Source/WebCore/rendering/RenderText.cpp b/Source/WebCore/rendering/RenderText.cpp >index 9f2e9372b61fa01f46b5951af89feffa7f3108ab..cdea9ff48e6959c91d782bada7af494f3a46db57 100644 >--- a/Source/WebCore/rendering/RenderText.cpp >+++ b/Source/WebCore/rendering/RenderText.cpp >@@ -624,15 +624,15 @@ static inline float hyphenWidth(RenderText* renderer, const Font& font) > return font.width(RenderBlock::constructTextRun(renderer, font, style.hyphenString().string(), style)); > } > >-static float maxWordFragmentWidth(RenderText* renderer, const RenderStyle& style, const Font& font, const UChar* word, int wordLength, int minimumPrefixLength, int minimumSuffixLength, int& suffixStart, HashSet<const SimpleFontData*>& fallbackFonts, GlyphOverflow& glyphOverflow) >+static float maxWordFragmentWidth(RenderText* renderer, const RenderStyle& style, const Font& font, StringView word, int minimumPrefixLength, unsigned minimumSuffixLength, int& suffixStart, HashSet<const SimpleFontData*>& fallbackFonts, GlyphOverflow& glyphOverflow) > { > suffixStart = 0; >- if (wordLength <= minimumSuffixLength) >+ if (word.length() <= minimumSuffixLength) > return 0; > > Vector<int, 8> hyphenLocations; >- int hyphenLocation = wordLength - minimumSuffixLength; >- while ((hyphenLocation = lastHyphenLocation(word, wordLength, hyphenLocation, style.locale())) >= minimumPrefixLength) >+ int hyphenLocation = word.length() - minimumSuffixLength; >+ while ((hyphenLocation = lastHyphenLocation(word, hyphenLocation, style.locale())) >= minimumPrefixLength) > hyphenLocations.append(hyphenLocation); > > if (hyphenLocations.isEmpty()) >@@ -645,7 +645,7 @@ static float maxWordFragmentWidth(RenderText* renderer, const RenderStyle& style > for (size_t k = 0; k < hyphenLocations.size(); ++k) { > int fragmentLength = hyphenLocations[k] - suffixStart; > StringBuilder fragmentWithHyphen; >- fragmentWithHyphen.append(word + suffixStart, fragmentLength); >+ fragmentWithHyphen.append(word.substring(suffixStart, fragmentLength)); > fragmentWithHyphen.append(style.hyphenString()); > > TextRun run = RenderBlock::constructTextRun(renderer, font, fragmentWithHyphen.deprecatedCharacters(), fragmentWithHyphen.length(), style); >@@ -797,7 +797,7 @@ void RenderText::computePreferredLogicalWidths(float leadWidth, HashSet<const Si > > if (w > maxWordWidth) { > int suffixStart; >- float maxFragmentWidth = maxWordFragmentWidth(this, style, font, deprecatedCharacters() + i, wordLen, minimumPrefixLength, minimumSuffixLength, suffixStart, fallbackFonts, glyphOverflow); >+ float maxFragmentWidth = maxWordFragmentWidth(this, style, font, StringView(m_text).substring(i, wordLen), minimumPrefixLength, minimumSuffixLength, suffixStart, fallbackFonts, glyphOverflow); > > if (suffixStart) { > float suffixWidth; >diff --git a/Source/WebCore/rendering/line/BreakingContextInlineHeaders.h b/Source/WebCore/rendering/line/BreakingContextInlineHeaders.h >index 9e89cdf977ecb511a5f9b092320db31e11e0f22a..24ae58829c66180098f8ae10f09c5327f7c302c9 100644 >--- a/Source/WebCore/rendering/line/BreakingContextInlineHeaders.h >+++ b/Source/WebCore/rendering/line/BreakingContextInlineHeaders.h >@@ -597,11 +597,11 @@ inline void tryHyphenating(RenderText* text, const Font& font, const AtomicStrin > if (prefixLength < minimumPrefixLength) > return; > >- prefixLength = lastHyphenLocation(text->deprecatedCharacters() + lastSpace, pos - lastSpace, std::min(prefixLength, pos - lastSpace - minimumSuffixLength) + 1, localeIdentifier); >+ prefixLength = lastHyphenLocation(StringView(text->text()).substring(lastSpace, pos - lastSpace), std::min(prefixLength, pos - lastSpace - minimumSuffixLength) + 1, localeIdentifier); > if (!prefixLength || prefixLength < minimumPrefixLength) > return; > >- // When lastSapce is a space, which it always is except sometimes at the beginning of a line or after collapsed >+ // When lastSpace is a space, which it always is except sometimes at the beginning of a line or after collapsed > // space, it should not count towards hyphenate-limit-before. > if (prefixLength == minimumPrefixLength) { > UChar characterAtLastSpace = text->characterAt(lastSpace); >diff --git a/Source/WebCore/rendering/svg/SVGTextLayoutEngine.cpp b/Source/WebCore/rendering/svg/SVGTextLayoutEngine.cpp >index a90da0cdeff1873ed77f94020649d80775f65cf7..4df29c4eaa5a32a8731f95bc4207bca921460479 100644 >--- a/Source/WebCore/rendering/svg/SVGTextLayoutEngine.cpp >+++ b/Source/WebCore/rendering/svg/SVGTextLayoutEngine.cpp >@@ -436,7 +436,8 @@ void SVGTextLayoutEngine::layoutTextOnLineOrPath(SVGInlineTextBox* textBox, Rend > Vector<SVGTextMetrics>& visualMetricsValues = text->layoutAttributes()->textMetricsValues(); > ASSERT(!visualMetricsValues.isEmpty()); > >- const UChar* characters = text->deprecatedCharacters(); >+ auto upconvertedCharacters = StringView(text->text()).upconvertedCharacters(); >+ const UChar* characters = upconvertedCharacters; > const Font& font = style->font(); > > SVGTextLayoutEngineSpacing spacingLayout(font); >diff --git a/Source/WebCore/rendering/svg/SVGTextMetrics.cpp b/Source/WebCore/rendering/svg/SVGTextMetrics.cpp >index 7b899e82f660c03609d77eca8afca5574ce61751..07573f34001ae91fd15c5371074123aa03a66303 100644 >--- a/Source/WebCore/rendering/svg/SVGTextMetrics.cpp >+++ b/Source/WebCore/rendering/svg/SVGTextMetrics.cpp >@@ -105,7 +105,7 @@ SVGTextMetrics::SVGTextMetrics(RenderSVGInlineText* text, unsigned position, uns > m_height = text->scaledFont().fontMetrics().floatHeight() / scalingFactor; > if (needsContext) { > m_glyph.isValid = true; >- m_glyph.unicodeString = String(text->deprecatedCharacters() + position, length); >+ m_glyph.unicodeString = text->text()->substring(position, length); > m_glyph.name = glyphName; > } > >diff --git a/Source/WebCore/svg/SVGAngle.cpp b/Source/WebCore/svg/SVGAngle.cpp >index 94e8fb2a674cd8697c7c68c30a6a6885b1cd4676..588f277be75de7d41efed05ca4958be62617857d 100644 >--- a/Source/WebCore/svg/SVGAngle.cpp >+++ b/Source/WebCore/svg/SVGAngle.cpp >@@ -25,7 +25,7 @@ > #include "ExceptionCode.h" > #include "SVGParserUtilities.h" > #include <wtf/MathExtras.h> >-#include <wtf/text/WTFString.h> >+#include <wtf/text/StringView.h> > > namespace WebCore { > >@@ -140,7 +140,8 @@ void SVGAngle::setValueAsString(const String& value, ExceptionCode& ec) > } > > float valueInSpecifiedUnits = 0; >- const UChar* ptr = value.deprecatedCharacters(); >+ auto upconvertedCharacters = StringView(value).upconvertedCharacters(); >+ const UChar* ptr = upconvertedCharacters; > const UChar* end = ptr + value.length(); > > if (!parseNumber(ptr, end, valueInSpecifiedUnits, false)) { >diff --git a/Source/WebCore/svg/SVGAnimateMotionElement.cpp b/Source/WebCore/svg/SVGAnimateMotionElement.cpp >index b979a75035c35298241bc2c132d971f6218b43e5..bf1c757db97c736c610b879922f3f5f88a8d0a5b 100644 >--- a/Source/WebCore/svg/SVGAnimateMotionElement.cpp >+++ b/Source/WebCore/svg/SVGAnimateMotionElement.cpp >@@ -38,6 +38,7 @@ > #include "SVGTransformList.h" > #include <wtf/MathExtras.h> > #include <wtf/StdLibExtras.h> >+#include <wtf/text/StringView.h> > > namespace WebCore { > >@@ -156,7 +157,8 @@ static bool parsePoint(const String& s, FloatPoint& point) > { > if (s.isEmpty()) > return false; >- const UChar* cur = s.deprecatedCharacters(); >+ auto upconvertedCharacters = StringView(s).upconvertedCharacters(); >+ const UChar* cur = upconvertedCharacters; > const UChar* end = cur + s.length(); > > if (!skipOptionalSVGSpaces(cur, end)) >diff --git a/Source/WebCore/svg/SVGAnimationElement.cpp b/Source/WebCore/svg/SVGAnimationElement.cpp >index ce91f1bd83457acbfbec3fc010d5c69d098faa57..a52d2cc8948ec78e21d905f1b4a0e271a1968e10 100644 >--- a/Source/WebCore/svg/SVGAnimationElement.cpp >+++ b/Source/WebCore/svg/SVGAnimationElement.cpp >@@ -38,6 +38,7 @@ > #include "SVGNames.h" > #include "SVGParserUtilities.h" > #include <wtf/MathExtras.h> >+#include <wtf/text/StringView.h> > > namespace WebCore { > >@@ -92,7 +93,9 @@ static void parseKeySplines(const String& parse, Vector<UnitBezier>& result) > result.clear(); > if (parse.isEmpty()) > return; >- const UChar* cur = parse.deprecatedCharacters(); >+ >+ auto upconvertedCharacters = StringView(parse).upconvertedCharacters(); >+ const UChar* cur = upconvertedCharacters; > const UChar* end = cur + parse.length(); > > skipOptionalSVGSpaces(cur, end); >diff --git a/Source/WebCore/svg/SVGFitToViewBox.cpp b/Source/WebCore/svg/SVGFitToViewBox.cpp >index a51aaf2c7ea703b40505bda6779636bb2b8b7c8a..e30e27065f7ed6f38b1b0171a2d5ce49e1fce7ab 100644 >--- a/Source/WebCore/svg/SVGFitToViewBox.cpp >+++ b/Source/WebCore/svg/SVGFitToViewBox.cpp >@@ -29,15 +29,15 @@ > #include "SVGNames.h" > #include "SVGParserUtilities.h" > #include "SVGPreserveAspectRatio.h" >-#include <wtf/text/StringImpl.h> >+#include <wtf/text/StringView.h> > > namespace WebCore { > > bool SVGFitToViewBox::parseViewBox(Document* doc, const String& s, FloatRect& viewBox) > { >- const UChar* c = s.deprecatedCharacters(); >- const UChar* end = c + s.length(); >- return parseViewBox(doc, c, end, viewBox, true); >+ auto upconvertedCharacters = StringView(s).upconvertedCharacters(); >+ const UChar* characters = upconvertedCharacters; >+ return parseViewBox(doc, characters, characters + s.length(), viewBox, true); > } > > bool SVGFitToViewBox::parseViewBox(Document* doc, const UChar*& c, const UChar* end, FloatRect& viewBox, bool validate) >diff --git a/Source/WebCore/svg/SVGFontData.cpp b/Source/WebCore/svg/SVGFontData.cpp >index 191ff80dee4c17406482ec6e33afc21ee1ad43c8..80710ce6cfcc58abb6ddb1f91e3fd4d22e42c0dc 100644 >--- a/Source/WebCore/svg/SVGFontData.cpp >+++ b/Source/WebCore/svg/SVGFontData.cpp >@@ -41,6 +41,8 @@ using namespace Unicode; > > namespace WebCore { > >+static String createStringWithMirroredCharacters(StringView); >+ > SVGFontData::SVGFontData(SVGFontFaceElement* fontFaceElement) > : m_svgFontFaceElement(fontFaceElement) > , m_horizontalOriginX(fontFaceElement->horizontalOriginX()) >@@ -146,7 +148,7 @@ bool SVGFontData::applySVGGlyphSelection(WidthIterator& iterator, GlyphData& gly > } > > if (mirror) >- remainingTextInRun = createStringWithMirroredCharacters(remainingTextInRun.deprecatedCharacters(), remainingTextInRun.length()); >+ remainingTextInRun = createStringWithMirroredCharacters(remainingTextInRun); > if (!currentCharacter && arabicForms.isEmpty()) > arabicForms = charactersWithArabicForm(remainingTextInRun, mirror); > >@@ -287,18 +289,16 @@ bool SVGFontData::fillNonBMPGlyphs(SVGFontElement* fontElement, GlyphPage* pageT > return haveGlyphs; > } > >-String SVGFontData::createStringWithMirroredCharacters(const UChar* characters, unsigned length) const >+String createStringWithMirroredCharacters(StringView string) > { >+ unsigned length = string.length(); > StringBuilder mirroredCharacters; > mirroredCharacters.reserveCapacity(length); >- >- unsigned i = 0; >- while (i < length) { >+ for (unsigned i = 0; i < length; ) { > UChar32 character; >- U16_NEXT(characters, i, length, character); >+ U16_NEXT(string, i, length, character); > mirroredCharacters.append(u_charMirror(character)); > } >- > return mirroredCharacters.toString(); > } > >diff --git a/Source/WebCore/svg/SVGFontData.h b/Source/WebCore/svg/SVGFontData.h >index 3fb967cf0c5e3a2ae33703f04059a8e7c255d14d..72728a17aa44b396cd04124b512492380cf22439 100644 >--- a/Source/WebCore/svg/SVGFontData.h >+++ b/Source/WebCore/svg/SVGFontData.h >@@ -52,8 +52,6 @@ private: > bool fillBMPGlyphs(SVGFontElement*, GlyphPage* , unsigned offset, unsigned length, UChar* buffer, const SimpleFontData*) const; > bool fillNonBMPGlyphs(SVGFontElement*, GlyphPage* , unsigned offset, unsigned length, UChar* buffer, const SimpleFontData*) const; > >- String createStringWithMirroredCharacters(const UChar* characters, unsigned length) const; >- > // Ths SVGFontFaceElement is kept alive -- > // 1) in the external font case: by the CSSFontFaceSource, which holds a reference to the external SVG document > // containing the element; >diff --git a/Source/WebCore/svg/SVGFontElement.cpp b/Source/WebCore/svg/SVGFontElement.cpp >index c0355239f043118e0f590d42cf932d751a032400..a20a6569224434f33e08c9e796399e9124ab2877 100644 >--- a/Source/WebCore/svg/SVGFontElement.cpp >+++ b/Source/WebCore/svg/SVGFontElement.cpp >@@ -94,9 +94,9 @@ void SVGFontElement::registerLigaturesInGlyphCache(Vector<String>& ligatures) > unsigned unicodeLength = unicode.length(); > ASSERT(unicodeLength > 1); > >- const UChar* characters = unicode.deprecatedCharacters(); > for (unsigned i = 0; i < unicodeLength; ++i) { >- String lookupString(characters + i, 1); >+ UChar character = unicode[i]; >+ String lookupString(&character, 1); > m_glyphMap.collectGlyphsForString(lookupString, glyphs); > if (!glyphs.isEmpty()) { > glyphs.clear(); >diff --git a/Source/WebCore/svg/SVGGlyphMap.h b/Source/WebCore/svg/SVGGlyphMap.h >index 00f87a58ce080505be2995db77c13d8e8c5fb66a..3518f88d8a66197404a2304292dd14bb77254daf 100644 >--- a/Source/WebCore/svg/SVGGlyphMap.h >+++ b/Source/WebCore/svg/SVGGlyphMap.h >@@ -21,11 +21,12 @@ > #define SVGGlyphMap_h > > #if ENABLE(SVG_FONTS) >+ > #include "SurrogatePairAwareTextIterator.h" > #include "SVGGlyph.h" >- > #include <wtf/HashMap.h> > #include <wtf/Vector.h> >+#include <wtf/text/StringView.h> > > namespace WebCore { > >@@ -68,7 +69,8 @@ public: > > UChar32 character = 0; > unsigned clusterLength = 0; >- SurrogatePairAwareTextIterator textIterator(unicodeString.deprecatedCharacters(), 0, length, length); >+ auto upconvertedCharacters = StringView(unicodeString).upconvertedCharacters(); >+ SurrogatePairAwareTextIterator textIterator(upconvertedCharacters, 0, length, length); > while (textIterator.consume(character, clusterLength)) { > node = currentLayer->get(character); > if (!node) { >@@ -113,12 +115,12 @@ public: > { > GlyphMapLayer* currentLayer = &m_rootLayer; > >- const UChar* characters = string.deprecatedCharacters(); >+ auto upconvertedCharacters = StringView(string).upconvertedCharacters(); > size_t length = string.length(); > > UChar32 character = 0; > unsigned clusterLength = 0; >- SurrogatePairAwareTextIterator textIterator(characters, 0, length, length); >+ SurrogatePairAwareTextIterator textIterator(upconvertedCharacters, 0, length, length); > while (textIterator.consume(character, clusterLength)) { > RefPtr<GlyphMapNode> node = currentLayer->get(character); > if (!node) >diff --git a/Source/WebCore/svg/SVGGlyphRefElement.cpp b/Source/WebCore/svg/SVGGlyphRefElement.cpp >index 218dcd9fd073fe652e6120ae2f747b2e3afe9fbb..9caa1b85ca9bb50716e1d8bbcccbeb53270b1428 100644 >--- a/Source/WebCore/svg/SVGGlyphRefElement.cpp >+++ b/Source/WebCore/svg/SVGGlyphRefElement.cpp >@@ -27,6 +27,7 @@ > #include "SVGParserUtilities.h" > #include "XLinkNames.h" > #include <wtf/text/AtomicString.h> >+#include <wtf/text/StringView.h> > > namespace WebCore { > >@@ -66,7 +67,8 @@ bool SVGGlyphRefElement::hasValidGlyphElement(String& glyphName) const > > void SVGGlyphRefElement::parseAttribute(const QualifiedName& name, const AtomicString& value) > { >- const UChar* startPtr = value.string().deprecatedCharacters(); >+ auto upconvertedCharacters = StringView(value.string()).upconvertedCharacters(); >+ const UChar* startPtr = upconvertedCharacters; > const UChar* endPtr = startPtr + value.length(); > > // FIXME: We need some error handling here. >diff --git a/Source/WebCore/svg/SVGLength.cpp b/Source/WebCore/svg/SVGLength.cpp >index 3cf2d24a431cd5bc6006727cec6452f665e87205..bafd276ff73b4058b1e62eb80d767df076eb4592 100644 >--- a/Source/WebCore/svg/SVGLength.cpp >+++ b/Source/WebCore/svg/SVGLength.cpp >@@ -29,9 +29,8 @@ > #include "FloatConversion.h" > #include "SVGNames.h" > #include "SVGParserUtilities.h" >- > #include <wtf/MathExtras.h> >-#include <wtf/text/WTFString.h> >+#include <wtf/text/StringView.h> > > namespace WebCore { > >@@ -224,7 +223,8 @@ void SVGLength::setValueAsString(const String& string, ExceptionCode& ec) > return; > > float convertedNumber = 0; >- const UChar* ptr = string.deprecatedCharacters(); >+ auto upconvertedCharacters = StringView(string).upconvertedCharacters(); >+ const UChar* ptr = upconvertedCharacters; > const UChar* end = ptr + string.length(); > > if (!parseNumber(ptr, end, convertedNumber, false)) { >diff --git a/Source/WebCore/svg/SVGLengthList.cpp b/Source/WebCore/svg/SVGLengthList.cpp >index 2ba0b556e2e5c493b60668822f7f1c6094d947e0..9a00ebf4358e9e256661d0fddcb6df2a2112a25e 100644 >--- a/Source/WebCore/svg/SVGLengthList.cpp >+++ b/Source/WebCore/svg/SVGLengthList.cpp >@@ -31,7 +31,8 @@ void SVGLengthList::parse(const String& value, SVGLengthMode mode) > clear(); > ExceptionCode ec = 0; > >- const UChar* ptr = value.deprecatedCharacters(); >+ auto upconvertedCharacters = StringView(value).upconvertedCharacters(); >+ const UChar* ptr = upconvertedCharacters; > const UChar* end = ptr + value.length(); > while (ptr < end) { > const UChar* start = ptr; >diff --git a/Source/WebCore/svg/SVGNumberList.cpp b/Source/WebCore/svg/SVGNumberList.cpp >index fd6aebb07317b603fc6125bf9472cfd4062fe109..3c02c1e886390a0cc1ce27690c4a3167fe212bfa 100644 >--- a/Source/WebCore/svg/SVGNumberList.cpp >+++ b/Source/WebCore/svg/SVGNumberList.cpp >@@ -31,7 +31,8 @@ void SVGNumberList::parse(const String& value) > clear(); > > float number = 0; >- const UChar* ptr = value.deprecatedCharacters(); >+ auto upconvertedCharacters = StringView(value).upconvertedCharacters(); >+ const UChar* ptr = upconvertedCharacters; > const UChar* end = ptr + value.length(); > > // The spec strangely doesn't allow leading whitespace. We might choose to violate that intentionally. (section 4.1) >diff --git a/Source/WebCore/svg/SVGParserUtilities.cpp b/Source/WebCore/svg/SVGParserUtilities.cpp >index aad331344bf0954577c6f41765edfad6c94a046a..a8ba29a423a0b45c03444fbe40f605fd106891e6 100644 >--- a/Source/WebCore/svg/SVGParserUtilities.cpp >+++ b/Source/WebCore/svg/SVGParserUtilities.cpp >@@ -26,9 +26,9 @@ > #include "Document.h" > #include "FloatRect.h" > #include "SVGPointList.h" >- > #include <limits> > #include <wtf/ASCIICType.h> >+#include <wtf/text/STringView.h> > > namespace WebCore { > >@@ -164,7 +164,8 @@ bool parseNumber(const UChar*& ptr, const UChar* end, float& number, bool skip) > > bool parseNumberFromString(const String& string, float& number, bool skip) > { >- const UChar* ptr = string.deprecatedCharacters(); >+ auto upconvertedCharacters = StringView(string).upconvertedCharacters(); >+ const UChar* ptr = upconvertedCharacters; > const UChar* end = ptr + string.length(); > return genericParseNumber(ptr, end, number, skip) && ptr == end; > } >@@ -203,7 +204,9 @@ bool parseNumberOptionalNumber(const String& s, float& x, float& y) > { > if (s.isEmpty()) > return false; >- const UChar* cur = s.deprecatedCharacters(); >+ >+ auto upconvertedCharacters = StringView(s).upconvertedCharacters(); >+ const UChar* cur = upconvertedCharacters; > const UChar* end = cur + s.length(); > > if (!parseNumber(cur, end, x)) >@@ -219,7 +222,8 @@ bool parseNumberOptionalNumber(const String& s, float& x, float& y) > > bool parseRect(const String& string, FloatRect& rect) > { >- const UChar* ptr = string.deprecatedCharacters(); >+ auto upconvertedCharacters = StringView(string).upconvertedCharacters(); >+ const UChar* ptr = upconvertedCharacters; > const UChar* end = ptr + string.length(); > skipOptionalSVGSpaces(ptr, end); > >@@ -236,7 +240,8 @@ bool pointsListFromSVGData(SVGPointList& pointsList, const String& points) > { > if (points.isEmpty()) > return true; >- const UChar* cur = points.deprecatedCharacters(); >+ auto upconvertedCharacters = StringView(points).upconvertedCharacters(); >+ const UChar* cur = upconvertedCharacters; > const UChar* end = cur + points.length(); > > skipOptionalSVGSpaces(cur, end); >@@ -270,7 +275,8 @@ bool parseGlyphName(const String& input, HashSet<String>& values) > // FIXME: Parsing error detection is missing. > values.clear(); > >- const UChar* ptr = input.deprecatedCharacters(); >+ auto upconvertedCharacters = StringView(input).upconvertedCharacters(); >+ const UChar* ptr = upconvertedCharacters; > const UChar* end = ptr + input.length(); > skipOptionalSVGSpaces(ptr, end); > >@@ -367,7 +373,8 @@ static bool parseUnicodeRange(const UChar* characters, unsigned length, UnicodeR > bool parseKerningUnicodeString(const String& input, UnicodeRanges& rangeList, HashSet<String>& stringList) > { > // FIXME: Parsing error detection is missing. >- const UChar* ptr = input.deprecatedCharacters(); >+ auto upconvertedCharacters = StringView(input).upconvertedCharacters(); >+ const UChar* ptr = upconvertedCharacters; > const UChar* end = ptr + input.length(); > > while (ptr < end) { >@@ -394,7 +401,8 @@ Vector<String> parseDelimitedString(const String& input, const char seperator) > { > Vector<String> values; > >- const UChar* ptr = input.deprecatedCharacters(); >+ auto upconvertedCharacters = StringView(input).upconvertedCharacters(); >+ const UChar* ptr = upconvertedCharacters; > const UChar* end = ptr + input.length(); > skipOptionalSVGSpaces(ptr, end); > >diff --git a/Source/WebCore/svg/SVGPreserveAspectRatio.cpp b/Source/WebCore/svg/SVGPreserveAspectRatio.cpp >index 66dd69c90254b2b0b44b87b5b0b39b192d890a50..15b97c2c91422a6448dd8f2fa2ebd13cb22b784f 100644 >--- a/Source/WebCore/svg/SVGPreserveAspectRatio.cpp >+++ b/Source/WebCore/svg/SVGPreserveAspectRatio.cpp >@@ -26,7 +26,7 @@ > #include "ExceptionCode.h" > #include "FloatRect.h" > #include "SVGParserUtilities.h" >-#include <wtf/text/WTFString.h> >+#include <wtf/text/StringView.h> > > namespace WebCore { > >@@ -58,7 +58,8 @@ void SVGPreserveAspectRatio::setMeetOrSlice(unsigned short meetOrSlice, Exceptio > > void SVGPreserveAspectRatio::parse(const String& value) > { >- const UChar* begin = value.deprecatedCharacters(); >+ auto upconvertedCharacters = StringView(value).upconvertedCharacters(); >+ const UChar* begin = upconvertedCharacters; > parseInternal(begin, begin + value.length(), true); > } > >diff --git a/Source/WebCore/svg/SVGStringList.cpp b/Source/WebCore/svg/SVGStringList.cpp >index 694eb39927a6fdf9d0853e889880d7b1ca898a0b..a118ae72668cf7c3e750dd35f2e7dfeeb326ec0e 100644 >--- a/Source/WebCore/svg/SVGStringList.cpp >+++ b/Source/WebCore/svg/SVGStringList.cpp >@@ -48,7 +48,8 @@ void SVGStringList::parse(const String& data, UChar delimiter) > // TODO : more error checking/reporting > clear(); > >- const UChar* ptr = data.deprecatedCharacters(); >+ auto upconvertedCharacters = StringView(data).upconvertedCharacters(); >+ const UChar* ptr = upconvertedCharacters; > const UChar* end = ptr + data.length(); > while (ptr < end) { > const UChar* start = ptr; >diff --git a/Source/WebCore/svg/SVGTransformList.cpp b/Source/WebCore/svg/SVGTransformList.cpp >index e3ee718e1de71f980644e1dda5b82087df88e501..11e624dd91c2b28847240a837e7d6ec381924e72 100644 >--- a/Source/WebCore/svg/SVGTransformList.cpp >+++ b/Source/WebCore/svg/SVGTransformList.cpp >@@ -74,7 +74,8 @@ String SVGTransformList::valueAsString() const > > void SVGTransformList::parse(const String& transform) > { >- const UChar* start = transform.deprecatedCharacters(); >+ auto upconvertedCharacters = StringView(transform).upconvertedCharacters(); >+ const UChar* start = upconvertedCharacters; > if (!SVGTransformable::parseTransformAttribute(*this, start, start + transform.length())) > clear(); > } >diff --git a/Source/WebCore/svg/SVGTransformable.cpp b/Source/WebCore/svg/SVGTransformable.cpp >index a1129d586c6381af049ab76ecb599da3f0452c39..4e156c62289c1523c211eaaa449040e562835eee 100644 >--- a/Source/WebCore/svg/SVGTransformable.cpp >+++ b/Source/WebCore/svg/SVGTransformable.cpp >@@ -28,6 +28,7 @@ > #include "SVGNames.h" > #include "SVGParserUtilities.h" > #include "SVGTransformList.h" >+#include <wtf/text/StringView.h> > > namespace WebCore { > >@@ -171,7 +172,8 @@ static inline bool parseAndSkipType(const UChar*& currTransform, const UChar* en > SVGTransform::SVGTransformType SVGTransformable::parseTransformType(const String& typeString) > { > unsigned short type = SVGTransform::SVG_TRANSFORM_UNKNOWN; >- const UChar* characters = typeString.deprecatedCharacters(); >+ auto upconvertedCharacters = StringView(typeString).upconvertedCharacters(); >+ const UChar* characters = upconvertedCharacters; > parseAndSkipType(characters, characters + typeString.length(), type); > return static_cast<SVGTransform::SVGTransformType>(type); > } >diff --git a/Source/WebCore/svg/SVGViewSpec.cpp b/Source/WebCore/svg/SVGViewSpec.cpp >index 2985ab1d16f45bf95ad72205df47618e3f8405a5..9822bd1dfba76ca6880a5224a5b67a60a5aa2478 100644 >--- a/Source/WebCore/svg/SVGViewSpec.cpp >+++ b/Source/WebCore/svg/SVGViewSpec.cpp >@@ -207,7 +207,8 @@ static const UChar viewTargetSpec[] = {'v', 'i', 'e', 'w', 'T', 'a', 'r', 'g', > > bool SVGViewSpec::parseViewSpec(const String& viewSpec) > { >- const UChar* currViewSpec = viewSpec.deprecatedCharacters(); >+ auto upconvertedCharacters = StringView(viewSpec).upconvertedCharacters(); >+ const UChar* currViewSpec = upconvertedCharacters; > const UChar* end = currViewSpec + viewSpec.length(); > > if (currViewSpec >= end || !m_contextElement) >diff --git a/Source/WebCore/svg/SVGZoomAndPan.h b/Source/WebCore/svg/SVGZoomAndPan.h >index 4429728b9f7967253debfcc4b837e6f16a754ae2..490ba9ab4e7eb14ee1a660f6579d7c8d24862a8b 100644 >--- a/Source/WebCore/svg/SVGZoomAndPan.h >+++ b/Source/WebCore/svg/SVGZoomAndPan.h >@@ -24,6 +24,7 @@ > #include "QualifiedName.h" > #include "SVGNames.h" > #include <wtf/HashSet.h> >+#include <wtf/text/StringView.h> > > namespace WebCore { > >@@ -59,7 +60,8 @@ public: > { > ASSERT(target); > if (name == SVGNames::zoomAndPanAttr) { >- const UChar* start = value.string().deprecatedCharacters(); >+ auto upconvertedCharacters = StringView(value.string()).upconvertedCharacters(); >+ const UChar* start = upconvertedCharacters; > const UChar* end = start + value.length(); > SVGZoomAndPanType zoomAndPan = SVGZoomAndPanUnknown; > parseZoomAndPan(start, end, zoomAndPan); >diff --git a/Source/WebCore/xml/XMLHttpRequest.cpp b/Source/WebCore/xml/XMLHttpRequest.cpp >index e3de46d71459d911e797aff3faf3a65d55a534bb..b6eab758e754d19411085320ca3d73500bf82ad0 100644 >--- a/Source/WebCore/xml/XMLHttpRequest.cpp >+++ b/Source/WebCore/xml/XMLHttpRequest.cpp >@@ -619,7 +619,7 @@ void XMLHttpRequest::send(Document* document, ExceptionCode& ec) > > // FIXME: this should use value of document.inputEncoding to determine the encoding to use. > TextEncoding encoding = UTF8Encoding(); >- m_requestEntityBody = FormData::create(encoding.encode(body.deprecatedCharacters(), body.length(), EntitiesForUnencodables)); >+ m_requestEntityBody = FormData::create(encoding.encode(body, EntitiesForUnencodables)); > if (m_upload) > m_requestEntityBody->setAlwaysStream(true); > } >@@ -646,7 +646,7 @@ void XMLHttpRequest::send(const String& body, ExceptionCode& ec) > m_requestHeaders.set("Content-Type", contentType); > } > >- m_requestEntityBody = FormData::create(UTF8Encoding().encode(body.deprecatedCharacters(), body.length(), EntitiesForUnencodables)); >+ m_requestEntityBody = FormData::create(UTF8Encoding().encode(body, EntitiesForUnencodables)); > if (m_upload) > m_requestEntityBody->setAlwaysStream(true); > } >diff --git a/Source/WebCore/xml/XSLStyleSheetLibxslt.cpp b/Source/WebCore/xml/XSLStyleSheetLibxslt.cpp >index 1192bf030242a56a0460bb9c71e803ea478dfaba..7a17fbd47551a21060a82c6026173a70823ba86b 100644 >--- a/Source/WebCore/xml/XSLStyleSheetLibxslt.cpp >+++ b/Source/WebCore/xml/XSLStyleSheetLibxslt.cpp >@@ -33,7 +33,6 @@ > #include "XMLDocumentParserScope.h" > #include "XSLImportRule.h" > #include "XSLTProcessor.h" >- > #include <libxml/uri.h> > #include <libxslt/xsltutils.h> > >@@ -148,7 +147,8 @@ bool XSLStyleSheet::parseString(const String& string) > > XMLDocumentParserScope scope(cachedResourceLoader(), XSLTProcessor::genericErrorFunc, XSLTProcessor::parseErrorFunc, console); > >- const char* buffer = reinterpret_cast<const char*>(string.deprecatedCharacters()); >+ auto upconvertedCharacters = StringView(string).upconvertedCharacters(); >+ const char* buffer = reinterpret_cast<const char*>(upconvertedCharacters.get()); > int size = string.length() * sizeof(UChar); > > xmlParserCtxtPtr ctxt = xmlCreateMemoryParserCtxt(buffer, size);
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 130318
:
226889
|
226927
|
226928
|
226929
|
226944
|
226949
|
226954
|
226964
|
227007
|
227047
|
227048
|
227058