Diff
Modified: releases/WebKitGTK/webkit-2.24/Source/_javascript_Core/ChangeLog (242489 => 242490)
--- releases/WebKitGTK/webkit-2.24/Source/_javascript_Core/ChangeLog 2019-03-05 17:22:58 UTC (rev 242489)
+++ releases/WebKitGTK/webkit-2.24/Source/_javascript_Core/ChangeLog 2019-03-05 17:23:14 UTC (rev 242490)
@@ -1,3 +1,14 @@
+2019-03-01 Darin Adler <da...@apple.com>
+
+ Finish removing String::format
+ https://bugs.webkit.org/show_bug.cgi?id=194893
+
+ Reviewed by Daniel Bates.
+
+ * bytecode/CodeBlock.cpp:
+ (JSC::CodeBlock::nameForRegister): Use makeString instead of String::format,
+ using the new "pad" function.
+
2019-03-01 Yusuke Suzuki <ysuz...@apple.com>
[JSC] Fix FTL build on ARM32_64 by adding stubs for JSRopeString::offsetOfXXX
Modified: releases/WebKitGTK/webkit-2.24/Source/_javascript_Core/bytecode/CodeBlock.cpp (242489 => 242490)
--- releases/WebKitGTK/webkit-2.24/Source/_javascript_Core/bytecode/CodeBlock.cpp 2019-03-05 17:22:58 UTC (rev 242489)
+++ releases/WebKitGTK/webkit-2.24/Source/_javascript_Core/bytecode/CodeBlock.cpp 2019-03-05 17:23:14 UTC (rev 242490)
@@ -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 @@
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)
Modified: releases/WebKitGTK/webkit-2.24/Source/WTF/ChangeLog (242489 => 242490)
--- releases/WebKitGTK/webkit-2.24/Source/WTF/ChangeLog 2019-03-05 17:22:58 UTC (rev 242489)
+++ releases/WebKitGTK/webkit-2.24/Source/WTF/ChangeLog 2019-03-05 17:23:14 UTC (rev 242490)
@@ -1,3 +1,37 @@
+2019-03-01 Darin Adler <da...@apple.com>
+
+ Finish removing String::format
+ https://bugs.webkit.org/show_bug.cgi?id=194893
+
+ Reviewed by Daniel Bates.
+
+ * 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-28 Yusuke Suzuki <ysuz...@apple.com>
[JSC] sizeof(JSString) should be 16
Modified: releases/WebKitGTK/webkit-2.24/Source/WTF/wtf/Assertions.cpp (242489 => 242490)
--- releases/WebKitGTK/webkit-2.24/Source/WTF/wtf/Assertions.cpp 2019-03-05 17:22:58 UTC (rev 242489)
+++ releases/WebKitGTK/webkit-2.24/Source/WTF/wtf/Assertions.cpp 2019-03-05 17:23:14 UTC (rev 242490)
@@ -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 { };
+ }
+
+ Vector<char, 256> buffer;
+ unsigned length = result;
+ buffer.grow(length + 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()), length);
+}
+
+}
+
extern "C" {
static void logToStderr(const char* buffer)
@@ -399,7 +449,7 @@
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);
Modified: releases/WebKitGTK/webkit-2.24/Source/WTF/wtf/HexNumber.h (242489 => 242490)
--- releases/WebKitGTK/webkit-2.24/Source/WTF/wtf/HexNumber.h 2019-03-05 17:22:58 UTC (rev 242489)
+++ releases/WebKitGTK/webkit-2.24/Source/WTF/wtf/HexNumber.h 2019-03-05 17:23:14 UTC (rev 242490)
@@ -102,7 +102,6 @@
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()); }
Modified: releases/WebKitGTK/webkit-2.24/Source/WTF/wtf/text/StringConcatenate.h (242489 => 242490)
--- releases/WebKitGTK/webkit-2.24/Source/WTF/wtf/text/StringConcatenate.h 2019-03-05 17:22:58 UTC (rev 242489)
+++ releases/WebKitGTK/webkit-2.24/Source/WTF/wtf/text/StringConcatenate.h 2019-03-05 17:23:14 UTC (rev 242490)
@@ -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,203 @@
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; }
+ template<typename CharacterType> void writeTo(CharacterType* destination) const { *destination = m_character; }
- void writeTo(LChar* destination) const
- {
- *destination = m_character;
- }
-
- void writeTo(UChar* destination) const
- {
- *destination = m_character;
- }
-
- String toString() const { return String(&m_character, 1); }
-
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
+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);
}
- void writeTo(UChar* destination) const
- {
- StringView(m_characters, m_length).getCharactersWithUpconvert(destination);
- }
-
- 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
+private:
+ static unsigned computeLength(const UChar* characters)
{
- CRASH(); // FIXME make this a compile-time failure https://bugs.webkit.org/show_bug.cgi?id=165791
+ size_t length = 0;
+ while (characters[length])
+ ++length;
+ RELEASE_ASSERT(length <= String::MaxLength);
+ return static_cast<unsigned>(length);
}
- void writeTo(UChar* destination) const
- {
- memcpy(destination, m_characters, m_length * sizeof(UChar));
- }
-
- 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
+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());
}
- void writeTo(UChar* destination) const
- {
- StringView(reinterpret_cast<const LChar*>(m_vector.data()), m_vector.size()).getCharactersWithUpconvert(destination);
- }
-
- 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
+ template<typename CharacterType> void writeTo(CharacterType* destination) const
{
- StringView(m_string).getCharactersWithUpconvert(destination);
+ StringView { m_string }.getCharactersWithUpconvert(destination);
WTF_STRINGTYPEADAPTER_COPIED_WTF_STRING();
}
- void writeTo(UChar* destination) const
- {
- 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 UnderlyingElementType> struct PaddingSpecification {
+ LChar character;
+ unsigned length;
+ UnderlyingElementType underlyingElement;
+};
+
+template<typename UnderlyingElementType> PaddingSpecification<UnderlyingElementType> pad(char character, unsigned length, UnderlyingElementType element)
+{
+ return { static_cast<LChar>(character), length, element };
+}
+
+template<typename UnderlyingElementType> class StringTypeAdapter<PaddingSpecification<UnderlyingElementType>> {
+public:
+ StringTypeAdapter(const PaddingSpecification<UnderlyingElementType>& padding)
+ : m_padding { padding }
+ , m_underlyingAdapter { m_padding.underlyingElement }
+ {
+ }
+
+ unsigned length() const { return std::max(m_padding.length, m_underlyingAdapter.length()); }
+ bool is8Bit() const { return m_underlyingAdapter.is8Bit(); }
+ template<typename CharacterType> void writeTo(CharacterType* destination) const
+ {
+ unsigned underlyingLength = m_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_underlyingAdapter.writeTo(destination + count);
+ }
+
+private:
+ const PaddingSpecification<UnderlyingElementType>& m_padding;
+ StringTypeAdapter<UnderlyingElementType> m_underlyingAdapter;
+};
+
template<typename Adapter>
inline bool are8Bit(Adapter adapter)
{
@@ -314,13 +297,6 @@
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 +309,7 @@
} // namespace WTF
using WTF::makeString;
+using WTF::pad;
using WTF::tryMakeString;
#include <wtf/text/StringOperators.h>
Modified: releases/WebKitGTK/webkit-2.24/Source/WTF/wtf/text/StringConcatenateNumbers.h (242489 => 242490)
--- releases/WebKitGTK/webkit-2.24/Source/WTF/wtf/text/StringConcatenateNumbers.h 2019-03-05 17:22:58 UTC (rev 242489)
+++ releases/WebKitGTK/webkit-2.24/Source/WTF/wtf/text/StringConcatenateNumbers.h 2019-03-05 17:23:14 UTC (rev 242490)
@@ -42,7 +42,6 @@
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 @@
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 @@
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 @@
{
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 @@
{
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 @@
unsigned m_length;
};
-template<>
-class StringTypeAdapter<FormattedNumber> {
+template<> class StringTypeAdapter<FormattedNumber> {
public:
StringTypeAdapter(const FormattedNumber& number)
: m_number { number }
@@ -123,7 +119,6 @@
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;
Modified: releases/WebKitGTK/webkit-2.24/Source/WTF/wtf/text/StringOperators.h (242489 => 242490)
--- releases/WebKitGTK/webkit-2.24/Source/WTF/wtf/text/StringOperators.h 2019-03-05 17:22:58 UTC (rev 242489)
+++ releases/WebKitGTK/webkit-2.24/Source/WTF/wtf/text/StringOperators.h 2019-03-05 17:23:14 UTC (rev 242490)
@@ -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,19 +84,14 @@
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(); }
+ 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); }
- 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; }
-
private:
StringAppend<StringType1, StringType2>& m_buffer;
};
Modified: releases/WebKitGTK/webkit-2.24/Source/WTF/wtf/text/StringView.h (242489 => 242490)
--- releases/WebKitGTK/webkit-2.24/Source/WTF/wtf/text/StringView.h 2019-03-05 17:22:58 UTC (rev 242489)
+++ releases/WebKitGTK/webkit-2.24/Source/WTF/wtf/text/StringView.h 2019-03-05 17:23:14 UTC (rev 242490)
@@ -565,27 +565,24 @@
}
#if !CHECK_STRINGVIEW_LIFETIME
+
inline void StringView::invalidate(const StringImpl&)
{
}
+
#endif
-template<typename StringType, typename> class StringTypeAdapter;
-
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); }
+ template<typename CharacterType> void writeTo(CharacterType* destination) { m_string.getCharactersWithUpconvert(destination); }
- String toString() const { return m_string.toString(); }
-
private:
StringView m_string;
};
Modified: releases/WebKitGTK/webkit-2.24/Source/WTF/wtf/text/WTFString.cpp (242489 => 242490)
--- releases/WebKitGTK/webkit-2.24/Source/WTF/wtf/text/WTFString.cpp 2019-03-05 17:22:58 UTC (rev 242489)
+++ releases/WebKitGTK/webkit-2.24/Source/WTF/wtf/text/WTFString.cpp 2019-03-05 17:23:14 UTC (rev 242490)
@@ -449,61 +449,6 @@
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);
Modified: releases/WebKitGTK/webkit-2.24/Source/WTF/wtf/text/WTFString.h (242489 => 242490)
--- releases/WebKitGTK/webkit-2.24/Source/WTF/wtf/text/WTFString.h 2019-03-05 17:22:58 UTC (rev 242489)
+++ releases/WebKitGTK/webkit-2.24/Source/WTF/wtf/text/WTFString.h 2019-03-05 17:23:14 UTC (rev 242490)
@@ -261,8 +261,6 @@
// 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); }
Modified: releases/WebKitGTK/webkit-2.24/Source/WebCore/ChangeLog (242489 => 242490)
--- releases/WebKitGTK/webkit-2.24/Source/WebCore/ChangeLog 2019-03-05 17:22:58 UTC (rev 242489)
+++ releases/WebKitGTK/webkit-2.24/Source/WebCore/ChangeLog 2019-03-05 17:23:14 UTC (rev 242490)
@@ -1,3 +1,42 @@
+2019-03-01 Darin Adler <da...@apple.com>
+
+ Finish removing String::format
+ https://bugs.webkit.org/show_bug.cgi?id=194893
+
+ Reviewed by Daniel Bates.
+
+ * dom/Document.cpp:
+ (WebCore::Document::lastModified const): Use makeString and pad.
+ * html/FTPDirectoryDocument.cpp:
+ (WebCore::processFileDateString): Ditto.
+
+ * mathml/MathMLElement.cpp:
+ (WebCore::convertToPercentageIfNeeded): Use makeString and FormattedNumber.
+
+ * page/cocoa/ResourceUsageOverlayCocoa.mm:
+ (WebCore::ResourceUsageOverlay::platformDraw): Use makeString and pad.
+
+ * page/linux/ResourceUsageOverlayLinux.cpp:
+ (WebCore::cpuUsageString): Use makeString, FormattedNumber, 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-03-01 Youenn Fablet <you...@apple.com>
Serialize IndexedDB::ObjectStoreOverwriteMode as an enum
Modified: releases/WebKitGTK/webkit-2.24/Source/WebCore/dom/Document.cpp (242489 => 242490)
--- releases/WebKitGTK/webkit-2.24/Source/WebCore/dom/Document.cpp 2019-03-05 17:22:58 UTC (rev 242489)
+++ releases/WebKitGTK/webkit-2.24/Source/WebCore/dom/Document.cpp 2019-03-05 17:23:14 UTC (rev 242490)
@@ -5009,15 +5009,19 @@
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)
Modified: releases/WebKitGTK/webkit-2.24/Source/WebCore/html/FTPDirectoryDocument.cpp (242489 => 242490)
--- releases/WebKitGTK/webkit-2.24/Source/WebCore/html/FTPDirectoryDocument.cpp 2019-03-05 17:22:58 UTC (rev 242489)
+++ releases/WebKitGTK/webkit-2.24/Source/WebCore/html/FTPDirectoryDocument.cpp 2019-03-05 17:23:14 UTC (rev 242490)
@@ -210,12 +210,12 @@
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");
}
}
Modified: releases/WebKitGTK/webkit-2.24/Source/WebCore/mathml/MathMLElement.cpp (242489 => 242490)
--- releases/WebKitGTK/webkit-2.24/Source/WebCore/mathml/MathMLElement.cpp 2019-03-05 17:22:58 UTC (rev 242489)
+++ releases/WebKitGTK/webkit-2.24/Source/WebCore/mathml/MathMLElement.cpp 2019-03-05 17:23:14 UTC (rev 242490)
@@ -39,6 +39,7 @@
#include "MouseEvent.h"
#include "RenderTableCell.h"
#include <wtf/IsoMallocInlines.h>
+#include <wtf/text/StringConcatenateNumbers.h>
namespace WebCore {
@@ -99,11 +100,13 @@
static String convertToPercentageIfNeeded(const AtomicString& value)
{
+ // FIXME: Might be better to use double than float.
+ // FIXME: Might be better to use "shortest" numeric formatting instead of fixed width.
bool ok = false;
float unitlessValue = value.toFloat(&ok);
- if (ok)
- return String::format("%.3f%%", unitlessValue * 100.0);
- return value;
+ if (!ok)
+ return value;
+ return makeString(FormattedNumber::fixedWidth(unitlessValue * 100, 3), '%');
}
void MathMLElement::collectStyleForPresentationAttribute(const QualifiedName& name, const AtomicString& value, MutableStyleProperties& style)
@@ -116,7 +119,7 @@
addPropertyToPresentationAttributeStyle(style, CSSPropertyFontSize, convertToPercentageIfNeeded(value));
} else if (name == mathcolorAttr)
addPropertyToPresentationAttributeStyle(style, CSSPropertyColor, value);
- // FIXME: deprecated attributes that should loose in a conflict with a non deprecated attribute
+ // FIXME: The following are deprecated attributes that should lose if there is a conflict with a non-deprecated attribute.
else if (name == fontsizeAttr)
addPropertyToPresentationAttributeStyle(style, CSSPropertyFontSize, value);
else if (name == backgroundAttr)
@@ -134,8 +137,7 @@
addPropertyToPresentationAttributeStyle(style, CSSPropertyDirection, value);
} else {
ASSERT(!isPresentationAttribute(name));
- StyledElement::collectStyleForPresentationAttribute(name, value
- , style);
+ StyledElement::collectStyleForPresentationAttribute(name, value, style);
}
}
Modified: releases/WebKitGTK/webkit-2.24/Source/WebCore/page/cocoa/ResourceUsageOverlayCocoa.mm (242489 => 242490)
--- releases/WebKitGTK/webkit-2.24/Source/WebCore/page/cocoa/ResourceUsageOverlayCocoa.mm 2019-03-05 17:22:58 UTC (rev 242489)
+++ releases/WebKitGTK/webkit-2.24/Source/WebCore/page/cocoa/ResourceUsageOverlayCocoa.mm 2019-03-05 17:23:14 UTC (rev 242490)
@@ -468,7 +468,7 @@
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)
Modified: releases/WebKitGTK/webkit-2.24/Source/WebCore/page/linux/ResourceUsageOverlayLinux.cpp (242489 => 242490)
--- releases/WebKitGTK/webkit-2.24/Source/WebCore/page/linux/ResourceUsageOverlayLinux.cpp 2019-03-05 17:22:58 UTC (rev 242489)
+++ releases/WebKitGTK/webkit-2.24/Source/WebCore/page/linux/ResourceUsageOverlayLinux.cpp 2019-03-05 17:23:14 UTC (rev 242490)
@@ -46,7 +46,7 @@
{
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 @@
{
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;
Modified: releases/WebKitGTK/webkit-2.24/Source/WebCore/platform/DateComponents.cpp (242489 => 242490)
--- releases/WebKitGTK/webkit-2.24/Source/WebCore/platform/DateComponents.cpp 2019-03-05 17:22:58 UTC (rev 242489)
+++ releases/WebKitGTK/webkit-2.24/Source/WebCore/platform/DateComponents.cpp 2019-03-05 17:23:14 UTC (rev 242490)
@@ -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 @@
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 @@
{
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;
}
Modified: releases/WebKitGTK/webkit-2.24/Source/WebCore/platform/LocalizedStrings.cpp (242489 => 242490)
--- releases/WebKitGTK/webkit-2.24/Source/WebCore/platform/LocalizedStrings.cpp 2019-03-05 17:22:58 UTC (rev 242489)
+++ releases/WebKitGTK/webkit-2.24/Source/WebCore/platform/LocalizedStrings.cpp 2019-03-05 17:23:14 UTC (rev 242490)
@@ -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 @@
}
#if !USE(CF)
+
String localizedString(const char* key)
{
return String::fromUTF8(key, strlen(key));
}
+
#endif
#if ENABLE(CONTEXT_MENUS)
Modified: releases/WebKitGTK/webkit-2.24/Source/WebCore/platform/audio/HRTFElevation.cpp (242489 => 242490)
--- releases/WebKitGTK/webkit-2.24/Source/WebCore/platform/audio/HRTFElevation.cpp 2019-03-05 17:22:58 UTC (rev 242489)
+++ releases/WebKitGTK/webkit-2.24/Source/WebCore/platform/audio/HRTFElevation.cpp 2019-03-05 17:23:14 UTC (rev 242490)
@@ -176,7 +176,7 @@
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));
Modified: releases/WebKitGTK/webkit-2.24/Source/WebCore/platform/mock/MockRealtimeVideoSource.cpp (242489 => 242490)
--- releases/WebKitGTK/webkit-2.24/Source/WebCore/platform/mock/MockRealtimeVideoSource.cpp 2019-03-05 17:22:58 UTC (rev 242489)
+++ releases/WebKitGTK/webkit-2.24/Source/WebCore/platform/mock/MockRealtimeVideoSource.cpp 2019-03-05 17:23:14 UTC (rev 242490)
@@ -350,10 +350,10 @@
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);
Modified: releases/WebKitGTK/webkit-2.24/Source/WebCore/rendering/RenderLayerCompositor.cpp (242489 => 242490)
--- releases/WebKitGTK/webkit-2.24/Source/WebCore/rendering/RenderLayerCompositor.cpp 2019-03-05 17:22:58 UTC (rev 242489)
+++ releases/WebKitGTK/webkit-2.24/Source/WebCore/rendering/RenderLayerCompositor.cpp 2019-03-05 17:23:14 UTC (rev 242490)
@@ -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 @@
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()));
Modified: releases/WebKitGTK/webkit-2.24/Source/WebCore/rendering/RenderTheme.cpp (242489 => 242490)
--- releases/WebKitGTK/webkit-2.24/Source/WebCore/rendering/RenderTheme.cpp 2019-03-05 17:22:58 UTC (rev 242489)
+++ releases/WebKitGTK/webkit-2.24/Source/WebCore/rendering/RenderTheme.cpp 2019-03-05 17:23:14 UTC (rev 242490)
@@ -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 @@
{
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
Modified: releases/WebKitGTK/webkit-2.24/Source/WebKit/ChangeLog (242489 => 242490)
--- releases/WebKitGTK/webkit-2.24/Source/WebKit/ChangeLog 2019-03-05 17:22:58 UTC (rev 242489)
+++ releases/WebKitGTK/webkit-2.24/Source/WebKit/ChangeLog 2019-03-05 17:23:14 UTC (rev 242490)
@@ -1,3 +1,14 @@
+2019-03-01 Darin Adler <da...@apple.com>
+
+ Finish removing String::format
+ https://bugs.webkit.org/show_bug.cgi?id=194893
+
+ Reviewed by Daniel Bates.
+
+ * 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-03-01 Youenn Fablet <you...@apple.com>
Serialize IndexedDB::ObjectStoreOverwriteMode as an enum
Modified: releases/WebKitGTK/webkit-2.24/Source/WebKit/UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.mm (242489 => 242490)
--- releases/WebKitGTK/webkit-2.24/Source/WebKit/UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.mm 2019-03-05 17:22:58 UTC (rev 242489)
+++ releases/WebKitGTK/webkit-2.24/Source/WebKit/UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.mm 2019-03-05 17:23:14 UTC (rev 242490)
@@ -400,8 +400,10 @@
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)
Modified: releases/WebKitGTK/webkit-2.24/Source/WebKitLegacy/win/ChangeLog (242489 => 242490)
--- releases/WebKitGTK/webkit-2.24/Source/WebKitLegacy/win/ChangeLog 2019-03-05 17:22:58 UTC (rev 242489)
+++ releases/WebKitGTK/webkit-2.24/Source/WebKitLegacy/win/ChangeLog 2019-03-05 17:23:14 UTC (rev 242490)
@@ -1,3 +1,13 @@
+2019-02-20 Darin Adler <da...@apple.com>
+
+ Finish removing String::format
+ https://bugs.webkit.org/show_bug.cgi?id=194893
+
+ Reviewed by Daniel Bates.
+
+ * FullscreenVideoController.cpp:
+ (timeToString): Use makeString and pad.
+
2019-02-26 Philippe Normand <pnorm...@igalia.com>
[WPE] Add API for webview background color configuration
Modified: releases/WebKitGTK/webkit-2.24/Source/WebKitLegacy/win/FullscreenVideoController.cpp (242489 => 242490)
--- releases/WebKitGTK/webkit-2.24/Source/WebKitLegacy/win/FullscreenVideoController.cpp 2019-03-05 17:22:58 UTC (rev 242489)
+++ releases/WebKitGTK/webkit-2.24/Source/WebKitLegacy/win/FullscreenVideoController.cpp 2019-03-05 17:23:14 UTC (rev 242490)
@@ -41,6 +41,7 @@
#include <WebCore/TextRun.h>
#include <windowsx.h>
#include <wtf/StdLibExtras.h>
+#include <wtf/text/StringConcatenateNumbers.h>
#if USE(CA)
#include <WebCore/PlatformCALayerClient.h>
@@ -470,14 +471,9 @@
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()
Modified: releases/WebKitGTK/webkit-2.24/Tools/ChangeLog (242489 => 242490)
--- releases/WebKitGTK/webkit-2.24/Tools/ChangeLog 2019-03-05 17:22:58 UTC (rev 242489)
+++ releases/WebKitGTK/webkit-2.24/Tools/ChangeLog 2019-03-05 17:23:14 UTC (rev 242490)
@@ -1,3 +1,12 @@
+2019-03-01 Darin Adler <da...@apple.com>
+
+ Finish removing String::format
+ https://bugs.webkit.org/show_bug.cgi?id=194893
+
+ Reviewed by Daniel Bates.
+'
+ * Tools/TestWebKitAPI/Tests/WTF/StringConcatenate.cpp: Add tests for pad().
+
2019-03-01 Yusuke Suzuki <ysuz...@apple.com>
Unreviewed, fix lldb webkitpy tests
Modified: releases/WebKitGTK/webkit-2.24/Tools/TestWebKitAPI/Tests/WTF/StringConcatenate.cpp (242489 => 242490)
--- releases/WebKitGTK/webkit-2.24/Tools/TestWebKitAPI/Tests/WTF/StringConcatenate.cpp 2019-03-05 17:22:58 UTC (rev 242489)
+++ releases/WebKitGTK/webkit-2.24/Tools/TestWebKitAPI/Tests/WTF/StringConcatenate.cpp 2019-03-05 17:23:14 UTC (rev 242490)
@@ -26,11 +26,12 @@
#include "config.h"
#include "WTFStringUtilities.h"
-#include <wtf/text/StringConcatenate.h>
-#include <wtf/text/StringConcatenateNumbers.h>
#include <cstddef>
#include <cstdint>
#include <unicode/uvernum.h>
+#include <wtf/HexNumber.h>
+#include <wtf/text/StringConcatenate.h>
+#include <wtf/text/StringConcatenateNumbers.h>
namespace TestWebKitAPI {
@@ -156,4 +157,16 @@
EXPECT_STREQ("hello 0.000 world", makeString("hello ", FormattedNumber::fixedWidth(0.0, 3) , " world").utf8().data());
}
+TEST(WTF, StringConcatenate_Pad)
+{
+ EXPECT_STREQ("", makeString(pad('x', 0, "")).utf8().data());
+ EXPECT_STREQ("x", makeString(pad('x', 1, "")).utf8().data());
+ EXPECT_STREQ("y", makeString(pad('x', 1, "y")).utf8().data());
+ EXPECT_STREQ("xy", makeString(pad('x', 2, "y")).utf8().data());
+
+ EXPECT_STREQ("xxxxxxxxxxxxxxx1E240", makeString(pad('x', 20, hex(123456))).utf8().data());
+ EXPECT_STREQ("xxxxxxxxxxxxxxx1E2400.000", makeString(pad('x', 20, hex(123456)), FormattedNumber::fixedWidth(0.f, 3)).utf8().data());
+ EXPECT_STREQ(" B32AF0071F9 id 1231232312313231 (0.000,0.000-0.000,0.000) 0.00KB", makeString(pad(' ', 12, hex(12312312312313)), " id ", 1231232312313231, " (", FormattedNumber::fixedWidth(0.f, 3), ',', FormattedNumber::fixedWidth(0.f, 3), '-', FormattedNumber::fixedWidth(0.f, 3), ',', FormattedNumber::fixedWidth(0.f, 3), ") ", FormattedNumber::fixedWidth(0.f, 2), "KB").utf8().data());
}
+
+}