Changeset 249013 in webkit
- Timestamp:
- Aug 22, 2019, 9:26:04 AM (7 years ago)
- Location:
- trunk
- Files:
-
- 41 edited
-
Source/JavaScriptCore/ChangeLog (modified) (1 diff)
-
Source/JavaScriptCore/runtime/ExceptionHelpers.cpp (modified) (5 diffs)
-
Source/JavaScriptCore/runtime/FunctionConstructor.cpp (modified) (2 diffs)
-
Source/JavaScriptCore/runtime/Options.cpp (modified) (2 diffs)
-
Source/JavaScriptCore/runtime/TypeProfiler.cpp (modified) (2 diffs)
-
Source/JavaScriptCore/runtime/TypeSet.cpp (modified) (1 diff)
-
Source/WTF/ChangeLog (modified) (1 diff)
-
Source/WTF/wtf/DateMath.cpp (modified) (1 diff)
-
Source/WTF/wtf/JSONValues.cpp (modified) (1 diff)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/Modules/indexeddb/shared/IDBDatabaseInfo.cpp (modified) (1 diff)
-
Source/WebCore/Modules/indexeddb/shared/IDBObjectStoreInfo.cpp (modified) (2 diffs)
-
Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCUtils.cpp (modified) (2 diffs)
-
Source/WebCore/Modules/plugins/YouTubePluginReplacement.cpp (modified) (1 diff)
-
Source/WebCore/Modules/webdatabase/DatabaseTracker.cpp (modified) (1 diff)
-
Source/WebCore/Modules/websockets/WebSocketExtensionDispatcher.cpp (modified) (2 diffs)
-
Source/WebCore/Modules/websockets/WebSocketHandshake.cpp (modified) (1 diff)
-
Source/WebCore/bindings/js/JSDOMExceptionHandling.cpp (modified) (3 diffs)
-
Source/WebCore/contentextensions/CombinedURLFilters.cpp (modified) (1 diff)
-
Source/WebCore/css/CSSBasicShapes.cpp (modified) (6 diffs)
-
Source/WebCore/css/CSSCalculationValue.cpp (modified) (1 diff)
-
Source/WebCore/css/CSSComputedStyleDeclaration.cpp (modified) (1 diff)
-
Source/WebCore/css/CSSCrossfadeValue.cpp (modified) (1 diff)
-
Source/WebCore/css/CSSFilterImageValue.cpp (modified) (1 diff)
-
Source/WebCore/css/CSSFontFaceRule.cpp (modified) (1 diff)
-
Source/WebCore/css/CSSFontFaceSrcValue.cpp (modified) (1 diff)
-
Source/WebCore/css/CSSGradientValue.cpp (modified) (16 diffs)
-
Source/WebCore/css/CSSMediaRule.cpp (modified) (1 diff)
-
Source/WebCore/css/CSSNamespaceRule.cpp (modified) (1 diff)
-
Source/WebCore/css/CSSPageRule.cpp (modified) (1 diff)
-
Source/WebCore/css/CSSPrimitiveValue.cpp (modified) (1 diff)
-
Source/WebCore/css/CSSPropertySourceData.cpp (modified) (2 diffs)
-
Source/WebCore/css/CSSPropertySourceData.h (modified) (1 diff)
-
Source/WebCore/css/CSSStyleRule.cpp (modified) (1 diff)
-
Source/WebCore/css/parser/CSSParser.cpp (modified) (1 diff)
-
Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp (modified) (2 diffs)
-
Source/WebKit/ChangeLog (modified) (1 diff)
-
Source/WebKit/Shared/mac/AuxiliaryProcessMac.mm (modified) (1 diff)
-
Tools/ChangeLog (modified) (1 diff)
-
Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp (modified) (1 diff)
-
Tools/WebKitTestRunner/TestController.cpp (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r248989 r249013 1 2019-08-17 Darin Adler <darin@apple.com> 2 3 Use makeString and multi-argument StringBuilder::append instead of less efficient multiple appends 4 https://bugs.webkit.org/show_bug.cgi?id=200862 5 6 Reviewed by Ryosuke Niwa. 7 8 * runtime/ExceptionHelpers.cpp: 9 (JSC::createUndefinedVariableError): Got rid of unnecessary local variable. 10 (JSC::notAFunctionSourceAppender): Use single append instead of multiple. 11 Eliminate unneeded and unconventional use of makeString on a single string literal. 12 (JSC::invalidParameterInstanceofNotFunctionSourceAppender): Ditto. 13 (JSC::invalidParameterInstanceofhasInstanceValueNotFunctionSourceAppender): Ditto. 14 (JSC::createInvalidFunctionApplyParameterError): Ditto. 15 (JSC::createInvalidInParameterError): Ditto. 16 (JSC::createInvalidInstanceofParameterErrorNotFunction): Ditto. 17 (JSC::createInvalidInstanceofParameterErrorHasInstanceValueNotFunction): Ditto. 18 19 * runtime/FunctionConstructor.cpp: 20 (JSC::constructFunctionSkippingEvalEnabledCheck): Use single append instead of multiple. 21 * runtime/Options.cpp: 22 (JSC::Options::dumpOption): Ditto. 23 * runtime/TypeProfiler.cpp: 24 (JSC::TypeProfiler::typeInformationForExpressionAtOffset): Ditto. 25 * runtime/TypeSet.cpp: 26 (JSC::StructureShape::stringRepresentation): Ditto. Also use a modern for loop. 27 1 28 2019-08-21 Mark Lam <mark.lam@apple.com> 2 29 -
trunk/Source/JavaScriptCore/runtime/ExceptionHelpers.cpp
r248829 r249013 82 82 JSObject* createUndefinedVariableError(ExecState* exec, const Identifier& ident) 83 83 { 84 if (ident.isPrivateName()) { 85 String message(makeString("Can't find private variable: PrivateSymbol.", ident.string())); 86 return createReferenceError(exec, message); 87 } 88 String message(makeString("Can't find variable: ", ident.string())); 89 return createReferenceError(exec, message); 84 if (ident.isPrivateName()) 85 return createReferenceError(exec, makeString("Can't find private variable: PrivateSymbol.", ident.string())); 86 return createReferenceError(exec, makeString("Can't find variable: ", ident.string())); 90 87 } 91 88 … … 204 201 return defaultApproximateSourceError(originalMessage, sourceText); 205 202 StringBuilder builder(StringBuilder::OverflowHandler::RecordOverflow); 206 builder.append(base); 207 builder.appendLiteral(" is not a function. (In '"); 208 builder.append(sourceText); 209 builder.appendLiteral("', '"); 210 builder.append(base); 211 builder.appendLiteral("' is "); 203 builder.append(base, " is not a function. (In '", sourceText, "', '", base, "' is "); 212 204 if (type == TypeSymbol) 213 205 builder.appendLiteral("a Symbol"); … … 220 212 221 213 if (builder.hasOverflowed()) 222 return makeString("object is not a function."_s);214 return "object is not a function."_s; 223 215 224 216 return builder.toString(); … … 266 258 static String invalidParameterInstanceofNotFunctionSourceAppender(const String& originalMessage, const String& sourceText, RuntimeType runtimeType, ErrorInstance::SourceTextWhereErrorOccurred occurrence) 267 259 { 268 return invalidParameterInstanceofSourceAppender( WTF::makeString(" is not a function"), originalMessage, sourceText, runtimeType, occurrence);260 return invalidParameterInstanceofSourceAppender(" is not a function"_s, originalMessage, sourceText, runtimeType, occurrence); 269 261 } 270 262 271 263 static String invalidParameterInstanceofhasInstanceValueNotFunctionSourceAppender(const String& originalMessage, const String& sourceText, RuntimeType runtimeType, ErrorInstance::SourceTextWhereErrorOccurred occurrence) 272 264 { 273 return invalidParameterInstanceofSourceAppender( WTF::makeString("[Symbol.hasInstance] is not a function, undefined, or null"), originalMessage, sourceText, runtimeType, occurrence);265 return invalidParameterInstanceofSourceAppender("[Symbol.hasInstance] is not a function, undefined, or null"_s, originalMessage, sourceText, runtimeType, occurrence); 274 266 } 275 267 … … 297 289 JSObject* createInvalidFunctionApplyParameterError(ExecState* exec, JSValue value) 298 290 { 299 VM& vm = exec->vm(); 300 JSObject* exception = createTypeError(exec, makeString("second argument to Function.prototype.apply must be an Array-like object"), defaultSourceAppender, runtimeTypeForValue(vm, value)); 301 ASSERT(exception->isErrorInstance()); 302 return exception; 291 return createTypeError(exec, "second argument to Function.prototype.apply must be an Array-like object"_s, defaultSourceAppender, runtimeTypeForValue(exec->vm(), value)); 303 292 } 304 293 305 294 JSObject* createInvalidInParameterError(ExecState* exec, JSValue value) 306 295 { 307 return createError(exec, value, makeString("is not an Object."), invalidParameterInSourceAppender);296 return createError(exec, value, "is not an Object."_s, invalidParameterInSourceAppender); 308 297 } 309 298 310 299 JSObject* createInvalidInstanceofParameterErrorNotFunction(ExecState* exec, JSValue value) 311 300 { 312 return createError(exec, value, makeString(" is not a function"), invalidParameterInstanceofNotFunctionSourceAppender);301 return createError(exec, value, " is not a function"_s, invalidParameterInstanceofNotFunctionSourceAppender); 313 302 } 314 303 315 304 JSObject* createInvalidInstanceofParameterErrorHasInstanceValueNotFunction(ExecState* exec, JSValue value) 316 305 { 317 return createError(exec, value, makeString("[Symbol.hasInstance] is not a function, undefined, or null"), invalidParameterInstanceofhasInstanceValueNotFunctionSourceAppender);306 return createError(exec, value, "[Symbol.hasInstance] is not a function, undefined, or null"_s, invalidParameterInstanceofhasInstanceValueNotFunctionSourceAppender); 318 307 } 319 308 -
trunk/Source/JavaScriptCore/runtime/FunctionConstructor.cpp
r246780 r249013 113 113 } else { 114 114 StringBuilder builder(StringBuilder::OverflowHandler::RecordOverflow); 115 builder.append(prefix); 116 builder.append(functionName.string()); 115 builder.append(prefix, functionName.string(), '('); 117 116 118 builder.append('(');119 117 auto viewWithString = args.at(0).toString(exec)->viewWithUnderlyingString(exec); 120 118 RETURN_IF_EXCEPTION(scope, nullptr); 121 119 builder.append(viewWithString.view); 122 120 for (size_t i = 1; !builder.hasOverflowed() && i < args.size() - 1; i++) { 123 builder.appendLiteral(", ");124 121 auto viewWithString = args.at(i).toString(exec)->viewWithUnderlyingString(exec); 125 122 RETURN_IF_EXCEPTION(scope, nullptr); 126 builder.append( viewWithString.view);123 builder.append(", ", viewWithString.view); 127 124 } 128 125 if (builder.hasOverflowed()) { … … 132 129 133 130 functionConstructorParametersEndPosition = builder.length() + 1; 134 builder.appendLiteral(") {\n");135 131 136 132 auto body = args.at(args.size() - 1).toString(exec)->viewWithUnderlyingString(exec); 137 133 RETURN_IF_EXCEPTION(scope, nullptr); 138 builder.append(body.view); 139 builder.appendLiteral("\n}"); 134 builder.append(") {\n", body.view, "\n}"); 140 135 if (builder.hasOverflowed()) { 141 136 throwOutOfMemoryError(exec, scope); -
trunk/Source/JavaScriptCore/runtime/Options.cpp
r248143 r249013 867 867 if (header) 868 868 builder.append(header); 869 builder.append(option.name()); 870 builder.append('='); 869 builder.append(option.name(), '='); 871 870 option.dump(builder); 872 871 … … 877 876 } 878 877 879 if (needsDescription) { 880 builder.appendLiteral(" ... "); 881 builder.append(option.description()); 882 } 878 if (needsDescription) 879 builder.append(" ... ", option.description()); 883 880 884 881 builder.append(footer); -
trunk/Source/JavaScriptCore/runtime/TypeProfiler.cpp
r243467 r249013 94 94 json.append(','); 95 95 96 json.appendLiteral("\"instructionTypeSet\":"); 97 json.append(location->m_instructionTypeSet->toJSONString()); 98 json.append(','); 96 json.append("\"instructionTypeSet\":", location->m_instructionTypeSet->toJSONString(), ','); 99 97 100 98 json.appendLiteral("\"isOverflown\":"); … … 105 103 106 104 json.append('}'); 107 105 108 106 return json.toString(); 109 107 } -
trunk/Source/JavaScriptCore/runtime/TypeSet.cpp
r248898 r249013 413 413 representation.append('{'); 414 414 while (curShape) { 415 for (auto it = curShape->m_fields.begin(), end = curShape->m_fields.end(); it != end; ++it) { 416 String prop((*it).get()); 417 representation.append(prop); 418 representation.appendLiteral(", "); 419 } 420 421 if (curShape->m_proto) { 422 representation.appendLiteral("__proto__ ["); 423 representation.append(curShape->m_proto->m_constructorName); 424 representation.appendLiteral("], "); 425 } 426 415 for (auto& field : curShape->m_fields) 416 representation.append(StringView { field.get() }, ", "); 417 if (curShape->m_proto) 418 representation.append("__proto__ [", curShape->m_proto->m_constructorName, "], "); 427 419 curShape = curShape->m_proto; 428 420 } -
trunk/Source/WTF/ChangeLog
r248992 r249013 1 2019-08-17 Darin Adler <darin@apple.com> 2 3 Use makeString and multi-argument StringBuilder::append instead of less efficient multiple appends 4 https://bugs.webkit.org/show_bug.cgi?id=200862 5 6 Reviewed by Ryosuke Niwa. 7 8 * wtf/DateMath.cpp: 9 (WTF::makeRFC2822DateString): Use one append instead of multiple. 10 * wtf/JSONValues.cpp: 11 (WTF::appendDoubleQuotedString): Ditto. 12 1 13 2019-08-21 Mark Lam <mark.lam@apple.com> 2 14 -
trunk/Source/WTF/wtf/DateMath.cpp
r239427 r249013 1171 1171 { 1172 1172 StringBuilder stringBuilder; 1173 stringBuilder.append(weekdayName[dayOfWeek]); 1174 stringBuilder.appendLiteral(", "); 1175 stringBuilder.appendNumber(day); 1176 stringBuilder.append(' '); 1177 stringBuilder.append(monthName[month]); 1178 stringBuilder.append(' '); 1179 stringBuilder.appendNumber(year); 1180 stringBuilder.append(' '); 1173 stringBuilder.append(weekdayName[dayOfWeek], ", ", day, ' ', monthName[month], ' ', year, ' '); 1181 1174 1182 1175 appendTwoDigitNumber(stringBuilder, hours); -
trunk/Source/WTF/wtf/JSONValues.cpp
r246034 r249013 486 486 // We could handle surrogates here if callers wanted that; for now we just 487 487 // write them out as a \u sequence, so a surrogate pair appears as two of them. 488 builder.appendLiteral("\\u"); 489 builder.append(upperNibbleToASCIIHexDigit(codeUnit >> 8)); 490 builder.append(lowerNibbleToASCIIHexDigit(codeUnit >> 8)); 491 builder.append(upperNibbleToASCIIHexDigit(codeUnit)); 492 builder.append(lowerNibbleToASCIIHexDigit(codeUnit)); 488 builder.append("\\u", 489 upperNibbleToASCIIHexDigit(codeUnit >> 8), lowerNibbleToASCIIHexDigit(codeUnit >> 8), 490 upperNibbleToASCIIHexDigit(codeUnit), lowerNibbleToASCIIHexDigit(codeUnit)); 493 491 } 494 492 builder.append('"'); -
trunk/Source/WebCore/ChangeLog
r249007 r249013 1 2019-08-17 Darin Adler <darin@apple.com> 2 3 Use makeString and multi-argument StringBuilder::append instead of less efficient multiple appends 4 https://bugs.webkit.org/show_bug.cgi?id=200862 5 6 Reviewed by Ryosuke Niwa. 7 8 * Modules/indexeddb/shared/IDBDatabaseInfo.cpp: 9 (WebCore::IDBDatabaseInfo::loggingString const): Use one append instead of multiple. 10 * Modules/indexeddb/shared/IDBObjectStoreInfo.cpp: 11 (WebCore::IDBObjectStoreInfo::loggingString const): Ditto. 12 * Modules/mediastream/libwebrtc/LibWebRTCUtils.cpp: 13 (WebCore::toRTCCodecParameters): Ditto. 14 * Modules/plugins/YouTubePluginReplacement.cpp: 15 (WebCore::YouTubePluginReplacement::youTubeURLFromAbsoluteURL): Ditto. 16 * Modules/webdatabase/DatabaseTracker.cpp: 17 (WebCore::generateDatabaseFileName): Ditto. 18 * Modules/websockets/WebSocketExtensionDispatcher.cpp: 19 (WebCore::WebSocketExtensionDispatcher::createHeaderValue const): Ditto. 20 (WebCore::WebSocketExtensionDispatcher::appendAcceptedExtension): Ditto. 21 22 * Modules/websockets/WebSocketHandshake.cpp: 23 (WebCore::WebSocketHandshake::clientLocation const): Use makeString instead of 24 StringBuilder. 25 26 * bindings/js/JSDOMExceptionHandling.cpp: 27 (WebCore::appendArgumentMustBe): Use one append instead of multiple. 28 (WebCore::throwArgumentMustBeEnumError): Ditto. 29 (WebCore::throwArgumentTypeError): Ditto. 30 * contentextensions/CombinedURLFilters.cpp: 31 (WebCore::ContentExtensions::recursivePrint): Ditto. 32 * css/CSSBasicShapes.cpp: 33 (WebCore::buildCircleString): Ditto. 34 (WebCore::buildEllipseString): Ditto. 35 (WebCore::buildPolygonString): Ditto. 36 (WebCore::buildInsetString): Ditto. 37 38 * css/CSSCalculationValue.cpp: 39 (WebCore::buildCssText): Deleted. 40 (WebCore::CSSCalcValue::customCSSText const): Use makeString. 41 42 * css/CSSComputedStyleDeclaration.cpp: 43 (WebCore::CSSComputedStyleDeclaration::cssText const): Use one append instead of multiple. 44 45 * css/CSSCrossfadeValue.cpp: 46 (WebCore::CSSCrossfadeValue::customCSSText const): Use makeString. 47 * css/CSSFilterImageValue.cpp: 48 (WebCore::CSSFilterImageValue::customCSSText const): Ditto. 49 * css/CSSFontFaceRule.cpp: 50 (WebCore::CSSFontFaceRule::cssText const): Ditto. 51 * css/CSSFontFaceSrcValue.cpp: 52 (WebCore::CSSFontFaceSrcValue::customCSSText const): Ditto. 53 54 * css/CSSGradientValue.cpp: 55 (WebCore::appendGradientStops): Moved code here from CSSLinearGradientValue::customCSSText 56 so it can be shared with CSSRadialGradientValue::customCSSText. Use one append per stop. 57 (WebCore::CSSLinearGradientValue::customCSSText const): Use one append instead of multiple. 58 (WebCore::CSSRadialGradientValue::customCSSText const): Ditto. 59 (WebCore::CSSConicGradientValue::customCSSText const): Ditto. 60 * css/CSSMediaRule.cpp: 61 (WebCore::CSSMediaRule::cssText const): Ditto. 62 * css/CSSNamespaceRule.cpp: 63 (WebCore::CSSNamespaceRule::cssText const): Ditto. 64 65 * css/CSSPageRule.cpp: 66 (WebCore::CSSPageRule::selectorText const): Use makeString. 67 68 * css/CSSPrimitiveValue.cpp: 69 (WebCore::CSSPrimitiveValue::formatNumberForCustomCSSText const): 70 Use one append instead of multiple. 71 72 * css/CSSPropertySourceData.cpp: 73 (WebCore::CSSPropertySourceData::CSSPropertySourceData): Initialize in the 74 structure definition instead of the constructor. 75 (WebCore::CSSPropertySourceData::toString const): Use makeString. 76 * css/CSSPropertySourceData.h: Initialize in the structure definition. 77 78 * css/CSSStyleRule.cpp: 79 (WebCore::CSSStyleRule::cssText const): Use makeString. 80 81 * css/parser/CSSParser.cpp: 82 (WebCore::CSSParser::parseFontFaceDescriptor): Use makeString. 83 84 * html/canvas/CanvasRenderingContext2D.cpp: 85 (WebCore::CanvasRenderingContext2D::font const): Use one append instead of multiple. 86 1 87 2019-08-22 Kai Ninomiya <kainino@chromium.org> 2 88 -
trunk/Source/WebCore/Modules/indexeddb/shared/IDBDatabaseInfo.cpp
r239427 r249013 157 157 158 158 #if !LOG_DISABLED 159 159 160 String IDBDatabaseInfo::loggingString() const 160 161 { 161 162 StringBuilder builder; 162 builder.appendLiteral("Database:"); 163 builder.append(m_name); 164 builder.appendLiteral(" version "); 165 builder.appendNumber(m_version); 166 builder.append('\n'); 167 for (const auto& objectStore : m_objectStoreMap.values()) { 168 builder.append(objectStore.loggingString(1)); 169 builder.append('\n'); 170 } 171 163 builder.append("Database:", m_name, " version ", m_version, '\n'); 164 for (auto& objectStore : m_objectStoreMap.values()) 165 builder.append(objectStore.loggingString(1), '\n'); 172 166 return builder.toString(); 173 167 } 168 174 169 #endif 175 170 -
trunk/Source/WebCore/Modules/indexeddb/shared/IDBObjectStoreInfo.cpp
r240557 r249013 135 135 136 136 #if !LOG_DISABLED 137 137 138 String IDBObjectStoreInfo::loggingString(int indent) const 138 139 { … … 140 141 for (int i = 0; i < indent; ++i) 141 142 builder.append(' '); 142 143 builder.appendLiteral("Object store: "); 144 builder.append(m_name); 145 builder.appendNumber(m_identifier); 146 for (auto index : m_indexMap.values()) { 147 builder.append(index.loggingString(indent + 1)); 148 builder.append('\n'); 149 } 150 143 builder.append("Object store: ", m_name, m_identifier); 144 for (auto index : m_indexMap.values()) 145 builder.append(index.loggingString(indent + 1), '\n'); 151 146 return builder.toString(); 152 147 } -
trunk/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCUtils.cpp
r239532 r249013 105 105 106 106 StringBuilder sdpFmtpLineBuilder; 107 sdpFmtpLineBuilder.appendLiteral("a=fmtp:"); 108 sdpFmtpLineBuilder.appendNumber(parameters.payloadType); 109 sdpFmtpLineBuilder.append(' '); 107 sdpFmtpLineBuilder.append("a=fmtp:", parameters.payloadType, ' '); 110 108 111 109 bool isFirst = true; … … 115 113 else 116 114 isFirst = false; 117 118 sdpFmtpLineBuilder.append(StringView { keyValue.first.c_str() }); 119 sdpFmtpLineBuilder.append('='); 120 sdpFmtpLineBuilder.append(StringView { keyValue.second.c_str() }); 115 sdpFmtpLineBuilder.append(keyValue.first.c_str(), '=', keyValue.second.c_str()); 121 116 } 122 117 parameters.sdpFmtpLine = sdpFmtpLineBuilder.toString(); -
trunk/Source/WebCore/Modules/plugins/YouTubePluginReplacement.cpp
r246490 r249013 328 328 else 329 329 finalURL.append(srcURLPrefix); 330 finalURL.appendLiteral("/embed/"); 331 finalURL.append(videoID); 332 if (!query.isEmpty()) { 333 finalURL.append('?'); 334 finalURL.append(query); 335 } 330 finalURL.append("/embed/", videoID); 331 if (!query.isEmpty()) 332 finalURL.append('?', query); 336 333 return finalURL.toString(); 337 334 } -
trunk/Source/WebCore/Modules/webdatabase/DatabaseTracker.cpp
r248846 r249013 309 309 static String generateDatabaseFileName() 310 310 { 311 StringBuilder stringBuilder; 312 313 stringBuilder.append(createCanonicalUUIDString()); 314 stringBuilder.appendLiteral(".db"); 315 316 return stringBuilder.toString(); 311 return makeString(createCanonicalUUIDString(), ".db"); 317 312 } 318 313 -
trunk/Source/WebCore/Modules/websockets/WebSocketExtensionDispatcher.cpp
r220250 r249013 65 65 StringBuilder builder; 66 66 builder.append(m_processors[0]->handshakeString()); 67 for (size_t i = 1; i < numProcessors; ++i) { 68 builder.appendLiteral(", "); 69 builder.append(m_processors[i]->handshakeString()); 70 } 67 for (size_t i = 1; i < numProcessors; ++i) 68 builder.append(", ", m_processors[i]->handshakeString()); 71 69 return builder.toString(); 72 70 } … … 79 77 // FIXME: Should use ListHashSet to keep the order of the parameters. 80 78 for (auto& parameter : extensionParameters) { 81 m_acceptedExtensionsBuilder.appendLiteral("; "); 82 m_acceptedExtensionsBuilder.append(parameter.key); 83 if (!parameter.value.isNull()) { 84 m_acceptedExtensionsBuilder.append('='); 85 m_acceptedExtensionsBuilder.append(parameter.value); 86 } 79 m_acceptedExtensionsBuilder.append("; ", parameter.key); 80 if (!parameter.value.isNull()) 81 m_acceptedExtensionsBuilder.append('=', parameter.value); 87 82 } 88 83 } -
trunk/Source/WebCore/Modules/websockets/WebSocketHandshake.cpp
r244391 r249013 167 167 String WebSocketHandshake::clientLocation() const 168 168 { 169 StringBuilder builder; 170 builder.append(m_secure ? "wss" : "ws"); 171 builder.appendLiteral("://"); 172 builder.append(hostName(m_url, m_secure)); 173 builder.append(resourceName(m_url)); 174 return builder.toString(); 169 return makeString(m_secure ? "wss" : "ws", "://", hostName(m_url, m_secure), resourceName(m_url)); 175 170 } 176 171 -
trunk/Source/WebCore/bindings/js/JSDOMExceptionHandling.cpp
r244312 r249013 171 171 static void appendArgumentMustBe(StringBuilder& builder, unsigned argumentIndex, const char* argumentName, const char* interfaceName, const char* functionName) 172 172 { 173 builder.appendLiteral("Argument "); 174 builder.appendNumber(argumentIndex + 1); 175 builder.appendLiteral(" ('"); 176 builder.append(argumentName); 177 builder.appendLiteral("') to "); 178 if (!functionName) { 179 builder.appendLiteral("the "); 180 builder.append(interfaceName); 181 builder.appendLiteral(" constructor"); 182 } else { 183 builder.append(interfaceName); 184 builder.append('.'); 185 builder.append(functionName); 186 } 173 builder.append("Argument ", argumentIndex + 1, " ('", argumentName, "') to "); 174 if (!functionName) 175 builder.append("the ", interfaceName, " constructor"); 176 else 177 builder.append(interfaceName, '.', functionName); 187 178 builder.appendLiteral(" must be "); 188 179 } … … 210 201 StringBuilder builder; 211 202 appendArgumentMustBe(builder, argumentIndex, argumentName, functionInterfaceName, functionName); 212 builder.appendLiteral("one of: "); 213 builder.append(expectedValues); 203 builder.append("one of: ", expectedValues); 214 204 return throwVMTypeError(&state, scope, builder.toString()); 215 205 } … … 227 217 StringBuilder builder; 228 218 appendArgumentMustBe(builder, argumentIndex, argumentName, functionInterfaceName, functionName); 229 builder.appendLiteral("an instance of "); 230 builder.append(expectedType); 219 builder.append("an instance of ", expectedType); 231 220 return throwVMTypeError(&state, scope, builder.toString()); 232 221 } -
trunk/Source/WebCore/contentextensions/CombinedURLFilters.cpp
r248846 r249013 120 120 for (unsigned i = 0; i < depth * 2; ++i) 121 121 builder.append(' '); 122 builder.appendLiteral("vertex edge: "); 123 builder.append(edge.term->toString()); 124 builder.append('\n'); 122 builder.append("vertex edge: ", edge.term->toString(), '\n'); 125 123 dataLogF("%s", builder.toString().utf8().data()); 126 124 ASSERT(edge.child); -
trunk/Source/WebCore/css/CSSBasicShapes.cpp
r240641 r249013 87 87 static String buildCircleString(const String& radius, const String& centerX, const String& centerY) 88 88 { 89 char opening[] = "circle(";90 char at[] = "at";91 char separator[] = " ";92 89 StringBuilder result; 93 result.appendLiteral( opening);90 result.appendLiteral("circle("); 94 91 if (!radius.isNull()) 95 92 result.append(radius); 96 97 93 if (!centerX.isNull() || !centerY.isNull()) { 98 94 if (!radius.isNull()) 99 result.appendLiteral(separator); 100 result.appendLiteral(at); 101 result.appendLiteral(separator); 102 result.append(centerX); 103 result.appendLiteral(separator); 104 result.append(centerY); 105 } 106 result.appendLiteral(")"); 95 result.append(' '); 96 result.append("at ", centerX, ' ', centerY); 97 } 98 result.append(')'); 107 99 return result.toString(); 108 100 } … … 135 127 static String buildEllipseString(const String& radiusX, const String& radiusY, const String& centerX, const String& centerY) 136 128 { 137 char opening[] = "ellipse(";138 char at[] = "at";139 char separator[] = " ";140 129 StringBuilder result; 141 result.appendLiteral( opening);130 result.appendLiteral("ellipse("); 142 131 bool needsSeparator = false; 143 132 if (!radiusX.isNull()) { … … 147 136 if (!radiusY.isNull()) { 148 137 if (needsSeparator) 149 result.append Literal(separator);138 result.append(' '); 150 139 result.append(radiusY); 151 140 needsSeparator = true; 152 141 } 153 154 142 if (!centerX.isNull() || !centerY.isNull()) { 155 143 if (needsSeparator) 156 result.appendLiteral(separator); 157 result.appendLiteral(at); 158 result.appendLiteral(separator); 159 result.append(centerX); 160 result.appendLiteral(separator); 161 result.append(centerY); 162 } 163 result.appendLiteral(")"); 144 result.append(' '); 145 result.append("at ", centerX, ' ', centerY); 146 } 147 result.append(')'); 164 148 return result.toString(); 165 149 } … … 271 255 if (i) 272 256 result.appendLiteral(commaSeparator); 273 result.append(points[i]); 274 result.append(' '); 275 result.append(points[i + 1]); 257 result.append(points[i], ' ', points[i + 1]); 276 258 } 277 259 … … 323 305 const String& bottomLeftRadiusWidth, const String& bottomLeftRadiusHeight) 324 306 { 325 char opening[] = "inset(";326 char separator[] = " ";327 char cornersSeparator[] = "round";328 307 StringBuilder result; 329 result.appendLiteral(opening); 330 result.append(top); 308 result.append("inset(", top); 331 309 332 310 bool showLeftArg = !left.isNull() && left != right; 333 311 bool showBottomArg = !bottom.isNull() && (bottom != top || showLeftArg); 334 312 bool showRightArg = !right.isNull() && (right != top || showBottomArg); 335 if (showRightArg) { 336 result.appendLiteral(separator); 337 result.append(right); 338 } 339 if (showBottomArg) { 340 result.appendLiteral(separator); 341 result.append(bottom); 342 } 343 if (showLeftArg) { 344 result.appendLiteral(separator); 345 result.append(left); 346 } 313 if (showRightArg) 314 result.append(' ', right); 315 if (showBottomArg) 316 result.append(' ', bottom); 317 if (showLeftArg) 318 result.append(' ', left); 347 319 348 320 if (!topLeftRadiusWidth.isNull() && !topLeftRadiusHeight.isNull()) { … … 354 326 355 327 if (!areDefaultCornerRadii) { 356 result.appendLiteral(separator); 357 result.appendLiteral(cornersSeparator); 358 359 for (size_t i = 0; i < horizontalRadii.size(); ++i) { 360 result.appendLiteral(separator); 361 result.append(horizontalRadii[i]); 362 } 328 result.appendLiteral(" round"); 329 330 for (auto& radius : horizontalRadii) 331 result.append(' ', radius); 363 332 364 333 if (verticalRadii.size() != horizontalRadii.size() 365 334 || !WTF::VectorComparer<false, String>::compare(verticalRadii.data(), horizontalRadii.data(), verticalRadii.size())) { 366 result.appendLiteral(separator); 367 result.appendLiteral("/"); 368 369 for (size_t i = 0; i < verticalRadii.size(); ++i) { 370 result.appendLiteral(separator); 371 result.append(verticalRadii[i]); 372 } 335 result.appendLiteral(" /"); 336 for (auto& radius : verticalRadii) 337 result.append(' ', radius); 373 338 } 374 339 } -
trunk/Source/WebCore/css/CSSCalculationValue.cpp
r248846 r249013 150 150 } 151 151 152 static String buildCssText(const String& expression)153 {154 StringBuilder result;155 result.appendLiteral("calc");156 bool expressionHasSingleTerm = expression[0] != '(';157 if (expressionHasSingleTerm)158 result.append('(');159 result.append(expression);160 if (expressionHasSingleTerm)161 result.append(')');162 return result.toString();163 }164 165 152 String CSSCalcValue::customCSSText() const 166 153 { 167 return buildCssText(m_expression->customCSSText()); 154 auto expression = m_expression->customCSSText(); 155 if (expression[0] == '(') 156 return makeString("calc", expression); 157 return makeString("calc(", expression, ')'); 168 158 } 169 159 -
trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp
r247388 r249013 1692 1692 { 1693 1693 StringBuilder result; 1694 1695 1694 for (unsigned i = 0; i < numComputedProperties; i++) { 1696 1695 if (i) 1697 1696 result.append(' '); 1698 result.append(getPropertyName(computedProperties[i])); 1699 result.appendLiteral(": "); 1700 result.append(getPropertyValue(computedProperties[i])); 1701 result.append(';'); 1702 } 1703 1697 result.append(getPropertyName(computedProperties[i]), ": ", getPropertyValue(computedProperties[i]), ';'); 1698 } 1704 1699 return result.toString(); 1705 1700 } -
trunk/Source/WebCore/css/CSSCrossfadeValue.cpp
r231105 r249013 92 92 String CSSCrossfadeValue::customCSSText() const 93 93 { 94 StringBuilder result; 95 if (m_isPrefixed) 96 result.appendLiteral("-webkit-cross-fade("); 97 else 98 result.appendLiteral("cross-fade("); 99 result.append(m_fromValue->cssText()); 100 result.appendLiteral(", "); 101 result.append(m_toValue->cssText()); 102 result.appendLiteral(", "); 103 result.append(m_percentageValue->cssText()); 104 result.append(')'); 105 return result.toString(); 94 return makeString(m_isPrefixed ? "-webkit-" : "", "cross-fade(", m_fromValue->cssText(), ", ", m_toValue->cssText(), ", ", m_percentageValue->cssText(), ')'); 106 95 } 107 96 -
trunk/Source/WebCore/css/CSSFilterImageValue.cpp
r235630 r249013 48 48 String CSSFilterImageValue::customCSSText() const 49 49 { 50 StringBuilder result; 51 result.appendLiteral("filter("); 52 result.append(m_imageValue->cssText()); 53 result.appendLiteral(", "); 54 result.append(m_filterValue->cssText()); 55 result.append(')'); 56 return result.toString(); 50 return makeString("filter(", m_imageValue->cssText(), ", ", m_filterValue->cssText(), ')'); 57 51 } 58 52 -
trunk/Source/WebCore/css/CSSFontFaceRule.cpp
r177228 r249013 51 51 String CSSFontFaceRule::cssText() const 52 52 { 53 StringBuilder result; 54 result.appendLiteral("@font-face { "); 55 String descs = m_fontFaceRule->properties().asText(); 56 result.append(descs); 57 if (!descs.isEmpty()) 58 result.append(' '); 59 result.append('}'); 60 return result.toString(); 53 String declarations = m_fontFaceRule->properties().asText(); 54 if (declarations.isEmpty()) 55 return "@font-face { }"_s; 56 return makeString("@font-face { ", declarations, " }"); 61 57 } 62 58 -
trunk/Source/WebCore/css/CSSFontFaceSrcValue.cpp
r238698 r249013 70 70 String CSSFontFaceSrcValue::customCSSText() const 71 71 { 72 StringBuilder result; 73 if (isLocal()) 74 result.appendLiteral("local("); 75 else 76 result.appendLiteral("url("); 77 result.append(m_resource); 78 result.append(')'); 79 if (!m_format.isEmpty()) { 80 result.appendLiteral(" format("); 81 result.append(m_format); 82 result.append(')'); 83 } 84 return result.toString(); 72 const char* prefix = isLocal() ? "local(" : "url("; 73 if (m_format.isEmpty()) 74 return makeString(prefix, m_resource, ')'); 75 return makeString(prefix, m_resource, ')', " format(", m_format, ')'); 85 76 } 86 77 -
trunk/Source/WebCore/css/CSSGradientValue.cpp
r243163 r249013 1 1 /* 2 * Copyright (C) 2008 Apple Inc. All rights reserved.2 * Copyright (C) 2008 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 231 231 class ConicGradientAdapter { 232 232 public: 233 explicit ConicGradientAdapter() { }234 233 float gradientLength() const { return 1; } 235 234 float maxExtent(float, float) const { return 1; } … … 668 667 } 669 668 669 static void appendGradientStops(StringBuilder& builder, const Vector<CSSGradientColorStop, 2>& stops) 670 { 671 for (auto& stop : stops) { 672 double position = stop.m_position->doubleValue(CSSPrimitiveValue::CSS_NUMBER); 673 if (!position) 674 builder.append(", from(", stop.m_color->cssText(), ')'); 675 else if (position == 1) 676 builder.append(", to(", stop.m_color->cssText(), ')'); 677 else 678 builder.append(", color-stop(", FormattedNumber::fixedPrecision(position), ", ", stop.m_color->cssText(), ')'); 679 } 680 } 681 670 682 String CSSLinearGradientValue::customCSSText() const 671 683 { 672 684 StringBuilder result; 673 685 if (m_gradientType == CSSDeprecatedLinearGradient) { 674 result.appendLiteral("-webkit-gradient(linear, "); 675 result.append(m_firstX->cssText()); 676 result.append(' '); 677 result.append(m_firstY->cssText()); 678 result.appendLiteral(", "); 679 result.append(m_secondX->cssText()); 680 result.append(' '); 681 result.append(m_secondY->cssText()); 682 683 for (auto& stop : m_stops) { 684 result.appendLiteral(", "); 685 auto position = stop.m_position->doubleValue(CSSPrimitiveValue::CSS_NUMBER); 686 if (!position) { 687 result.appendLiteral("from("); 688 result.append(stop.m_color->cssText()); 689 result.append(')'); 690 } else if (position == 1) { 691 result.appendLiteral("to("); 692 result.append(stop.m_color->cssText()); 693 result.append(')'); 694 } else { 695 result.appendLiteral("color-stop("); 696 result.appendFixedPrecisionNumber(position); 697 result.appendLiteral(", "); 698 result.append(stop.m_color->cssText()); 699 result.append(')'); 700 } 701 } 686 result.append("-webkit-gradient(linear, ", m_firstX->cssText(), ' ', m_firstY->cssText(), ", ", m_secondX->cssText(), ' ', m_secondY->cssText()); 687 appendGradientStops(result, m_stops); 702 688 } else if (m_gradientType == CSSPrefixedLinearGradient) { 703 689 if (m_repeating) … … 709 695 result.append(m_angle->cssText()); 710 696 else { 711 if (m_firstX && m_firstY) { 697 if (m_firstX && m_firstY) 698 result.append(m_firstX->cssText(), ' ', m_firstY->cssText()); 699 else if (m_firstX) 712 700 result.append(m_firstX->cssText()); 713 result.append(' ');701 else if (m_firstY) 714 702 result.append(m_firstY->cssText()); 715 } else if (m_firstX || m_firstY) { 716 if (m_firstX) 717 result.append(m_firstX->cssText()); 718 719 if (m_firstY) 720 result.append(m_firstY->cssText()); 721 } 722 } 723 724 for (unsigned i = 0; i < m_stops.size(); i++) { 725 auto& stop = m_stops[i]; 726 result.appendLiteral(", "); 727 result.append(stop.m_color->cssText()); 728 if (stop.m_position) { 729 result.append(' '); 730 result.append(stop.m_position->cssText()); 731 } 703 } 704 705 for (auto& stop : m_stops) { 706 result.append(", ", stop.m_color->cssText()); 707 if (stop.m_position) 708 result.append(' ', stop.m_position->cssText()); 732 709 } 733 710 } else { … … 744 721 } else if ((m_firstX || m_firstY) && !(!m_firstX && m_firstY && m_firstY->valueID() == CSSValueBottom)) { 745 722 result.appendLiteral("to "); 746 if (m_firstX && m_firstY) { 747 result.append(m_firstX->cssText()); 748 result.append(' '); 749 result.append(m_firstY->cssText()); 750 } else if (m_firstX) 723 if (m_firstX && m_firstY) 724 result.append(m_firstX->cssText(), ' ', m_firstY->cssText()); 725 else if (m_firstX) 751 726 result.append(m_firstX->cssText()); 752 727 else … … 758 733 result.appendLiteral(", "); 759 734 760 for (unsigned i = 0; i < m_stops.size(); i++) {761 const CSSGradientColorStop& stop = m_stops[i];762 if ( i)735 bool wroteFirstStop = false; 736 for (auto& stop : m_stops) { 737 if (wroteFirstStop) 763 738 result.appendLiteral(", "); 739 wroteFirstStop = true; 764 740 if (!stop.isMidpoint) 765 741 result.append(stop.m_color->cssText()); … … 770 746 } 771 747 } 772 773 748 } 774 749 … … 948 923 949 924 if (m_gradientType == CSSDeprecatedRadialGradient) { 950 result.appendLiteral("-webkit-gradient(radial, "); 951 result.append(m_firstX->cssText()); 952 result.append(' '); 953 result.append(m_firstY->cssText()); 954 result.appendLiteral(", "); 955 result.append(m_firstRadius->cssText()); 956 result.appendLiteral(", "); 957 result.append(m_secondX->cssText()); 958 result.append(' '); 959 result.append(m_secondY->cssText()); 960 result.appendLiteral(", "); 961 result.append(m_secondRadius->cssText()); 962 963 // FIXME: share? 964 for (auto& stop : m_stops) { 965 result.appendLiteral(", "); 966 auto position = stop.m_position->doubleValue(CSSPrimitiveValue::CSS_NUMBER); 967 if (!position) { 968 result.appendLiteral("from("); 969 result.append(stop.m_color->cssText()); 970 result.append(')'); 971 } else if (position == 1) { 972 result.appendLiteral("to("); 973 result.append(stop.m_color->cssText()); 974 result.append(')'); 975 } else { 976 result.appendLiteral("color-stop("); 977 result.appendFixedPrecisionNumber(position); 978 result.appendLiteral(", "); 979 result.append(stop.m_color->cssText()); 980 result.append(')'); 981 } 982 } 925 result.append("-webkit-gradient(radial, ", m_firstX->cssText(), ' ', m_firstY->cssText(), ", ", m_firstRadius->cssText(), 926 ", ", m_secondX->cssText(), ' ', m_secondY->cssText(), ", ", m_secondRadius->cssText()); 927 appendGradientStops(result, m_stops); 983 928 } else if (m_gradientType == CSSPrefixedRadialGradient) { 984 929 if (m_repeating) … … 987 932 result.appendLiteral("-webkit-radial-gradient("); 988 933 989 if (m_firstX && m_firstY) { 934 if (m_firstX && m_firstY) 935 result.append(m_firstX->cssText(), ' ', m_firstY->cssText()); 936 else if (m_firstX) 990 937 result.append(m_firstX->cssText()); 991 result.append(' '); 992 result.append(m_firstY->cssText()); 993 } else if (m_firstX) 994 result.append(m_firstX->cssText()); 995 else if (m_firstY) 938 else if (m_firstY) 996 939 result.append(m_firstY->cssText()); 997 940 else … … 1000 943 if (m_shape || m_sizingBehavior) { 1001 944 result.appendLiteral(", "); 1002 if (m_shape) { 1003 result.append(m_shape->cssText()); 1004 result.append(' '); 1005 } else 945 if (m_shape) 946 result.append(m_shape->cssText(), ' '); 947 else 1006 948 result.appendLiteral("ellipse "); 1007 1008 949 if (m_sizingBehavior) 1009 950 result.append(m_sizingBehavior->cssText()); 1010 951 else 1011 952 result.appendLiteral("cover"); 1012 1013 } else if (m_endHorizontalSize && m_endVerticalSize) { 1014 result.appendLiteral(", "); 1015 result.append(m_endHorizontalSize->cssText()); 1016 result.append(' '); 1017 result.append(m_endVerticalSize->cssText()); 1018 } 1019 1020 for (unsigned i = 0; i < m_stops.size(); i++) { 1021 const CSSGradientColorStop& stop = m_stops[i]; 1022 result.appendLiteral(", "); 1023 result.append(stop.m_color->cssText()); 1024 if (stop.m_position) { 1025 result.append(' '); 1026 result.append(stop.m_position->cssText()); 1027 } 953 } else if (m_endHorizontalSize && m_endVerticalSize) 954 result.append(", ", m_endHorizontalSize->cssText(), ' ', m_endVerticalSize->cssText()); 955 956 for (auto& stop : m_stops) { 957 result.append(", ", stop.m_color->cssText()); 958 if (stop.m_position) 959 result.append(' ', stop.m_position->cssText()); 1028 960 } 1029 961 } else { … … 1051 983 result.append(' '); 1052 984 result.append(m_endHorizontalSize->cssText()); 1053 if (m_endVerticalSize) { 1054 result.append(' '); 1055 result.append(m_endVerticalSize->cssText()); 1056 } 985 if (m_endVerticalSize) 986 result.append(' ', m_endVerticalSize->cssText()); 1057 987 wroteSomething = true; 1058 988 } … … 1062 992 result.append(' '); 1063 993 result.appendLiteral("at "); 1064 if (m_firstX && m_firstY) { 1065 result.append(m_firstX->cssText()); 1066 result.append(' '); 1067 result.append(m_firstY->cssText()); 1068 } else if (m_firstX) 994 if (m_firstX && m_firstY) 995 result.append(m_firstX->cssText(), ' ', m_firstY->cssText()); 996 else if (m_firstX) 1069 997 result.append(m_firstX->cssText()); 1070 998 else … … 1098 1026 { 1099 1027 float result = 0; 1100 if (radius.isNumber()) // Can the radius be a percentage?1028 if (radius.isNumber()) 1101 1029 result = radius.floatValue() * conversionData.zoom(); 1102 1030 else if (widthOrHeight && radius.isPercentage()) … … 1104 1032 else 1105 1033 result = radius.computeLength<float>(conversionData); 1106 1107 1034 return result; 1108 1035 } … … 1387 1314 1388 1315 if (m_angle) { 1389 result.appendLiteral("from "); 1390 result.append(m_angle->cssText()); 1316 result.append("from ", m_angle->cssText()); 1391 1317 wroteSomething = true; 1392 1318 } … … 1394 1320 if (m_firstX && m_firstY) { 1395 1321 if (wroteSomething) 1396 result.appendLiteral(" "); 1397 result.appendLiteral("at "); 1398 result.append(m_firstX->cssText()); 1399 result.append(' '); 1400 result.append(m_firstY->cssText()); 1322 result.append(' '); 1323 result.append("at ", m_firstX->cssText(), ' ', m_firstY->cssText()); 1401 1324 wroteSomething = true; 1402 1325 } -
trunk/Source/WebCore/css/CSSMediaRule.cpp
r218890 r249013 52 52 result.appendLiteral("@media "); 53 53 if (mediaQueries()) { 54 result.append(mediaQueries()->mediaText()); 55 result.append(' '); 54 result.append(mediaQueries()->mediaText(), ' '); 56 55 } 57 56 result.appendLiteral("{ \n"); -
trunk/Source/WebCore/css/CSSNamespaceRule.cpp
r246490 r249013 58 58 if (!prefix().isEmpty()) 59 59 result.append(' '); 60 result.append("url("); 61 result.append(serializeString(namespaceURI())); 62 result.append(");"); 60 result.append("url(", serializeString(namespaceURI()), ");"); 63 61 return result.toString(); 64 62 } -
trunk/Source/WebCore/css/CSSPageRule.cpp
r234825 r249013 55 55 String CSSPageRule::selectorText() const 56 56 { 57 StringBuilder text; 58 text.appendLiteral("@page"); 59 const CSSSelector* selector = m_pageRule->selector(); 60 if (selector) { 57 if (auto* selector = m_pageRule->selector()) { 61 58 String pageSpecification = selector->selectorText(); 62 if (!pageSpecification.isEmpty() && pageSpecification != starAtom()) { 63 text.append(' '); 64 text.append(pageSpecification); 65 } 59 if (!pageSpecification.isEmpty() && pageSpecification != starAtom()) 60 return makeString("@page ", pageSpecification); 66 61 } 67 return text.toString();62 return "@page"_s; 68 63 } 69 64 -
trunk/Source/WebCore/css/CSSPrimitiveValue.cpp
r246490 r249013 1004 1004 } 1005 1005 String listStyle = m_value.counter->listStyle(); 1006 if (!listStyle.isEmpty()) { 1007 result.appendLiteral(", "); 1008 result.append(listStyle); 1009 } 1006 if (!listStyle.isEmpty()) 1007 result.append(", ", listStyle); 1010 1008 result.append(')'); 1011 1009 -
trunk/Source/WebCore/css/CSSPropertySourceData.cpp
r218890 r249013 78 78 : name(emptyString()) 79 79 , value(emptyString()) 80 , important(false)81 , disabled(false)82 , parsedOk(false)83 , range(SourceRange(0, 0))84 80 { 85 81 } … … 89 85 if (!name && value == "e") 90 86 return String(); 91 92 StringBuilder result; 93 result.append(name); 94 result.appendLiteral(": "); 95 result.append(value); 96 if (important) 97 result.appendLiteral(" !important"); 98 result.append(';'); 99 return result.toString(); 87 return makeString(name, ": ", value, important ? " !important" : "", ';'); 100 88 } 101 89 -
trunk/Source/WebCore/css/CSSPropertySourceData.h
r218588 r249013 61 61 String name; 62 62 String value; 63 bool important ;64 bool disabled ;65 bool parsedOk ;63 bool important { false }; 64 bool disabled { false }; 65 bool parsedOk { false }; 66 66 SourceRange range; 67 67 }; -
trunk/Source/WebCore/css/CSSStyleRule.cpp
r234825 r249013 113 113 String CSSStyleRule::cssText() const 114 114 { 115 StringBuilder result; 116 result.append(selectorText()); 117 result.appendLiteral(" { "); 118 String decls = m_styleRule->properties().asText(); 119 result.append(decls); 120 if (!decls.isEmpty()) 121 result.append(' '); 122 result.append('}'); 123 return result.toString(); 115 String declarations = m_styleRule->properties().asText(); 116 if (declarations.isEmpty()) 117 return makeString(selectorText(), " { }"); 118 return makeString(selectorText(), " { ", declarations, " }"); 124 119 } 125 120 -
trunk/Source/WebCore/css/parser/CSSParser.cpp
r246490 r249013 247 247 RefPtr<CSSValue> CSSParser::parseFontFaceDescriptor(CSSPropertyID propertyID, const String& propertyValue, const CSSParserContext& context) 248 248 { 249 StringBuilder builder; 250 builder.appendLiteral("@font-face { "); 251 builder.append(getPropertyNameString(propertyID)); 252 builder.appendLiteral(" : "); 253 builder.append(propertyValue); 254 builder.appendLiteral("; }"); 255 RefPtr<StyleRuleBase> rule = parseRule(context, nullptr, builder.toString()); 249 String string = makeString("@font-face { ", getPropertyNameString(propertyID), " : ", propertyValue, "; }"); 250 RefPtr<StyleRuleBase> rule = parseRule(context, nullptr, string); 256 251 if (!rule || !rule->isFontFaceRule()) 257 252 return nullptr; -
trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp
r246285 r249013 112 112 if (i) 113 113 serializedFont.append(','); 114 114 115 // FIXME: We should append family directly to serializedFont rather than building a temporary string. 115 116 String family = fontDescription.familyAt(i); … … 119 120 family = makeString('"', family, '"'); 120 121 121 serializedFont.append(' '); 122 serializedFont.append(family); 122 serializedFont.append(' ', family); 123 123 } 124 124 -
trunk/Source/WebKit/ChangeLog
r249006 r249013 1 2019-08-17 Darin Adler <darin@apple.com> 2 3 Use makeString and multi-argument StringBuilder::append instead of less efficient multiple appends 4 https://bugs.webkit.org/show_bug.cgi?id=200862 5 6 Reviewed by Ryosuke Niwa. 7 8 * Shared/mac/AuxiliaryProcessMac.mm: 9 (WebKit::setAndSerializeSandboxParameters): Use one append instead of multiple. 10 1 11 2019-08-22 Wenson Hsieh <wenson_hsieh@apple.com> 2 12 -
trunk/Source/WebKit/Shared/mac/AuxiliaryProcessMac.mm
r248697 r249013 235 235 CRASH(); 236 236 } 237 builder.append(name); 238 builder.append(':'); 239 builder.append(value); 240 builder.append(':'); 237 builder.append(name, ':', value, ':'); 241 238 } 242 239 if (isProfilePath) { -
trunk/Tools/ChangeLog
r249004 r249013 1 2019-08-17 Darin Adler <darin@apple.com> 2 3 Use makeString and multi-argument StringBuilder::append instead of less efficient multiple appends 4 https://bugs.webkit.org/show_bug.cgi?id=200862 5 6 Reviewed by Ryosuke Niwa. 7 8 * WebKitTestRunner/InjectedBundle/TestRunner.cpp: 9 (WTR::TestRunner::statisticsDidRunTelemetryCallback): Use makeString. 10 * WebKitTestRunner/TestController.cpp: 11 (WTR::TestController::findAndDumpWebKitProcessIdentifiers): Ditto. 12 (WTR::TestController::downloadDidReceiveServerRedirectToURL): Ditto. 13 (WTR::TestController::downloadDidFail): Ditto. 14 1 15 2019-08-22 clopez@igalia.com <clopez@igalia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc> 2 16 -
trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp
r248856 r249013 1907 1907 JSContextRef context = WKBundleFrameGetJavaScriptContext(mainFrame); 1908 1908 1909 StringBuilder stringBuilder; 1910 stringBuilder.appendLiteral("{ \"totalPrevalentResources\" : "); 1911 stringBuilder.appendNumber(totalPrevalentResources); 1912 stringBuilder.appendLiteral(", \"totalPrevalentResourcesWithUserInteraction\" : "); 1913 stringBuilder.appendNumber(totalPrevalentResourcesWithUserInteraction); 1914 stringBuilder.appendLiteral(", \"top3SubframeUnderTopFrameOrigins\" : "); 1915 stringBuilder.appendNumber(top3SubframeUnderTopFrameOrigins); 1916 stringBuilder.appendLiteral(" }"); 1917 1918 JSValueRef result = JSValueMakeFromJSONString(context, adopt(JSStringCreateWithUTF8CString(stringBuilder.toString().utf8().data())).get()); 1909 String string = makeString("{ \"totalPrevalentResources\" : ", totalPrevalentResources, ", \"totalPrevalentResourcesWithUserInteraction\" : ", totalPrevalentResourcesWithUserInteraction, ", \"top3SubframeUnderTopFrameOrigins\" : ", top3SubframeUnderTopFrameOrigins, " }"); 1910 1911 JSValueRef result = JSValueMakeFromJSONString(context, adopt(JSStringCreateWithUTF8CString(string.utf8().data())).get()); 1919 1912 1920 1913 callTestRunnerCallback(StatisticsDidRunTelemetryCallbackID, 1, &result); -
trunk/Tools/WebKitTestRunner/TestController.cpp
r249001 r249013 1095 1095 void TestController::findAndDumpWebKitProcessIdentifiers() 1096 1096 { 1097 StringBuilder builder;1098 1099 1097 #if PLATFORM(COCOA) 1100 builder.append(TestController::webProcessName()); 1101 builder.appendLiteral(": "); 1102 pid_t webContentPID = WKPageGetProcessIdentifier(TestController::singleton().mainWebView()->page()); 1103 builder.appendNumber(webContentPID); 1104 builder.append('\n'); 1105 1106 builder.append(TestController::networkProcessName()); 1107 builder.appendLiteral(": "); 1108 pid_t networkingPID = WKContextGetNetworkProcessIdentifier(m_context.get()); 1109 builder.appendNumber(networkingPID); 1110 builder.append('\n'); 1098 dumpResponse(makeString(TestController::webProcessName(), ": ", 1099 WKPageGetProcessIdentifier(TestController::singleton().mainWebView()->page()), '\n', 1100 TestController::networkProcessName(), ": ", 1101 WKContextGetNetworkProcessIdentifier(m_context.get()), '\n')); 1111 1102 #else 1112 builder.append('\n');1103 dumpResponse("\n"_s); 1113 1104 #endif 1114 1115 dumpResponse(builder.toString());1116 1105 } 1117 1106 … … 2451 2440 void TestController::downloadDidReceiveServerRedirectToURL(WKContextRef, WKDownloadRef, WKURLRef url) 2452 2441 { 2453 if (m_shouldLogDownloadCallbacks) { 2454 StringBuilder builder; 2455 builder.appendLiteral("Download was redirected to \""); 2456 WKRetainPtr<WKStringRef> urlStringWK = adoptWK(WKURLCopyString(url)); 2457 builder.append(toSTD(urlStringWK).c_str()); 2458 builder.appendLiteral("\".\n"); 2459 m_currentInvocation->outputText(builder.toString()); 2460 } 2442 if (m_shouldLogDownloadCallbacks) 2443 m_currentInvocation->outputText(makeString("Download was redirected to \"", toWTFString(adoptWK(WKURLCopyString(url))), "\".\n")); 2461 2444 } 2462 2445 … … 2466 2449 m_currentInvocation->outputText("Download failed.\n"_s); 2467 2450 2468 WKRetainPtr<WKStringRef> errorDomain = adoptWK(WKErrorCopyDomain(error)); 2469 WKRetainPtr<WKStringRef> errorDescription = adoptWK(WKErrorCopyLocalizedDescription(error)); 2470 int errorCode = WKErrorGetErrorCode(error); 2471 2472 StringBuilder errorBuilder; 2473 errorBuilder.append("Failed: "); 2474 errorBuilder.append(toWTFString(errorDomain)); 2475 errorBuilder.append(", code="); 2476 errorBuilder.appendNumber(errorCode); 2477 errorBuilder.append(", description="); 2478 errorBuilder.append(toWTFString(errorDescription)); 2479 errorBuilder.append("\n"); 2480 2481 m_currentInvocation->outputText(errorBuilder.toString()); 2451 auto domain = toWTFString(adoptWK(WKErrorCopyDomain(error))); 2452 auto description = toWTFString(adoptWK(WKErrorCopyLocalizedDescription(error))); 2453 int code = WKErrorGetErrorCode(error); 2454 2455 m_currentInvocation->outputText(makeString("Failed: ", domain, ", code=", code, ", description=", description, "\n")); 2482 2456 } 2483 2457 m_currentInvocation->notifyDownloadDone();
Note:
See TracChangeset
for help on using the changeset viewer.