Changeset 125990 in webkit
- Timestamp:
- Aug 19, 2012 8:39:59 PM (12 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r125989 r125990 1 2012-08-19 Benjamin Poulain <benjamin@webkit.org> 2 3 Remove the static Strings used for outputting values of CSS_ATTR, CSS_COUNTER, CSS_RECT 4 https://bugs.webkit.org/show_bug.cgi?id=94420 5 6 Reviewed by Kentaro Hara. 7 8 Use the new StringBuilder::appendLiteral() instead of keeping some WTF::String in 9 memory. 10 11 The patch reduces memory usage. 12 It also reduces the binary size (-1672 bytes on x86_64). 13 I did not measure any difference in performance. 14 15 * css/CSSPrimitiveValue.cpp: 16 (WebCore::CSSPrimitiveValue::customCssText): 17 1 18 2012-08-19 Rik Cabanier <cabanier@adobe.com> 2 19 -
trunk/Source/WebCore/css/CSSPrimitiveValue.cpp
r125934 r125990 938 938 break; 939 939 case CSS_ATTR: { 940 DEFINE_STATIC_LOCAL(const String, attrParen, ("attr("));941 942 940 StringBuilder result; 943 941 result.reserveCapacity(6 + m_value.string->length()); 944 945 result.append(attrParen); 942 result.appendLiteral("attr("); 946 943 result.append(m_value.string); 947 944 result.append(')'); … … 956 953 break; 957 954 case CSS_COUNTER: { 958 DEFINE_STATIC_LOCAL(const String, counterParen, ("counter("));959 DEFINE_STATIC_LOCAL(const String, countersParen, ("counters("));960 DEFINE_STATIC_LOCAL(const String, commaSpace, (", "));961 962 955 StringBuilder result; 963 956 String separator = m_value.counter->separator(); 964 result.append(separator.isEmpty() ? counterParen : countersParen); 957 if (separator.isEmpty()) 958 result.appendLiteral("counter("); 959 else 960 result.appendLiteral("counters("); 965 961 966 962 result.append(m_value.counter->identifier()); 967 963 if (!separator.isEmpty()) { 968 result.append (commaSpace);964 result.appendLiteral(", "); 969 965 result.append(quoteCSSStringIfNeeded(separator)); 970 966 } 971 967 String listStyle = m_value.counter->listStyle(); 972 968 if (!listStyle.isEmpty()) { 973 result.append (commaSpace);969 result.appendLiteral(", "); 974 970 result.append(listStyle); 975 971 } … … 980 976 } 981 977 case CSS_RECT: { 982 DEFINE_STATIC_LOCAL(const String, rectParen, ("rect("));983 984 978 Rect* rectVal = getRectValue(); 985 StringBuilder result; 986 result.reserveCapacity(32); 987 result.append(rectParen); 988 989 result.append(rectVal->top()->cssText()); 990 result.append(' '); 991 992 result.append(rectVal->right()->cssText()); 993 result.append(' '); 994 995 result.append(rectVal->bottom()->cssText()); 996 result.append(' '); 997 998 result.append(rectVal->left()->cssText()); 999 result.append(')'); 1000 1001 text = result.toString(); 979 text = "rect(" + rectVal->top()->cssText() + ' ' + rectVal->right()->cssText() + ' ' + rectVal->bottom()->cssText() + ' ' + rectVal->left()->cssText() + ')'; 1002 980 break; 1003 981 }
Note: See TracChangeset
for help on using the changeset viewer.