Title: [125990] trunk/Source/WebCore
Revision
125990
Author
[email protected]
Date
2012-08-19 20:39:59 -0700 (Sun, 19 Aug 2012)

Log Message

Remove the static Strings used for outputting values of CSS_ATTR, CSS_COUNTER, CSS_RECT
https://bugs.webkit.org/show_bug.cgi?id=94420

Reviewed by Kentaro Hara.

Use the new StringBuilder::appendLiteral() instead of keeping some WTF::String in
memory.

The patch reduces memory usage.
It also reduces the binary size (-1672 bytes on x86_64).
I did not measure any difference in performance.

* css/CSSPrimitiveValue.cpp:
(WebCore::CSSPrimitiveValue::customCssText):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (125989 => 125990)


--- trunk/Source/WebCore/ChangeLog	2012-08-20 03:33:41 UTC (rev 125989)
+++ trunk/Source/WebCore/ChangeLog	2012-08-20 03:39:59 UTC (rev 125990)
@@ -1,3 +1,20 @@
+2012-08-19  Benjamin Poulain  <[email protected]>
+
+        Remove the static Strings used for outputting values of CSS_ATTR, CSS_COUNTER, CSS_RECT
+        https://bugs.webkit.org/show_bug.cgi?id=94420
+
+        Reviewed by Kentaro Hara.
+
+        Use the new StringBuilder::appendLiteral() instead of keeping some WTF::String in
+        memory.
+
+        The patch reduces memory usage.
+        It also reduces the binary size (-1672 bytes on x86_64).
+        I did not measure any difference in performance.
+
+        * css/CSSPrimitiveValue.cpp:
+        (WebCore::CSSPrimitiveValue::customCssText):
+
 2012-08-19  Rik Cabanier  <[email protected]>
 
         parse CSS attribute -webkit-blend-mode

Modified: trunk/Source/WebCore/css/CSSPrimitiveValue.cpp (125989 => 125990)


--- trunk/Source/WebCore/css/CSSPrimitiveValue.cpp	2012-08-20 03:33:41 UTC (rev 125989)
+++ trunk/Source/WebCore/css/CSSPrimitiveValue.cpp	2012-08-20 03:39:59 UTC (rev 125990)
@@ -937,12 +937,9 @@
             text = valueOrPropertyName(m_value.ident);
             break;
         case CSS_ATTR: {
-            DEFINE_STATIC_LOCAL(const String, attrParen, ("attr("));
-
             StringBuilder result;
             result.reserveCapacity(6 + m_value.string->length());
-
-            result.append(attrParen);
+            result.appendLiteral("attr(");
             result.append(m_value.string);
             result.append(')');
 
@@ -955,22 +952,21 @@
             text += ")";
             break;
         case CSS_COUNTER: {
-            DEFINE_STATIC_LOCAL(const String, counterParen, ("counter("));
-            DEFINE_STATIC_LOCAL(const String, countersParen, ("counters("));
-            DEFINE_STATIC_LOCAL(const String, commaSpace, (", "));
-
             StringBuilder result;
             String separator = m_value.counter->separator();
-            result.append(separator.isEmpty() ? counterParen : countersParen);
+            if (separator.isEmpty())
+                result.appendLiteral("counter(");
+            else
+                result.appendLiteral("counters(");
 
             result.append(m_value.counter->identifier());
             if (!separator.isEmpty()) {
-                result.append(commaSpace);
+                result.appendLiteral(", ");
                 result.append(quoteCSSStringIfNeeded(separator));
             }
             String listStyle = m_value.counter->listStyle();
             if (!listStyle.isEmpty()) {
-                result.append(commaSpace);
+                result.appendLiteral(", ");
                 result.append(listStyle);
             }
             result.append(')');
@@ -979,26 +975,8 @@
             break;
         }
         case CSS_RECT: {
-            DEFINE_STATIC_LOCAL(const String, rectParen, ("rect("));
-
             Rect* rectVal = getRectValue();
-            StringBuilder result;
-            result.reserveCapacity(32);
-            result.append(rectParen);
-
-            result.append(rectVal->top()->cssText());
-            result.append(' ');
-
-            result.append(rectVal->right()->cssText());
-            result.append(' ');
-
-            result.append(rectVal->bottom()->cssText());
-            result.append(' ');
-
-            result.append(rectVal->left()->cssText());
-            result.append(')');
-
-            text = result.toString();
+            text = "rect(" + rectVal->top()->cssText() + ' ' + rectVal->right()->cssText() + ' ' + rectVal->bottom()->cssText() + ' ' + rectVal->left()->cssText() + ')';
             break;
         }
         case CSS_QUAD: {
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to