WebKit Bugzilla
Attachment 362593 Details for
Bug 194893
: Finish removing String::format
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-194893-20190220215723.patch (text/plain), 44.50 KB, created by
Darin Adler
on 2019-02-20 21:57:24 PST
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Darin Adler
Created:
2019-02-20 21:57:24 PST
Size:
44.50 KB
patch
obsolete
>Subversion Revision: 241860 >diff --git a/Source/JavaScriptCore/ChangeLog b/Source/JavaScriptCore/ChangeLog >index d47fd8b099adb295d9a983cc5c5dec6e6d43b321..41945552f725a43979f1d7992b488be477247e0e 100644 >--- a/Source/JavaScriptCore/ChangeLog >+++ b/Source/JavaScriptCore/ChangeLog >@@ -1,3 +1,14 @@ >+2019-02-20 Darin Adler <darin@apple.com> >+ >+ Finish removing String::format >+ https://bugs.webkit.org/show_bug.cgi?id=194893 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * bytecode/CodeBlock.cpp: >+ (JSC::CodeBlock::nameForRegister): Use makeString instead of String::format, >+ using the new "pad" function. >+ > 2019-02-20 Mark Lam <mark.lam@apple.com> > > Add code to validate expected GC activity modelled by doesGC() against what the runtime encounters. >diff --git a/Source/WTF/ChangeLog b/Source/WTF/ChangeLog >index 3020dcfb0ad65e1e7cf03f3c7f197f95f5c311e8..875aaf7310eeeab066e9c0547123e74f948a822d 100644 >--- a/Source/WTF/ChangeLog >+++ b/Source/WTF/ChangeLog >@@ -1,3 +1,37 @@ >+2019-02-20 Darin Adler <darin@apple.com> >+ >+ Finish removing String::format >+ https://bugs.webkit.org/show_bug.cgi?id=194893 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * wtf/Assertions.cpp: >+ (WTF::createWithFormatAndArguments): Moved this here from WTFString.cpp. >+ (WTFLog): Use WTF::createWithFormatAndArguments instead of String::format. >+ >+ * wtf/HexNumber.h: Deleted unneeded toString function. >+ >+ * wtf/text/StringConcatenate.h: Got rid of unneeded forward declaration of >+ StringTypeAdapter, since that's now in Forward.h. Tweaked formatting of templates >+ a bit. Use function templates for writeTo functions rather than having two of each. >+ Removed unused toString functions. Optimized case where we use have a UChar* and >+ a length of zero to not force the result to be 16-bit. Also gets rid of a small >+ NO_RETURN_DUE_TO_CRASH mess that we don't need. Refactored constructors to use some >+ static member helper functions to compute string lengths. Added the pad function >+ and the PaddingSpecification struct template, so we can add padding to anything >+ we can turn into a string. Got rid of the special case overload for single >+ arguments, since it only worked for things that the String constructor can handle. >+ Instead we will now use StringTypeAdapter, which works for more types. Possibly >+ less optimal for some special cases, which we could specialize for later if we like. >+ * wtf/text/StringConcatenateNumbers.h: Ditto. >+ * wtf/text/StringOperators.h: Ditto. >+ * wtf/text/StringView.h: Ditto. >+ >+ * wtf/text/WTFString.cpp: >+ (WTF::createWithFormatAndArguments): Deleted. >+ (WTF::String::format): Deleted. >+ * wtf/text/WTFString.h: Deleted declaration of String::format. >+ > 2019-02-20 Alex Christensen <achristensen@webkit.org> > > URL percent-encode operations should use checked arithmetic for buffer allocation length >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 26277ea5e6422ed0ab34dfff421fa7cbc3266123..11bb949a9b787f4b61af54a3235203fe88d5fad4 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,38 @@ >+2019-02-20 Darin Adler <darin@apple.com> >+ >+ Finish removing String::format >+ https://bugs.webkit.org/show_bug.cgi?id=194893 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * dom/Document.cpp: >+ (WebCore::Document::lastModified const): Use makeString and pad. >+ * html/FTPDirectoryDocument.cpp: >+ (WebCore::processFileDateString): Ditto. >+ * page/cocoa/ResourceUsageOverlayCocoa.mm: >+ (WebCore::ResourceUsageOverlay::platformDraw): Ditto. >+ >+ * page/linux/ResourceUsageOverlayLinux.cpp: >+ (WebCore::cpuUsageString): Use makeString, FormatttedNumber, and pad. >+ (WebCore::gcTimerString): Use String::number. >+ >+ * platform/DateComponents.cpp: >+ (WebCore::DateComponents::toStringForTime const): Use makeString and pad. >+ (WebCore::DateComponents::toString const): Ditto. >+ >+ * platform/LocalizedStrings.cpp: Removed comment that mentioned String::format, >+ and that was also inaccurate. >+ >+ * platform/audio/HRTFElevation.cpp: >+ (WebCore::HRTFElevation::calculateKernelsForAzimuthElevation): >+ Use makeString and pad. >+ * platform/mock/MockRealtimeVideoSource.cpp: >+ (WebCore::MockRealtimeVideoSource::drawText): Ditto. >+ * rendering/RenderLayerCompositor.cpp: >+ (WebCore::RenderLayerCompositor::logLayerInfo): Ditto. >+ * rendering/RenderTheme.cpp: >+ (WebCore::RenderTheme::formatMediaControlsTime const): Ditto. >+ > 2019-02-20 Simon Fraser <simon.fraser@apple.com> > > REGRESSION (240698): Fixed position banners flicker and move when scrolling on iOS >diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog >index 92c66d4dcfaaa152ea88c3d785a6c4eecb9b0e8e..687923bfe5c3fa11b4fedebecfd51bb7aff6b260 100644 >--- a/Source/WebKit/ChangeLog >+++ b/Source/WebKit/ChangeLog >@@ -1,3 +1,14 @@ >+2019-02-20 Darin Adler <darin@apple.com> >+ >+ Finish removing String::format >+ https://bugs.webkit.org/show_bug.cgi?id=194893 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.mm: >+ (WebKit::LocalAuthenticator::getAssertion): Use makeString, attempting to fix >+ a problem where we passed an NSData * to format with a "%s"." >+ > 2019-02-20 Antti Koivisto <antti@apple.com> > > Make programmatic frame scrolling work on iOS >diff --git a/Source/WebKitLegacy/win/ChangeLog b/Source/WebKitLegacy/win/ChangeLog >index 3b78c276680c2a956e3b56c9c64fc573dbd938f7..a2be9f9f84e625fc5e8d2ec87117e3747c49c84f 100644 >--- a/Source/WebKitLegacy/win/ChangeLog >+++ b/Source/WebKitLegacy/win/ChangeLog >@@ -1,3 +1,13 @@ >+2019-02-20 Darin Adler <darin@apple.com> >+ >+ Finish removing String::format >+ https://bugs.webkit.org/show_bug.cgi?id=194893 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * FullscreenVideoController.cpp: >+ (timeToString): Use makeString and pad. >+ > 2019-02-18 Wenson Hsieh <wenson_hsieh@apple.com> > > [iOS] Support pasting item-provider-backed data on the pasteboard as attachment elements >diff --git a/Source/JavaScriptCore/bytecode/CodeBlock.cpp b/Source/JavaScriptCore/bytecode/CodeBlock.cpp >index 23527e4bb113ebd1227aad2ddf25280fe0ec5cb8..ae7e81341d142b74ba27a8f65ad8da88c253162e 100644 >--- a/Source/JavaScriptCore/bytecode/CodeBlock.cpp >+++ b/Source/JavaScriptCore/bytecode/CodeBlock.cpp >@@ -92,6 +92,7 @@ > #include <wtf/Forward.h> > #include <wtf/SimpleStats.h> > #include <wtf/StringPrintStream.h> >+#include <wtf/text/StringConcatenateNumbers.h> > #include <wtf/text/UniquedStringImpl.h> > > #if ENABLE(ASSEMBLER) >@@ -2888,9 +2889,9 @@ String CodeBlock::nameForRegister(VirtualRegister virtualRegister) > if (virtualRegister == thisRegister()) > return "this"_s; > if (virtualRegister.isArgument()) >- return String::format("arguments[%3d]", virtualRegister.toArgument()); >+ return makeString("arguments[", pad(' ', 3, virtualRegister.toArgument()), ']'); > >- return ""; >+ return emptyString(); > } > > ValueProfile* CodeBlock::tryGetValueProfileForBytecodeOffset(int bytecodeOffset) >diff --git a/Source/WTF/wtf/Assertions.cpp b/Source/WTF/wtf/Assertions.cpp >index a6e79b3a37ddabcf485d9a3650bca4e8a7bbd02f..75364c5e0509fa018852470f90ac5248a59a65b2 100644 >--- a/Source/WTF/wtf/Assertions.cpp >+++ b/Source/WTF/wtf/Assertions.cpp >@@ -74,6 +74,56 @@ > #include <unistd.h> > #endif > >+namespace WTF { >+ >+WTF_ATTRIBUTE_PRINTF(1, 0) static String createWithFormatAndArguments(const char* format, va_list args) >+{ >+ va_list argsCopy; >+ va_copy(argsCopy, args); >+ >+ ALLOW_NONLITERAL_FORMAT_BEGIN >+ >+#if USE(CF) && !OS(WINDOWS) >+ if (strstr(format, "%@")) { >+ auto cfFormat = adoptCF(CFStringCreateWithCString(kCFAllocatorDefault, format, kCFStringEncodingUTF8)); >+ auto result = adoptCF(CFStringCreateWithFormatAndArguments(kCFAllocatorDefault, nullptr, cfFormat.get(), args)); >+ va_end(argsCopy); >+ return result.get(); >+ } >+#endif >+ >+ // Do the format once to get the length. >+#if COMPILER(MSVC) >+ int result = _vscprintf(format, args); >+#else >+ char ch; >+ int result = vsnprintf(&ch, 1, format, args); >+#endif >+ >+ if (!result) { >+ va_end(argsCopy); >+ return emptyString(); >+ } >+ if (result < 0) { >+ va_end(argsCopy); >+ return String(); >+ } >+ >+ Vector<char, 256> buffer; >+ unsigned len = result; >+ buffer.grow(len + 1); >+ >+ // Now do the formatting again, guaranteed to fit. >+ vsnprintf(buffer.data(), buffer.size(), format, argsCopy); >+ va_end(argsCopy); >+ >+ ALLOW_NONLITERAL_FORMAT_END >+ >+ return StringImpl::create(reinterpret_cast<const LChar*>(buffer.data()), len); >+} >+ >+} >+ > extern "C" { > > static void logToStderr(const char* buffer) >@@ -399,7 +449,7 @@ void WTFLog(WTFLogChannel* channel, const char* format, ...) > va_start(args, format); > > ALLOW_NONLITERAL_FORMAT_BEGIN >- String loggingString = String::format(format, args); >+ String loggingString = WTF::createWithFormatAndArguments(format, args); > ALLOW_NONLITERAL_FORMAT_END > > va_end(args); >diff --git a/Source/WTF/wtf/HexNumber.h b/Source/WTF/wtf/HexNumber.h >index 90ad90aaaa3e1f96b28c9ea3de6c488b91403915..2012b8fe4c6e00292d27a5733826f3a82d55c964 100644 >--- a/Source/WTF/wtf/HexNumber.h >+++ b/Source/WTF/wtf/HexNumber.h >@@ -102,7 +102,6 @@ public: > unsigned length() const { return m_buffer.length; } > bool is8Bit() const { return true; } > template<typename CharacterType> void writeTo(CharacterType* destination) const { StringImpl::copyCharacters(destination, characters(), length()); } >- String toString() const { return { characters(), length() }; } > > private: > const LChar* characters() const { return &*(m_buffer.characters.end() - length()); } >diff --git a/Source/WTF/wtf/text/StringConcatenate.h b/Source/WTF/wtf/text/StringConcatenate.h >index 19f231210fd9d75c7eda6f8399a0f586b1eaac3f..a5c6073278483b7f5af4a4ce8620b83e56ba1a1b 100644 >--- a/Source/WTF/wtf/text/StringConcatenate.h >+++ b/Source/WTF/wtf/text/StringConcatenate.h >@@ -25,7 +25,7 @@ > > #pragma once > >-#include <string.h> >+#include <cstring> > #include <wtf/CheckedArithmetic.h> > #include <wtf/text/AtomicString.h> > #include <wtf/text/StringView.h> >@@ -38,220 +38,201 @@ > > namespace WTF { > >-template<typename StringType, typename> >-class StringTypeAdapter; >- >-template<> >-class StringTypeAdapter<char, void> { >+template<> class StringTypeAdapter<char, void> { > public: > StringTypeAdapter(char character) >- : m_character(character) >+ : m_character { character } > { > } > > unsigned length() { return 1; } > bool is8Bit() { return true; } >- >- void writeTo(LChar* destination) const >- { >- *destination = m_character; >- } >- >- void writeTo(UChar* destination) const >- { >- *destination = m_character; >- } >- >- String toString() const { return String(&m_character, 1); } >+ template<typename CharacterType> void writeTo(CharacterType* destination) const { *destination = m_character; } > > private: > char m_character; > }; > >-template<> >-class StringTypeAdapter<UChar, void> { >+template<> class StringTypeAdapter<UChar, void> { > public: > StringTypeAdapter(UChar character) >- : m_character(character) >+ : m_character { character } > { > } > > unsigned length() const { return 1; } >- bool is8Bit() const { return m_character <= 0xff; } >+ bool is8Bit() const { return isLatin1(m_character); } > > void writeTo(LChar* destination) const > { > ASSERT(is8Bit()); >- *destination = static_cast<LChar>(m_character); >- } >- >- void writeTo(UChar* destination) const >- { > *destination = m_character; > } > >- String toString() const { return String(&m_character, 1); } >+ void writeTo(UChar* destination) const { *destination = m_character; } > > private: > UChar m_character; > }; > >-template<> >-class StringTypeAdapter<const LChar*, void> { >+template<> class StringTypeAdapter<const LChar*, void> { > public: > StringTypeAdapter(const LChar* characters) >- : m_characters(characters) >+ : m_characters { characters } >+ , m_length { computeLength(characters) } > { >- size_t length = strlen(reinterpret_cast<const char*>(characters)); >- RELEASE_ASSERT(length <= String::MaxLength); >- m_length = static_cast<unsigned>(length); > } > > unsigned length() const { return m_length; } > bool is8Bit() const { return true; } >+ template<typename CharacterType> void writeTo(CharacterType* destination) const { StringImpl::copyCharacters(destination, m_characters, m_length); } > >- void writeTo(LChar* destination) const >- { >- StringView(m_characters, m_length).getCharactersWithUpconvert(destination); >- } >- >- void writeTo(UChar* destination) const >+private: >+ static unsigned computeLength(const LChar* characters) > { >- StringView(m_characters, m_length).getCharactersWithUpconvert(destination); >+ size_t length = std::strlen(reinterpret_cast<const char*>(characters)); >+ RELEASE_ASSERT(length <= String::MaxLength); >+ return static_cast<unsigned>(length); > } > >- String toString() const { return String(m_characters, m_length); } >- >-private: > const LChar* m_characters; > unsigned m_length; > }; > >-template<> >-class StringTypeAdapter<const UChar*, void> { >+template<> class StringTypeAdapter<const UChar*, void> { > public: > StringTypeAdapter(const UChar* characters) >- : m_characters(characters) >+ : m_characters { characters } >+ , m_length { computeLength(characters) } > { >- size_t length = 0; >- while (m_characters[length]) >- ++length; >- RELEASE_ASSERT(length <= String::MaxLength); >- m_length = static_cast<unsigned>(length); > } > > unsigned length() const { return m_length; } >- bool is8Bit() const { return false; } >+ bool is8Bit() const { return !m_length; } >+ void writeTo(LChar*) const { ASSERT(!m_length); } >+ void writeTo(UChar* destination) const { StringImpl::copyCharacters(destination, m_characters, m_length); } > >- NO_RETURN_DUE_TO_CRASH void writeTo(LChar*) const >- { >- CRASH(); // FIXME make this a compile-time failure https://bugs.webkit.org/show_bug.cgi?id=165791 >- } >- >- void writeTo(UChar* destination) const >+private: >+ static unsigned computeLength(const UChar* characters) > { >- memcpy(destination, m_characters, m_length * sizeof(UChar)); >+ size_t length = 0; >+ while (characters[length]) >+ ++length; >+ RELEASE_ASSERT(length <= String::MaxLength); >+ return static_cast<unsigned>(length); > } > >- String toString() const { return String(m_characters, m_length); } >- >-private: > const UChar* m_characters; > unsigned m_length; > }; > >-template<> >-class StringTypeAdapter<const char*, void> : public StringTypeAdapter<const LChar*, void> { >+template<> class StringTypeAdapter<const char*, void> : public StringTypeAdapter<const LChar*, void> { > public: > StringTypeAdapter(const char* characters) >- : StringTypeAdapter<const LChar*, void>(reinterpret_cast<const LChar*>(characters)) >+ : StringTypeAdapter<const LChar*, void> { reinterpret_cast<const LChar*>(characters) } > { > } > }; > >-template<> >-class StringTypeAdapter<char*, void> : public StringTypeAdapter<const char*, void> { >+template<> class StringTypeAdapter<char*, void> : public StringTypeAdapter<const char*, void> { > public: > StringTypeAdapter(const char* characters) >- : StringTypeAdapter<const char*, void>(characters) >+ : StringTypeAdapter<const char*, void> { characters } > { > } > }; > >-template<> >-class StringTypeAdapter<ASCIILiteral, void> : public StringTypeAdapter<const char*, void> { >+template<> class StringTypeAdapter<ASCIILiteral, void> : public StringTypeAdapter<const char*, void> { > public: > StringTypeAdapter(ASCIILiteral characters) >- : StringTypeAdapter<const char*, void>(characters) >+ : StringTypeAdapter<const char*, void> { characters } > { > } > }; > >-template<> >-class StringTypeAdapter<Vector<char>, void> { >+template<> class StringTypeAdapter<Vector<char>, void> { > public: > StringTypeAdapter(const Vector<char>& vector) >- : m_vector(vector) >+ : m_vector { vector } > { > } > > size_t length() const { return m_vector.size(); } > bool is8Bit() const { return true; } >+ template<typename CharacterType> void writeTo(CharacterType* destination) const { StringImpl::copyCharacters(destination, characters(), length()); } > >- void writeTo(LChar* destination) const >- { >- StringView(reinterpret_cast<const LChar*>(m_vector.data()), m_vector.size()).getCharactersWithUpconvert(destination); >- } >- >- void writeTo(UChar* destination) const >+private: >+ const LChar* characters() const > { >- StringView(reinterpret_cast<const LChar*>(m_vector.data()), m_vector.size()).getCharactersWithUpconvert(destination); >+ return reinterpret_cast<const LChar*>(m_vector.data()); > } > >- String toString() const { return String(m_vector.data(), m_vector.size()); } >- >-private: > const Vector<char>& m_vector; > }; > >-template<> >-class StringTypeAdapter<String, void> { >+template<> class StringTypeAdapter<String, void> { > public: > StringTypeAdapter(const String& string) >- : m_string(string) >+ : m_string { string } > { > } > > unsigned length() const { return m_string.length(); } > bool is8Bit() const { return m_string.isNull() || m_string.is8Bit(); } >- >- void writeTo(LChar* destination) const >- { >- StringView(m_string).getCharactersWithUpconvert(destination); >- WTF_STRINGTYPEADAPTER_COPIED_WTF_STRING(); >- } >- >- void writeTo(UChar* destination) const >+ template<typename CharacterType> void writeTo(CharacterType* destination) const > { >- StringView(m_string).getCharactersWithUpconvert(destination); >+ StringView { m_string }.getCharactersWithUpconvert(destination); > WTF_STRINGTYPEADAPTER_COPIED_WTF_STRING(); > } > >- String toString() const { return m_string; } >- > private: > const String& m_string; > }; > >-template<> >-class StringTypeAdapter<AtomicString, void> : public StringTypeAdapter<String, void> { >+template<> class StringTypeAdapter<AtomicString, void> : public StringTypeAdapter<String, void> { > public: > StringTypeAdapter(const AtomicString& string) >- : StringTypeAdapter<String, void>(string.string()) >+ : StringTypeAdapter<String, void> { string.string() } > { > } > }; > >+template<typename UnderlyingAdapterType> struct PaddingSpecification { >+ LChar character; >+ unsigned length; >+ UnderlyingAdapterType underlyingAdapter; >+}; >+ >+template<typename StringType> PaddingSpecification<StringTypeAdapter<StringType>> pad(char character, unsigned length, StringType adapter) >+{ >+ return { static_cast<LChar>(character), length, StringTypeAdapter<StringType> { adapter } }; >+} >+ >+template<typename UnderlyingAdapterType> class StringTypeAdapter<PaddingSpecification<UnderlyingAdapterType>> { >+public: >+ StringTypeAdapter(const PaddingSpecification<UnderlyingAdapterType>& padding) >+ : m_padding { padding } >+ { >+ } >+ >+ unsigned length() const { return std::max(m_padding.length, m_padding.underlyingAdapter.length()); } >+ bool is8Bit() const { return m_padding.underlyingAdapter.is8Bit(); } >+ template<typename CharacterType> void writeTo(CharacterType* destination) const >+ { >+ unsigned underlyingLength = m_padding.underlyingAdapter.length(); >+ unsigned count = 0; >+ if (underlyingLength < m_padding.length) { >+ count = m_padding.length - underlyingLength; >+ for (unsigned i = 0; i < count; ++i) >+ destination[i] = m_padding.character; >+ } >+ m_padding.underlyingAdapter.writeTo(destination + count); >+ } >+ >+private: >+ const PaddingSpecification<UnderlyingAdapterType>& m_padding; >+}; >+ > template<typename Adapter> > inline bool are8Bit(Adapter adapter) > { >@@ -314,13 +295,6 @@ String tryMakeString(StringTypes ...strings) > return tryMakeStringFromAdapters(StringTypeAdapter<StringTypes>(strings)...); > } > >-// Convenience only. >-template<typename StringType> >-String makeString(StringType string) >-{ >- return String(string); >-} >- > template<typename... StringTypes> > String makeString(StringTypes... strings) > { >@@ -333,6 +307,7 @@ String makeString(StringTypes... strings) > } // namespace WTF > > using WTF::makeString; >+using WTF::pad; > using WTF::tryMakeString; > > #include <wtf/text/StringOperators.h> >diff --git a/Source/WTF/wtf/text/StringConcatenateNumbers.h b/Source/WTF/wtf/text/StringConcatenateNumbers.h >index a375eccd065354b5e1396307153db973424ef827..6f4ef89a787b097258823a1e36760696a3562929 100644 >--- a/Source/WTF/wtf/text/StringConcatenateNumbers.h >+++ b/Source/WTF/wtf/text/StringConcatenateNumbers.h >@@ -42,7 +42,6 @@ public: > unsigned length() const { return lengthOfNumberAsStringSigned(m_number); } > bool is8Bit() const { return true; } > template<typename CharacterType> void writeTo(CharacterType* destination) const { writeNumberToBufferSigned(m_number, destination); } >- String toString() const { return String::number(m_number); } > > private: > SignedInt m_number; >@@ -59,7 +58,6 @@ public: > unsigned length() const { return lengthOfNumberAsStringUnsigned(m_number); } > bool is8Bit() const { return true; } > template<typename CharacterType> void writeTo(CharacterType* destination) const { writeNumberToBufferUnsigned(m_number, destination); } >- String toString() const { return String::number(m_number); } > > private: > UnsignedInt m_number; >@@ -71,13 +69,12 @@ public: > StringTypeAdapter(FloatingPoint number) > { > numberToString(number, m_buffer); >- m_length = strlen(m_buffer); >+ m_length = std::strlen(m_buffer); > } > > unsigned length() const { return m_length; } > bool is8Bit() const { return true; } > template<typename CharacterType> void writeTo(CharacterType* destination) const { StringImpl::copyCharacters(destination, buffer(), m_length); } >- String toString() const { return { buffer(), m_length }; } > > private: > const LChar* buffer() const { return reinterpret_cast<const LChar*>(m_buffer); } >@@ -92,7 +89,7 @@ public: > { > FormattedNumber numberFormatter; > numberToFixedPrecisionString(number, significantFigures, numberFormatter.m_buffer, trailingZerosTruncatingPolicy == TruncateTrailingZeros); >- numberFormatter.m_length = strlen(numberFormatter.m_buffer); >+ numberFormatter.m_length = std::strlen(numberFormatter.m_buffer); > return numberFormatter; > } > >@@ -100,7 +97,7 @@ public: > { > FormattedNumber numberFormatter; > numberToFixedWidthString(number, decimalPlaces, numberFormatter.m_buffer); >- numberFormatter.m_length = strlen(numberFormatter.m_buffer); >+ numberFormatter.m_length = std::strlen(numberFormatter.m_buffer); > return numberFormatter; > } > >@@ -112,8 +109,7 @@ private: > unsigned m_length; > }; > >-template<> >-class StringTypeAdapter<FormattedNumber> { >+template<> class StringTypeAdapter<FormattedNumber> { > public: > StringTypeAdapter(const FormattedNumber& number) > : m_number { number } >@@ -123,7 +119,6 @@ public: > unsigned length() const { return m_number.length(); } > bool is8Bit() const { return true; } > template<typename CharacterType> void writeTo(CharacterType* destination) const { StringImpl::copyCharacters(destination, m_number.buffer(), m_number.length()); } >- String toString() const { return { m_number.buffer(), m_number.length() }; } > > private: > const FormattedNumber& m_number; >diff --git a/Source/WTF/wtf/text/StringOperators.h b/Source/WTF/wtf/text/StringOperators.h >index 12e082614209c599bc2bdf35bb8c02f4ef97528b..743ee9f84ee0da1405de97955908bc061684f98f 100644 >--- a/Source/WTF/wtf/text/StringOperators.h >+++ b/Source/WTF/wtf/text/StringOperators.h >@@ -23,12 +23,11 @@ > > namespace WTF { > >-template<typename StringType1, typename StringType2> >-class StringAppend { >+template<typename StringType1, typename StringType2> class StringAppend { > public: > StringAppend(StringType1 string1, StringType2 string2) >- : m_string1(string1) >- , m_string2(string2) >+ : m_string1 { string1 } >+ , m_string2 { string2 } > { > } > >@@ -85,18 +84,13 @@ template<typename StringType1, typename StringType2> > class StringTypeAdapter<StringAppend<StringType1, StringType2>> { > public: > StringTypeAdapter<StringAppend<StringType1, StringType2>>(StringAppend<StringType1, StringType2>& buffer) >- : m_buffer(buffer) >+ : m_buffer { buffer } > { > } > >- unsigned length() { return m_buffer.length(); } >- >- bool is8Bit() { return m_buffer.is8Bit(); } >- >- void writeTo(LChar* destination) { m_buffer.writeTo(destination); } >- void writeTo(UChar* destination) { m_buffer.writeTo(destination); } >- >- String toString() const { return m_buffer; } >+ unsigned length() const { return m_buffer.length(); } >+ bool is8Bit() const { return m_buffer.is8Bit(); } >+ template<typename CharacterType> void writeTo(CharacterType* destination) const { m_buffer.writeTo(destination); } > > private: > StringAppend<StringType1, StringType2>& m_buffer; >diff --git a/Source/WTF/wtf/text/StringView.h b/Source/WTF/wtf/text/StringView.h >index 701c55bcb65370b5826c04dc7012bdbdcb079d20..b3df3aeb0ea47278ffbc67445ad656e68f9e601e 100644 >--- a/Source/WTF/wtf/text/StringView.h >+++ b/Source/WTF/wtf/text/StringView.h >@@ -565,26 +565,23 @@ inline size_t StringView::reverseFind(UChar character, unsigned index) const > } > > #if !CHECK_STRINGVIEW_LIFETIME >+ > inline void StringView::invalidate(const StringImpl&) > { > } >-#endif > >-template<typename StringType, typename> class StringTypeAdapter; >+#endif > > template<> class StringTypeAdapter<StringView, void> { > public: > StringTypeAdapter(StringView string) >- : m_string(string) >+ : m_string { string } > { > } > > unsigned length() { return m_string.length(); } > bool is8Bit() { return m_string.is8Bit(); } >- void writeTo(LChar* destination) { m_string.getCharactersWithUpconvert(destination); } >- void writeTo(UChar* destination) { m_string.getCharactersWithUpconvert(destination); } >- >- String toString() const { return m_string.toString(); } >+ template<typename CharacterType> void writeTo(CharacterType* destination) { m_string.getCharactersWithUpconvert(destination); } > > private: > StringView m_string; >diff --git a/Source/WTF/wtf/text/WTFString.cpp b/Source/WTF/wtf/text/WTFString.cpp >index 918877ed3cfd99ad5bc134705c04039501f5d30d..de58ff7e0e81adcb2237013f88cc0a0de4edbac7 100644 >--- a/Source/WTF/wtf/text/WTFString.cpp >+++ b/Source/WTF/wtf/text/WTFString.cpp >@@ -449,61 +449,6 @@ Vector<UChar> String::charactersWithNullTermination() const > return result; > } > >-WTF_ATTRIBUTE_PRINTF(1, 0) static String createWithFormatAndArguments(const char *format, va_list args) >-{ >- va_list argsCopy; >- va_copy(argsCopy, args); >- >- ALLOW_NONLITERAL_FORMAT_BEGIN >- >-#if USE(CF) && !OS(WINDOWS) >- if (strstr(format, "%@")) { >- auto cfFormat = adoptCF(CFStringCreateWithCString(kCFAllocatorDefault, format, kCFStringEncodingUTF8)); >- auto result = adoptCF(CFStringCreateWithFormatAndArguments(kCFAllocatorDefault, nullptr, cfFormat.get(), args)); >- va_end(argsCopy); >- return result.get(); >- } >-#endif >- >- // Do the format once to get the length. >-#if COMPILER(MSVC) >- int result = _vscprintf(format, args); >-#else >- char ch; >- int result = vsnprintf(&ch, 1, format, args); >-#endif >- >- if (!result) { >- va_end(argsCopy); >- return emptyString(); >- } >- if (result < 0) { >- va_end(argsCopy); >- return String(); >- } >- >- Vector<char, 256> buffer; >- unsigned len = result; >- buffer.grow(len + 1); >- >- // Now do the formatting again, guaranteed to fit. >- vsnprintf(buffer.data(), buffer.size(), format, argsCopy); >- va_end(argsCopy); >- >- ALLOW_NONLITERAL_FORMAT_END >- >- return StringImpl::create(reinterpret_cast<const LChar*>(buffer.data()), len); >-} >- >-String String::format(const char *format, ...) >-{ >- va_list args; >- va_start(args, format); >- String result = createWithFormatAndArguments(format, args); >- va_end(args); >- return result; >-} >- > String String::number(int number) > { > return numberToStringSigned<String>(number); >diff --git a/Source/WTF/wtf/text/WTFString.h b/Source/WTF/wtf/text/WTFString.h >index 821f059149a69263052882f370fb3ea3821b1dfb..6534035d0e792fec1bcaf6a46f34fd7a0d0647fd 100644 >--- a/Source/WTF/wtf/text/WTFString.h >+++ b/Source/WTF/wtf/text/WTFString.h >@@ -261,8 +261,6 @@ public: > // Use convertToASCIILowercase instead if ASCII case insensitive comparison is desired. > WTF_EXPORT_PRIVATE String foldCase() const; > >- WTF_EXPORT_PRIVATE static String format(const char *, ...) WTF_ATTRIBUTE_PRINTF(1, 2); >- > // Returns an uninitialized string. The characters needs to be written > // into the buffer returned in data before the returned string is used. > static String createUninitialized(unsigned length, UChar*& data) { return StringImpl::createUninitialized(length, data); } >diff --git a/Source/WebCore/dom/Document.cpp b/Source/WebCore/dom/Document.cpp >index bb899ea844886ca27c03ace6cc29e78ed30a0c68..88207d50e1407e9c8b6bff6831edf43eb1e3a6bb 100644 >--- a/Source/WebCore/dom/Document.cpp >+++ b/Source/WebCore/dom/Document.cpp >@@ -5017,15 +5017,19 @@ String Document::lastModified() const > else if (loader()) > dateTime = loader()->response().lastModified(); > >- // FIXME: If this document came from the file system, the HTML5 >- // specification tells us to read the last modification date from the file >- // system. >+ // FIXME: If this document came from the file system, the HTML specification tells >+ // us to read the last modification date from the file system. > if (!dateTime) > dateTime = WallTime::now(); > > auto ctime = dateTime.value().secondsSinceEpoch().secondsAs<time_t>(); > auto localDateTime = std::localtime(&ctime); >- return String::format("%02d/%02d/%04d %02d:%02d:%02d", localDateTime->tm_mon + 1, localDateTime->tm_mday, 1900 + localDateTime->tm_year, localDateTime->tm_hour, localDateTime->tm_min, localDateTime->tm_sec); >+ return makeString(pad('0', 2, localDateTime->tm_mon + 1), '/', >+ pad('0', 2, localDateTime->tm_mday), '/', >+ pad('0', 4, 1900 + localDateTime->tm_year), ' ', >+ pad('0', 2, localDateTime->tm_hour), ':', >+ pad('0', 2, localDateTime->tm_min), ':', >+ pad('0', 2, localDateTime->tm_sec)); > } > > void Document::setCookieURL(const URL& url) >diff --git a/Source/WebCore/html/FTPDirectoryDocument.cpp b/Source/WebCore/html/FTPDirectoryDocument.cpp >index 6a89c7926512ebc8cc4d7cb81e1210f13cc8c4bd..36166f1ce347c6b19b253307174ef4c0262f5854 100644 >--- a/Source/WebCore/html/FTPDirectoryDocument.cpp >+++ b/Source/WebCore/html/FTPDirectoryDocument.cpp >@@ -210,12 +210,12 @@ static String processFileDateString(const FTPTime& fileTime) > if (hour < 12) { > if (hour == 0) > hour = 12; >- timeOfDay = String::format(", %i:%02i AM", hour, fileTime.tm_min); >+ timeOfDay = makeString(", ", hour, ':', pad('0', 2, fileTime.tm_min), " AM"); > } else { > hour = hour - 12; > if (hour == 0) > hour = 12; >- timeOfDay = String::format(", %i:%02i PM", hour, fileTime.tm_min); >+ timeOfDay = makeString(", ", hour, ':', pad('0', 2, fileTime.tm_min), " PM"); > } > } > >diff --git a/Source/WebCore/page/cocoa/ResourceUsageOverlayCocoa.mm b/Source/WebCore/page/cocoa/ResourceUsageOverlayCocoa.mm >index 198b29823983f140c733fcab9962f9dd73265d3e..56b65d6d1baf80ac76f510fd5e3cb2b45056d0ae 100644 >--- a/Source/WebCore/page/cocoa/ResourceUsageOverlayCocoa.mm >+++ b/Source/WebCore/page/cocoa/ResourceUsageOverlayCocoa.mm >@@ -468,7 +468,7 @@ void ResourceUsageOverlay::platformDraw(CGContextRef context) > size_t reclaimable = category.reclaimableSize.last(); > size_t external = category.externalSize.last(); > >- String label = String::format("% 11s: %s", category.name.ascii().data(), formatByteNumber(dirty).ascii().data()); >+ String label = makeString(pad(' ', 11, category.name), ": ", formatByteNumber(dirty)); > if (external) > label = label + makeString(" + ", formatByteNumber(external)); > if (reclaimable) >diff --git a/Source/WebCore/page/linux/ResourceUsageOverlayLinux.cpp b/Source/WebCore/page/linux/ResourceUsageOverlayLinux.cpp >index e78ffaa619569781f71823ae73ccdea439ad1f6c..9571d1228558ecebe7b7821a5e6b624f254b4789 100644 >--- a/Source/WebCore/page/linux/ResourceUsageOverlayLinux.cpp >+++ b/Source/WebCore/page/linux/ResourceUsageOverlayLinux.cpp >@@ -46,7 +46,7 @@ static String cpuUsageString(float cpuUsage) > { > if (cpuUsage < 0) > return "<unknown>"_s; >- return String::format("%.1f%%", cpuUsage); >+ return makeString(FormattedNumber::fixedWidth(cpuUsage, 1), '%'); > } > > static String formatByteNumber(size_t number) >@@ -64,7 +64,7 @@ static String gcTimerString(MonotonicTime timerFireDate, MonotonicTime now) > { > if (std::isnan(timerFireDate)) > return "[not scheduled]"_s; >- return String::format("%g", (timerFireDate - now).seconds()); >+ return String::number((timerFireDate - now).seconds()); > } > > static const float gFontSize = 14; >diff --git a/Source/WebCore/platform/DateComponents.cpp b/Source/WebCore/platform/DateComponents.cpp >index dd5adcb98d7214b42e29e322dea96d6896bbbbe5..9244e3d0bd2f49bdf4e8f906696c3f29dd5ff36b 100644 >--- a/Source/WebCore/platform/DateComponents.cpp >+++ b/Source/WebCore/platform/DateComponents.cpp >@@ -35,7 +35,7 @@ > #include <wtf/ASCIICType.h> > #include <wtf/DateMath.h> > #include <wtf/MathExtras.h> >-#include <wtf/text/WTFString.h> >+#include <wtf/text/StringConcatenateNumbers.h> > > namespace WebCore { > >@@ -693,11 +693,11 @@ String DateComponents::toStringForTime(SecondFormat format) const > FALLTHROUGH; // To None. > #endif > case None: >- return String::format("%02d:%02d", m_hour, m_minute); >+ return makeString(pad('0', 2, m_hour), ':', pad('0', 2, m_minute)); > case Second: >- return String::format("%02d:%02d:%02d", m_hour, m_minute, m_second); >+ return makeString(pad('0', 2, m_hour), ':', pad('0', 2, m_minute), ':', pad('0', 2, m_second)); > case Millisecond: >- return String::format("%02d:%02d:%02d.%03d", m_hour, m_minute, m_second, m_millisecond); >+ return makeString(pad('0', 2, m_hour), ':', pad('0', 2, m_minute), ':', pad('0', 2, m_second), '.', pad('0', 3, m_millisecond)); > } > } > >@@ -705,19 +705,17 @@ String DateComponents::toString(SecondFormat format) const > { > switch (m_type) { > case Date: >- return String::format("%04d-%02d-%02d", m_year, m_month + 1, m_monthDay); >+ return makeString(pad('0', 4, m_year), '-', pad('0', 2, m_month + 1), '-', pad('0', 2, m_monthDay)); > case DateTime: >- return String::format("%04d-%02d-%02dT", m_year, m_month + 1, m_monthDay) >- + toStringForTime(format) + "Z"_str; >+ return makeString(pad('0', 4, m_year), '-', pad('0', 2, m_month + 1), '-', pad('0', 2, m_monthDay), 'T', toStringForTime(format), 'Z'); > case DateTimeLocal: >- return String::format("%04d-%02d-%02dT", m_year, m_month + 1, m_monthDay) >- + toStringForTime(format); >+ return makeString(pad('0', 4, m_year), '-', pad('0', 2, m_month + 1), '-', pad('0', 2, m_monthDay), 'T', toStringForTime(format)); > case Month: >- return String::format("%04d-%02d", m_year, m_month + 1); >+ return makeString(pad('0', 4, m_year), '-', pad('0', 2, m_month + 1)); > case Time: > return toStringForTime(format); > case Week: >- return String::format("%04d-W%02d", m_year, m_week); >+ return makeString(pad('0', 4, m_year), "-W", pad('0', 2, m_week)); > case Invalid: > break; > } >diff --git a/Source/WebCore/platform/LocalizedStrings.cpp b/Source/WebCore/platform/LocalizedStrings.cpp >index 1bf4cd7556cb80704b53b450b1d0940a4f97be91..80e2e4014950ae87c8f274a3671aa85b880c5ede 100644 >--- a/Source/WebCore/platform/LocalizedStrings.cpp >+++ b/Source/WebCore/platform/LocalizedStrings.cpp >@@ -43,10 +43,7 @@ > > namespace WebCore { > >-// We can't use String::format for two reasons: >-// 1) It doesn't handle non-ASCII characters in the format string. >-// 2) It doesn't handle the %2$d syntax. >-// Note that because |format| is used as the second parameter to va_start, it cannot be a reference >+// Because |format| is used as the second parameter to va_start, it cannot be a reference > // type according to section 18.7/3 of the C++ N1905 standard. > String formatLocalizedString(String format, ...) > { >@@ -73,10 +70,12 @@ String formatLocalizedString(String format, ...) > } > > #if !USE(CF) >+ > String localizedString(const char* key) > { > return String::fromUTF8(key, strlen(key)); > } >+ > #endif > > #if ENABLE(CONTEXT_MENUS) >diff --git a/Source/WebCore/platform/audio/HRTFElevation.cpp b/Source/WebCore/platform/audio/HRTFElevation.cpp >index 9e71ae9f747e98b956a0c0c5b0489db3b89ded25..c84ab9751a145989a0377fad1f4a75e8f17e2b24 100644 >--- a/Source/WebCore/platform/audio/HRTFElevation.cpp >+++ b/Source/WebCore/platform/audio/HRTFElevation.cpp >@@ -176,7 +176,7 @@ bool HRTFElevation::calculateKernelsForAzimuthElevation(int azimuth, int elevati > AudioChannel* leftEarImpulseResponse = response->channel(AudioBus::ChannelLeft); > AudioChannel* rightEarImpulseResponse = response->channel(AudioBus::ChannelRight); > #else >- String resourceName = String::format("IRC_%s_C_R0195_T%03d_P%03d", subjectName.utf8().data(), azimuth, positiveElevation); >+ String resourceName = makeString("IRC_", subjectName, "_C_R0195_T", pad('0', 3, azimuth), "_P", pad('0', 3, positiveElevation)); > > RefPtr<AudioBus> impulseResponse(AudioBus::loadPlatformResource(resourceName.utf8().data(), sampleRate)); > >diff --git a/Source/WebCore/platform/mock/MockRealtimeVideoSource.cpp b/Source/WebCore/platform/mock/MockRealtimeVideoSource.cpp >index 0b9f1909fc700c5b517bd79bf36617db639bbe46..f13c5b5b6e11fd38fadff0cdff151554288a01cd 100644 >--- a/Source/WebCore/platform/mock/MockRealtimeVideoSource.cpp >+++ b/Source/WebCore/platform/mock/MockRealtimeVideoSource.cpp >@@ -350,10 +350,10 @@ void MockRealtimeVideoSource::drawText(GraphicsContext& context) > FloatPoint timeLocation(captureSize.width() * .05, captureSize.height() * .15); > context.setFillColor(Color::white); > context.setTextDrawingMode(TextModeFill); >- String string = String::format("%02u:%02u:%02u.%03u", hours, minutes, seconds, milliseconds % 1000); >+ String string = makeString(pad('0', 2, hours), ':', pad('0', 2, minutes), ':', pad('0', 2, seconds), '.', pad('0', 3, milliseconds % 1000)); > context.drawText(timeFont, TextRun((StringView(string))), timeLocation); > >- string = String::format("%06u", m_frameNumber++); >+ string = makeString(pad('0', 6, m_frameNumber++)); > timeLocation.move(0, m_baseFontSize); > context.drawText(timeFont, TextRun((StringView(string))), timeLocation); > >diff --git a/Source/WebCore/rendering/RenderLayerCompositor.cpp b/Source/WebCore/rendering/RenderLayerCompositor.cpp >index 5d079a1ab74ebdc695d3a6e7ee8b265f2b05837f..5e8ec4ef25acdcca7175518c31836790b7762bb3 100644 >--- a/Source/WebCore/rendering/RenderLayerCompositor.cpp >+++ b/Source/WebCore/rendering/RenderLayerCompositor.cpp >@@ -60,6 +60,7 @@ > #include "Settings.h" > #include "TiledBacking.h" > #include "TransformState.h" >+#include <wtf/HexNumber.h> > #include <wtf/MemoryPressureHandler.h> > #include <wtf/SetForScope.h> > #include <wtf/text/CString.h> >@@ -1323,10 +1324,8 @@ void RenderLayerCompositor::logLayerInfo(const RenderLayer& layer, const char* p > absoluteBounds.move(layer.offsetFromAncestor(m_renderView.layer())); > > StringBuilder logString; >- logString.append(String::format("%*p id %" PRIu64 " (%.3f,%.3f-%.3f,%.3f) %.2fKB", 12 + depth * 2, &layer, backing->graphicsLayer()->primaryLayerID(), >- absoluteBounds.x().toFloat(), absoluteBounds.y().toFloat(), absoluteBounds.maxX().toFloat(), absoluteBounds.maxY().toFloat(), >- backing->backingStoreMemoryEstimate() / 1024)); >- >+ logString.append(makeString(pad(' ', 12 + depth * 2, hex(reinterpret_cast<uintptr_t>(&layer))), " id ", backing->graphicsLayer()->primaryLayerID(), " (", FormattedNumber::fixedWidth(absoluteBounds.x().toFloat(), 3), ',', FormattedNumber::fixedWidth(absoluteBounds.y().toFloat(), 3), '-', FormattedNumber::fixedWidth(absoluteBounds.maxX().toFloat(), 3), ',', FormattedNumber::fixedWidth(absoluteBounds.maxY().toFloat(), 3), ") ", FormattedNumber::fixedWidth(backing->backingStoreMemoryEstimate() / 1024, 2), "KB")); >+ > if (!layer.renderer().style().hasAutoZIndex()) > logString.append(makeString(" z-index: ", layer.renderer().style().zIndex())); > >diff --git a/Source/WebCore/rendering/RenderTheme.cpp b/Source/WebCore/rendering/RenderTheme.cpp >index 2a45f10fd9f308373134226fda55d137c3c406e8..585ef88ee1770aaa15590a7ab7482e72ba0f742d 100644 >--- a/Source/WebCore/rendering/RenderTheme.cpp >+++ b/Source/WebCore/rendering/RenderTheme.cpp >@@ -46,6 +46,7 @@ > #include "TextControlInnerElements.h" > #include <wtf/FileSystem.h> > #include <wtf/NeverDestroyed.h> >+#include <wtf/text/StringConcatenateNumbers.h> > > #if ENABLE(METER_ELEMENT) > #include "HTMLMeterElement.h" >@@ -568,18 +569,14 @@ String RenderTheme::formatMediaControlsTime(float time) const > { > if (!std::isfinite(time)) > time = 0; >- int seconds = (int)fabsf(time); >+ // FIXME: Seems like it would be better to use std::lround here. >+ int seconds = static_cast<int>(std::abs(time)); > int hours = seconds / (60 * 60); > int minutes = (seconds / 60) % 60; > seconds %= 60; >- if (hours) { >- if (hours > 9) >- return String::format("%s%02d:%02d:%02d", (time < 0 ? "-" : ""), hours, minutes, seconds); >- >- return String::format("%s%01d:%02d:%02d", (time < 0 ? "-" : ""), hours, minutes, seconds); >- } >- >- return String::format("%s%02d:%02d", (time < 0 ? "-" : ""), minutes, seconds); >+ if (hours) >+ return makeString((time < 0 ? "-" : ""), hours, ':', pad('0', 2, minutes), ':', pad('0', 2, seconds)); >+ return makeString((time < 0 ? "-" : ""), pad('0', 2, minutes), ':', pad('0', 2, seconds)); > } > > String RenderTheme::formatMediaControlsCurrentTime(float currentTime, float /*duration*/) const >diff --git a/Source/WebKit/UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.mm b/Source/WebKit/UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.mm >index 0433c99eb80a8c1dfbb0bd33dfb9bad91ecf57cb..4e3d114214e16db00ad9d076043fbf2b61ab9a98 100644 >--- a/Source/WebKit/UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.mm >+++ b/Source/WebKit/UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.mm >@@ -400,8 +400,10 @@ void LocalAuthenticator::getAssertion() > > weakThis->continueGetAssertionAfterUserConsented(consent, context, credentialId, userhandle); > }; >+ NSData *idData = selectedCredentialAttributes[(id)kSecAttrApplicationTag]; >+ StringView idStringView { static_cast<const LChar*>([idData bytes]), static_cast<unsigned>([idData length]) }; > m_connection->getUserConsent( >- String::format("Log into %s with %s.", requestData().requestOptions.rpId.utf8().data(), selectedCredentialAttributes[(id)kSecAttrApplicationTag]), >+ makeString("Log into ", requestData().requestOptions.rpId, " with ", idStringView, '.'), > (__bridge SecAccessControlRef)selectedCredentialAttributes[(id)kSecAttrAccessControl], > WTFMove(callback)); > #endif // PLATFORM(IOS_FAMILY) >diff --git a/Source/WebKitLegacy/win/FullscreenVideoController.cpp b/Source/WebKitLegacy/win/FullscreenVideoController.cpp >index ca5020002926a6685d8269fb0acca0ddeec36429..f14c8ddef3176b14249de1f1d402ad7b975a65d9 100644 >--- a/Source/WebKitLegacy/win/FullscreenVideoController.cpp >+++ b/Source/WebKitLegacy/win/FullscreenVideoController.cpp >@@ -470,14 +470,9 @@ static String timeToString(float time) > int hours = seconds / (60 * 60); > int minutes = (seconds / 60) % 60; > seconds %= 60; >- >- if (hours) { >- if (hours > 9) >- return String::format("%s%02d:%02d:%02d", (time < 0 ? "-" : ""), hours, minutes, seconds); >- return String::format("%s%01d:%02d:%02d", (time < 0 ? "-" : ""), hours, minutes, seconds); >- } >- >- return String::format("%s%02d:%02d", (time < 0 ? "-" : ""), minutes, seconds); >+ if (hours) >+ return makeString((time < 0 ? "-" : ""), hours, ':', pad('0', 2, minutes), ':', pad('0', 2, seconds)); >+ return makeString((time < 0 ? "-" : ""), pad('0', 2, minutes), ':', pad('0', 2, seconds)); > } > > void FullscreenVideoController::draw()
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 194893
:
362588
|
362593
|
362597
|
362610