Changeset 127224 in webkit
- Timestamp:
- Aug 30, 2012, 6:25:43 PM (14 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 16 edited
-
ChangeLog (modified) (1 diff)
-
css/CSSBorderImageSliceValue.cpp (modified) (1 diff)
-
css/CSSFontFaceSrcValue.cpp (modified) (2 diffs)
-
css/CSSFunctionValue.cpp (modified) (2 diffs)
-
css/CSSGradientValue.cpp (modified) (4 diffs)
-
css/CSSParser.cpp (modified) (1 diff)
-
css/CSSPrimitiveValue.cpp (modified) (4 diffs)
-
css/CSSReflectValue.cpp (modified) (3 diffs)
-
css/CSSTimingFunctionValue.cpp (modified) (2 diffs)
-
fileapi/BlobURL.cpp (modified) (1 diff)
-
inspector/InspectorCSSAgent.cpp (modified) (1 diff)
-
inspector/InspectorClient.cpp (modified) (1 diff)
-
inspector/InspectorConsoleAgent.cpp (modified) (2 diffs)
-
inspector/InspectorFileSystemAgent.cpp (modified) (1 diff)
-
inspector/InspectorPageAgent.cpp (modified) (5 diffs)
-
inspector/InspectorStyleSheet.cpp (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r127220 r127224 1 2012-08-30 Adam Barth <abarth@webkit.org> 2 3 Replace more instances of += with StringBuilder 4 https://bugs.webkit.org/show_bug.cgi?id=95502 5 6 Reviewed by Darin Adler. 7 8 This patch removes many uses of WTF::String::operator+= in WebCore. 9 Many of these uses are inefficient because they cause us to allocate 10 and memcpy strings more times than necessary. In most cases, I've 11 replaced these inefficient patterns with StringBuilder. 12 13 This patch makes progress towards removing WTF::String::operator+= from 14 the project. 15 16 We can make cssText() more efficient by passing a single StringBuilder 17 instance along to the recursive calls, but I've left that for a later 18 patch. 19 20 * css/CSSBorderImageSliceValue.cpp: 21 (WebCore::CSSBorderImageSliceValue::customCssText): 22 * css/CSSFontFaceSrcValue.cpp: 23 (WebCore::CSSFontFaceSrcValue::customCssText): 24 * css/CSSFunctionValue.cpp: 25 (WebCore::CSSFunctionValue::customCssText): 26 * css/CSSGradientValue.cpp: 27 (WebCore::CSSLinearGradientValue::customCssText): 28 (WebCore::CSSRadialGradientValue::customCssText): 29 * css/CSSParser.cpp: 30 (WebCore::CSSParser::createKeyframe): 31 * css/CSSPrimitiveValue.cpp: 32 (WebCore::CSSPrimitiveValue::customCssText): 33 * css/CSSReflectValue.cpp: 34 (WebCore::CSSReflectValue::customCssText): 35 * css/CSSTimingFunctionValue.cpp: 36 (WebCore::CSSCubicBezierTimingFunctionValue::customCssText): 37 (WebCore::CSSStepsTimingFunctionValue::customCssText): 38 * css/StylePropertySet.cpp: 39 (WebCore::StylePropertySet::get4Values): 40 (WebCore::StylePropertySet::getLayeredShorthandValue): 41 (WebCore::StylePropertySet::getShorthandValue): 42 * fileapi/BlobURL.cpp: 43 (WebCore::BlobURL::createBlobURL): 44 * inspector/InspectorCSSAgent.cpp: 45 (WebCore::InspectorCSSAgent::SetPropertyTextAction::redo): 46 * inspector/InspectorClient.cpp: 47 (WebCore::InspectorClient::doDispatchMessageOnFrontendPage): 48 * inspector/InspectorConsoleAgent.cpp: 49 (WebCore::InspectorConsoleAgent::didFailLoading): 50 * inspector/InspectorFileSystemAgent.cpp: 51 (WebCore): 52 * inspector/InspectorPageAgent.cpp: 53 (WebCore::InspectorPageAgent::cachedResourceContent): 54 (WebCore::InspectorPageAgent::getCookies): 55 * inspector/InspectorStyleSheet.cpp: 56 (WebCore::InspectorStyleSheet::addRule): 57 1 58 2012-08-30 Luke Macpherson <macpherson@chromium.org> 2 59 -
trunk/Source/WebCore/css/CSSBorderImageSliceValue.cpp
r124884 r127224 47 47 // Now the fill keywords if it is present. 48 48 if (m_fill) 49 text +=" fill";49 return text + " fill"; 50 50 return text; 51 51 } -
trunk/Source/WebCore/css/CSSFontFaceSrcValue.cpp
r126154 r127224 34 34 #include "SVGFontFaceElement.h" 35 35 #include "StyleSheetContents.h" 36 #include <wtf/text/StringBuilder.h> 36 37 37 38 namespace WebCore { … … 64 65 String CSSFontFaceSrcValue::customCssText() const 65 66 { 66 String result;67 StringBuilder result; 67 68 if (isLocal()) 68 result += "local(";69 result.appendLiteral("local("); 69 70 else 70 result += "url("; 71 result += m_resource; 72 result += ")"; 73 if (!m_format.isEmpty()) 74 result += " format(" + m_format + ")"; 75 return result; 71 result.appendLiteral("url("); 72 result.append(m_resource); 73 result.append(')'); 74 if (!m_format.isEmpty()) { 75 result.appendLiteral(" format("); 76 result.append(m_format); 77 result.append(')'); 78 } 79 return result.toString(); 76 80 } 77 81 -
trunk/Source/WebCore/css/CSSFunctionValue.cpp
r126154 r127224 31 31 #include "MemoryInstrumentation.h" 32 32 #include <wtf/PassOwnPtr.h> 33 #include <wtf/text/StringBuilder.h> 33 34 34 35 namespace WebCore { … … 44 45 String CSSFunctionValue::customCssText() const 45 46 { 46 String result = m_name; // Includes the '(' 47 StringBuilder result; 48 result.append(m_name); // Includes the '(' 47 49 if (m_args) 48 result += m_args->cssText();49 result += ")";50 return result ;50 result.append(m_args->cssText()); 51 result.append(')'); 52 return result.toString(); 51 53 } 52 54 -
trunk/Source/WebCore/css/CSSGradientValue.cpp
r124884 r127224 39 39 #include "RenderObject.h" 40 40 #include "StyleResolver.h" 41 #include <wtf/text/StringBuilder.h> 41 42 42 43 using namespace std; … … 474 475 String CSSLinearGradientValue::customCssText() const 475 476 { 476 String result;477 StringBuilder result; 477 478 if (m_deprecatedType) { 478 result = "-webkit-gradient(linear, "; 479 result += m_firstX->cssText() + " "; 480 result += m_firstY->cssText() + ", "; 481 result += m_secondX->cssText() + " "; 482 result += m_secondY->cssText(); 479 result.appendLiteral("-webkit-gradient(linear, "); 480 result.append(m_firstX->cssText()); 481 result.append(' '); 482 result.append(m_firstY->cssText()); 483 result.appendLiteral(", "); 484 result.append(m_secondX->cssText()); 485 result.append(' '); 486 result.append(m_secondY->cssText()); 483 487 484 488 for (unsigned i = 0; i < m_stops.size(); i++) { 485 489 const CSSGradientColorStop& stop = m_stops[i]; 486 result += ", "; 487 if (stop.m_position->getDoubleValue(CSSPrimitiveValue::CSS_NUMBER) == 0) 488 result += "from(" + stop.m_color->cssText() + ")"; 489 else if (stop.m_position->getDoubleValue(CSSPrimitiveValue::CSS_NUMBER) == 1) 490 result += "to(" + stop.m_color->cssText() + ")"; 491 else 492 result += "color-stop(" + String::number(stop.m_position->getDoubleValue(CSSPrimitiveValue::CSS_NUMBER)) + ", " + stop.m_color->cssText() + ")"; 490 result.appendLiteral(", "); 491 if (stop.m_position->getDoubleValue(CSSPrimitiveValue::CSS_NUMBER) == 0) { 492 result.appendLiteral("from("); 493 result.append(stop.m_color->cssText()); 494 result.append(')'); 495 } else if (stop.m_position->getDoubleValue(CSSPrimitiveValue::CSS_NUMBER) == 1) { 496 result.appendLiteral("to("); 497 result.append(stop.m_color->cssText()); 498 result.append(')'); 499 } else { 500 result.appendLiteral("color-stop("); 501 result.append(String::number(stop.m_position->getDoubleValue(CSSPrimitiveValue::CSS_NUMBER))); 502 result.appendLiteral(", "); 503 result.append(stop.m_color->cssText()); 504 result.append(')'); 505 } 493 506 } 494 507 } else { 495 result = m_repeating ? "-webkit-repeating-linear-gradient(" : "-webkit-linear-gradient("; 508 if (m_repeating) 509 result.appendLiteral("-webkit-repeating-linear-gradient("); 510 else 511 result.appendLiteral("-webkit-linear-gradient("); 512 496 513 if (m_angle) 497 result += m_angle->cssText();514 result.append(m_angle->cssText()); 498 515 else { 499 if (m_firstX && m_firstY) 500 result += m_firstX->cssText() + " " + m_firstY->cssText(); 501 else if (m_firstX || m_firstY) { 516 if (m_firstX && m_firstY) { 517 result.append(m_firstX->cssText()); 518 result.append(' '); 519 result.append(m_firstY->cssText()); 520 } else if (m_firstX || m_firstY) { 502 521 if (m_firstX) 503 result += m_firstX->cssText();522 result.append(m_firstX->cssText()); 504 523 505 524 if (m_firstY) 506 result += m_firstY->cssText();525 result.append(m_firstY->cssText()); 507 526 } 508 527 } … … 510 529 for (unsigned i = 0; i < m_stops.size(); i++) { 511 530 const CSSGradientColorStop& stop = m_stops[i]; 512 result += ", "; 513 result += stop.m_color->cssText(); 514 if (stop.m_position) 515 result += " " + stop.m_position->cssText(); 516 } 517 } 518 519 result += ")"; 520 return result; 531 result.appendLiteral(", "); 532 result.append(stop.m_color->cssText()); 533 if (stop.m_position) { 534 result.append(' '); 535 result.append(stop.m_position->cssText()); 536 } 537 } 538 } 539 540 result.append(')'); 541 return result.toString(); 521 542 } 522 543 … … 623 644 String CSSRadialGradientValue::customCssText() const 624 645 { 625 String result;646 StringBuilder result; 626 647 627 648 if (m_deprecatedType) { 628 result = "-webkit-gradient(radial, "; 629 630 result += m_firstX->cssText() + " "; 631 result += m_firstY->cssText() + ", "; 632 result += m_firstRadius->cssText() + ", "; 633 result += m_secondX->cssText() + " "; 634 result += m_secondY->cssText(); 635 result += ", "; 636 result += m_secondRadius->cssText(); 649 result.appendLiteral("-webkit-gradient(radial, "); 650 result.append(m_firstX->cssText()); 651 result.append(' '); 652 result.append(m_firstY->cssText()); 653 result.appendLiteral(", "); 654 result.append(m_firstRadius->cssText()); 655 result.appendLiteral(", "); 656 result.append(m_secondX->cssText()); 657 result.append(' '); 658 result.append(m_secondY->cssText()); 659 result.appendLiteral(", "); 660 result.append(m_secondRadius->cssText()); 637 661 638 662 // FIXME: share? 639 663 for (unsigned i = 0; i < m_stops.size(); i++) { 640 664 const CSSGradientColorStop& stop = m_stops[i]; 641 result += ", "; 642 if (stop.m_position->getDoubleValue(CSSPrimitiveValue::CSS_NUMBER) == 0) 643 result += "from(" + stop.m_color->cssText() + ")"; 644 else if (stop.m_position->getDoubleValue(CSSPrimitiveValue::CSS_NUMBER) == 1) 645 result += "to(" + stop.m_color->cssText() + ")"; 665 result.appendLiteral(", "); 666 if (stop.m_position->getDoubleValue(CSSPrimitiveValue::CSS_NUMBER) == 0) { 667 result.appendLiteral("from("); 668 result.append(stop.m_color->cssText()); 669 result.append(')'); 670 } else if (stop.m_position->getDoubleValue(CSSPrimitiveValue::CSS_NUMBER) == 1) { 671 result.appendLiteral("to("); 672 result.append(stop.m_color->cssText()); 673 result.append(')'); 674 } else { 675 result.appendLiteral("color-stop("); 676 result.append(String::number(stop.m_position->getDoubleValue(CSSPrimitiveValue::CSS_NUMBER))); 677 result.appendLiteral(", "); 678 result.append(stop.m_color->cssText()); 679 result.append(')'); 680 } 681 } 682 } else { 683 if (m_repeating) 684 result.appendLiteral("-webkit-repeating-radial-gradient("); 685 else 686 result.appendLiteral("-webkit-radial-gradient("); 687 688 if (m_firstX && m_firstY) { 689 result.append(m_firstX->cssText()); 690 result.append(' '); 691 result.append(m_firstY->cssText()); 692 } else if (m_firstX) 693 result.append(m_firstX->cssText()); 694 else if (m_firstY) 695 result.append(m_firstY->cssText()); 696 else 697 result.appendLiteral("center"); 698 699 if (m_shape || m_sizingBehavior) { 700 result.appendLiteral(", "); 701 if (m_shape) { 702 result.append(m_shape->cssText()); 703 result.append(' '); 704 } else 705 result.appendLiteral("ellipse "); 706 707 if (m_sizingBehavior) 708 result.append(m_sizingBehavior->cssText()); 646 709 else 647 result += "color-stop(" + String::number(stop.m_position->getDoubleValue(CSSPrimitiveValue::CSS_NUMBER)) + ", " + stop.m_color->cssText() + ")"; 648 } 649 } else { 650 651 result = m_repeating ? "-webkit-repeating-radial-gradient(" : "-webkit-radial-gradient("; 652 if (m_firstX && m_firstY) { 653 result += m_firstX->cssText() + " " + m_firstY->cssText(); 654 } else if (m_firstX) 655 result += m_firstX->cssText(); 656 else if (m_firstY) 657 result += m_firstY->cssText(); 658 else 659 result += "center"; 660 661 662 if (m_shape || m_sizingBehavior) { 663 result += ", "; 664 if (m_shape) 665 result += m_shape->cssText() + " "; 666 else 667 result += "ellipse "; 668 669 if (m_sizingBehavior) 670 result += m_sizingBehavior->cssText(); 671 else 672 result += "cover"; 710 result.appendLiteral("cover"); 673 711 674 712 } else if (m_endHorizontalSize && m_endVerticalSize) { 675 result += ", "; 676 result += m_endHorizontalSize->cssText() + " " + m_endVerticalSize->cssText(); 713 result.appendLiteral(", "); 714 result.append(m_endHorizontalSize->cssText()); 715 result.append(' '); 716 result.append(m_endVerticalSize->cssText()); 677 717 } 678 718 679 719 for (unsigned i = 0; i < m_stops.size(); i++) { 680 720 const CSSGradientColorStop& stop = m_stops[i]; 681 result += ", "; 682 result += stop.m_color->cssText(); 683 if (stop.m_position) 684 result += " " + stop.m_position->cssText(); 685 } 686 } 687 688 result += ")"; 689 return result; 721 result.appendLiteral(", "); 722 result.append(stop.m_color->cssText()); 723 if (stop.m_position) { 724 result.append(' '); 725 result.append(stop.m_position->cssText()); 726 } 727 } 728 } 729 730 result.append(')'); 731 return result.toString(); 690 732 } 691 733 -
trunk/Source/WebCore/css/CSSParser.cpp
r127220 r127224 9954 9954 { 9955 9955 // Create a key string from the passed keys 9956 String keyString;9956 StringBuilder keyString; 9957 9957 for (unsigned i = 0; i < keys->size(); ++i) { 9958 9958 float key = static_cast<float>(keys->valueAt(i)->fValue); 9959 9959 if (i != 0) 9960 keyString += ",";9961 keyString += String::number(key);9962 keyString += "%";9960 keyString.append(','); 9961 keyString.append(String::number(key)); 9962 keyString.append('%'); 9963 9963 } 9964 9964 9965 9965 RefPtr<StyleKeyframe> keyframe = StyleKeyframe::create(); 9966 keyframe->setKeyText(keyString );9966 keyframe->setKeyText(keyString.toString()); 9967 9967 keyframe->setProperties(createStylePropertySet()); 9968 9968 -
trunk/Source/WebCore/css/CSSPrimitiveValue.cpp
r127220 r127224 953 953 } 954 954 case CSS_COUNTER_NAME: 955 text = "counter("; 956 text += m_value.string; 957 text += ")"; 955 text = "counter(" + String(m_value.string) + ')'; 958 956 break; 959 957 case CSS_COUNTER: { … … 1039 1037 break; 1040 1038 } 1041 case CSS_PAIR: 1042 text = m_value.pair->first()->cssText(); 1039 case CSS_PAIR: { 1040 StringBuilder result; 1041 result.append(m_value.pair->first()->cssText()); 1043 1042 if (m_value.pair->second() != m_value.pair->first()) { 1044 text += " ";1045 text += m_value.pair->second()->cssText();1043 result.append(' '); 1044 result.append(m_value.pair->second()->cssText()); 1046 1045 } 1047 break; 1046 text = result.toString(); 1047 break; 1048 } 1048 1049 #if ENABLE(DASHBOARD_SUPPORT) || ENABLE(WIDGET_REGION) 1049 case CSS_DASHBOARD_REGION: 1050 case CSS_DASHBOARD_REGION: { 1051 StringBuilder result; 1050 1052 for (DashboardRegion* region = getDashboardRegionValue(); region; region = region->m_next.get()) { 1051 if (! text.isEmpty())1052 text.append(' ');1053 if (!result.isEmpty()) 1054 result.append(' '); 1053 1055 #if ENABLE(DASHBOARD_SUPPORT) && ENABLE(WIDGET_REGION) 1054 text += region->m_cssFunctionName;1056 result.append(region->m_cssFunctionName); 1055 1057 #elif ENABLE(DASHBOARD_SUPPORT) 1056 text += "dashboard-region(";1058 result.appendLiteral("dashboard-region("); 1057 1059 #else 1058 text += "region(";1059 #endif 1060 text += region->m_label;1060 result.appendLiteral("region("); 1061 #endif 1062 result.append(region->m_label); 1061 1063 if (region->m_isCircle) 1062 text += " circle";1064 result.appendLiteral(" circle"); 1063 1065 else if (region->m_isRectangle) 1064 text += " rectangle";1066 result.appendLiteral(" rectangle"); 1065 1067 else 1066 1068 break; … … 1073 1075 ASSERT(region->left()->getIdent() == CSSValueInvalid); 1074 1076 } else { 1075 text.append(' '); 1076 text += region->top()->cssText() + " "; 1077 text += region->right()->cssText() + " "; 1078 text += region->bottom()->cssText() + " "; 1079 text += region->left()->cssText(); 1077 result.append(' '); 1078 result.append(region->top()->cssText()); 1079 result.append(' '); 1080 result.append(region->right()->cssText()); 1081 result.append(' '); 1082 result.append(region->bottom()->cssText()); 1083 result.append(' '); 1084 result.append(region->left()->cssText()); 1080 1085 } 1081 text += ")";1086 result.append(')'); 1082 1087 } 1083 break; 1088 text = result.toString(); 1089 break; 1090 } 1084 1091 #endif 1085 1092 case CSS_PARSER_OPERATOR: { … … 1108 1115 #if ENABLE(CSS_VARIABLES) 1109 1116 case CSS_VARIABLE_NAME: 1110 text = "-webkit-var("; 1111 text += m_value.string; 1112 text += ")"; 1117 text = "-webkit-var(" + String(m_value.string) + ")"; 1113 1118 break; 1114 1119 #endif -
trunk/Source/WebCore/css/CSSReflectValue.cpp
r124884 r127224 30 30 #include "MemoryInstrumentation.h" 31 31 #include "PlatformString.h" 32 #include <wtf/text/StringBuilder.h> 32 33 33 34 using namespace std; … … 37 38 String CSSReflectValue::customCssText() const 38 39 { 39 String result;40 StringBuilder result; 40 41 switch (m_direction) { 41 42 case ReflectionBelow: 42 result += "below ";43 result.appendLiteral("below "); 43 44 break; 44 45 case ReflectionAbove: 45 result += "above ";46 result.appendLiteral("above "); 46 47 break; 47 48 case ReflectionLeft: 48 result += "left ";49 result.appendLiteral("left "); 49 50 break; 50 51 case ReflectionRight: 51 result += "right ";52 result.appendLiteral("right "); 52 53 break; 53 54 default: … … 55 56 } 56 57 57 result += m_offset->cssText() + " "; 58 result.append(m_offset->cssText()); 59 result.append(' '); 58 60 if (m_mask) 59 result += m_mask->cssText();60 return result ;61 result.append(m_mask->cssText()); 62 return result.toString(); 61 63 } 62 64 -
trunk/Source/WebCore/css/CSSTimingFunctionValue.cpp
r124884 r127224 44 44 String CSSCubicBezierTimingFunctionValue::customCssText() const 45 45 { 46 String text("cubic-bezier("); 47 text += String::number(m_x1); 48 text += ", "; 49 text += String::number(m_y1); 50 text += ", "; 51 text += String::number(m_x2); 52 text += ", "; 53 text += String::number(m_y2); 54 text += ")"; 55 return text; 46 return "cubic-bezier(" 47 + String::number(m_x1) + ", " 48 + String::number(m_y1) + ", " 49 + String::number(m_x2) + ", " 50 + String::number(m_y2) + ")"; 56 51 } 57 52 … … 63 58 String CSSStepsTimingFunctionValue::customCssText() const 64 59 { 65 String text("steps("); 66 text += String::number(m_steps); 67 text += ", "; 68 text += m_stepAtStart ? "start" : "end"; 69 text += ")"; 70 return text; 60 return "steps(" + String::number(m_steps) + ", " + (m_stepAtStart ? "start" : "end") + ')'; 71 61 } 72 62 -
trunk/Source/WebCore/fileapi/BlobURL.cpp
r120433 r127224 73 73 { 74 74 ASSERT(!originString.isEmpty()); 75 String urlString = kBlobProtocol; 76 urlString += ":"; 77 urlString += encodeWithURLEscapeSequences(originString); 78 urlString += "/"; 79 urlString += createCanonicalUUIDString(); 75 String urlString = "blob:" + encodeWithURLEscapeSequences(originString) + '/' + createCanonicalUUIDString(); 80 76 return KURL(ParsedURLString, urlString); 81 77 } -
trunk/Source/WebCore/inspector/InspectorCSSAgent.cpp
r126968 r127224 327 327 // FIXME: remove this once the model handles this case. 328 328 if (!m_oldText.endsWith(';')) 329 m_oldText += ";";329 m_oldText.append(';'); 330 330 return result; 331 331 } -
trunk/Source/WebCore/inspector/InspectorClient.cpp
r110854 r127224 56 56 return false; 57 57 58 String dispatchToFrontend("WebInspector.dispatchMessageFromBackend("); 59 dispatchToFrontend += message; 60 dispatchToFrontend += ");"; 58 String dispatchToFrontend = "WebInspector.dispatchMessageFromBackend(" + message + ");"; 61 59 62 60 // FIXME: This should execute the script in the appropriate world. -
trunk/Source/WebCore/inspector/InspectorConsoleAgent.cpp
r126967 r127224 48 48 #include <wtf/OwnPtr.h> 49 49 #include <wtf/PassOwnPtr.h> 50 #include <wtf/text/StringBuilder.h> 50 51 #include <wtf/text/WTFString.h> 51 52 … … 250 251 if (error.isCancellation()) // Report failures only. 251 252 return; 252 String message = ASCIILiteral("Failed to load resource"); 253 if (!error.localizedDescription().isEmpty()) 254 message += ": " + error.localizedDescription(); 253 StringBuilder message; 254 message.appendLiteral("Failed to load resource"); 255 if (!error.localizedDescription().isEmpty()) { 256 message.appendLiteral(": "); 257 message.append(error.localizedDescription()); 258 } 255 259 String requestId = IdentifiersFactory::requestId(identifier); 256 addConsoleMessage(adoptPtr(new ConsoleMessage(NetworkMessageSource, LogMessageType, ErrorMessageLevel, message , error.failingURL(), requestId)));260 addConsoleMessage(adoptPtr(new ConsoleMessage(NetworkMessageSource, LogMessageType, ErrorMessageLevel, message.toString(), error.failingURL(), requestId))); 257 261 } 258 262 -
trunk/Source/WebCore/inspector/InspectorFileSystemAgent.cpp
r126279 r127224 583 583 RefPtr<TextResourceDecoder> decoder = TextResourceDecoder::create(m_mimeType, m_charset, true); 584 584 String result = decoder->decode(static_cast<char*>(buffer->data()), buffer->byteLength()); 585 result += decoder->flush();585 result.append(decoder->flush()); 586 586 m_charset = decoder->encoding().domName(); 587 587 reportResult(static_cast<FileError::ErrorCode>(0), &result, &m_charset); -
trunk/Source/WebCore/inspector/InspectorPageAgent.cpp
r126926 r127224 75 75 #include "TextResourceDecoder.h" 76 76 #include "UserGestureIndicator.h" 77 78 77 #include <wtf/CurrentTime.h> 79 78 #include <wtf/ListHashSet.h> 80 79 #include <wtf/Vector.h> 81 80 #include <wtf/text/Base64.h> 81 #include <wtf/text/StringBuilder.h> 82 82 83 83 using namespace std; … … 198 198 return false; 199 199 String content = decoder->decode(buffer->data(), buffer->size()); 200 content += decoder->flush(); 201 *result = content; 200 *result = content + decoder->flush(); 202 201 return true; 203 202 } … … 504 503 505 504 // If we can't get raw cookies - fall back to String representation 506 String stringCookiesList;505 StringBuilder stringCookiesList; 507 506 508 507 // Return value to getRawCookies should be the same for every call because … … 520 519 // FIXME: We need duplication checking for the String representation of cookies. 521 520 ExceptionCode ec = 0; 522 stringCookiesList += document->cookie(ec);521 stringCookiesList.append(document->cookie(ec)); 523 522 // Exceptions are thrown by cookie() in sandboxed frames. That won't happen here 524 523 // because "document" is the document of the main frame of the page. … … 540 539 } else { 541 540 cookies = TypeBuilder::Array<TypeBuilder::Page::Cookie>::create(); 542 *cookiesString = stringCookiesList ;541 *cookiesString = stringCookiesList.toString(); 543 542 } 544 543 } -
trunk/Source/WebCore/inspector/InspectorStyleSheet.cpp
r127000 r127224 802 802 CSSStyleRule* InspectorStyleSheet::addRule(const String& selector, ExceptionCode& ec) 803 803 { 804 String styleSheetText;805 bool success = getText(& styleSheetText);804 String text; 805 bool success = getText(&text); 806 806 if (!success) { 807 807 ec = NOT_FOUND_ERR; 808 808 return 0; 809 809 } 810 StringBuilder styleSheetText; 811 styleSheetText.append(text); 810 812 811 813 m_pageStyleSheet->addRule(selector, "", ec); … … 816 818 ASSERT(rule); 817 819 818 if ( styleSheetText.length())819 styleSheetText += "\n";820 821 styleSheetText += selector;822 styleSheetText += " {}";820 if (!styleSheetText.isEmpty()) 821 styleSheetText.append('\n'); 822 823 styleSheetText.append(selector); 824 styleSheetText.appendLiteral(" {}"); 823 825 // Using setText() as this operation changes the style sheet rule set. 824 setText(styleSheetText );826 setText(styleSheetText.toString()); 825 827 826 828 fireStyleSheetChanged();
Note:
See TracChangeset
for help on using the changeset viewer.