Remove WTF_DEPRECATED_STRING_OPERATORS from StylePropertySet.cpp
authorbenjamin@webkit.org <benjamin@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 5 Sep 2012 05:33:59 +0000 (05:33 +0000)
committerbenjamin@webkit.org <benjamin@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 5 Sep 2012 05:33:59 +0000 (05:33 +0000)
https://bugs.webkit.org/show_bug.cgi?id=95800

Patch by Adam Barth <abarth@chromium.org> on 2012-09-04
Reviewed by Benjamin Poulain.

This patch is a re-spin of part of the patch from
https://bugs.webkit.org/show_bug.cgi?id=95502, but with the tests
fixed.  :)

* css/StylePropertySet.cpp:
(WebCore::StylePropertySet::get4Values):
(WebCore::StylePropertySet::getLayeredShorthandValue):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@127555 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/css/StylePropertySet.cpp

index ad2888a..d97694a 100644 (file)
@@ -1,3 +1,18 @@
+2012-09-04  Adam Barth  <abarth@chromium.org>
+
+        Remove WTF_DEPRECATED_STRING_OPERATORS from StylePropertySet.cpp
+        https://bugs.webkit.org/show_bug.cgi?id=95800
+
+        Reviewed by Benjamin Poulain.
+
+        This patch is a re-spin of part of the patch from
+        https://bugs.webkit.org/show_bug.cgi?id=95502, but with the tests
+        fixed.  :)
+
+        * css/StylePropertySet.cpp:
+        (WebCore::StylePropertySet::get4Values):
+        (WebCore::StylePropertySet::getLayeredShorthandValue):
+
 2012-09-04  Keishi Hattori  <keishi@webkit.org>
 
         REGRESSION(r126132): MediaSlider and MediaVolumeSlider thumbs don't match mouse when dragged
index b063ada..b94950d 100644 (file)
@@ -300,20 +300,26 @@ String StylePropertySet::get4Values(const StylePropertyShorthand& shorthand) con
     bool showBottom = (top->value()->cssText() != bottom->value()->cssText()) || showLeft;
     bool showRight = (top->value()->cssText() != right->value()->cssText()) || showBottom;
 
-    String res = top->value()->cssText();
-    if (showRight)
-        res += " " + right->value()->cssText();
-    if (showBottom)
-        res += " " + bottom->value()->cssText();
-    if (showLeft)
-        res += " " + left->value()->cssText();
-
-    return res;
+    StringBuilder result;
+    result.append(top->value()->cssText());
+    if (showRight) {
+        result.append(' ');
+        result.append(right->value()->cssText());
+    }
+    if (showBottom) {
+        result.append(' ');
+        result.append(bottom->value()->cssText());
+    }
+    if (showLeft) {
+        result.append(' ');
+        result.append(left->value()->cssText());
+    }
+    return result.toString();
 }
 
 String StylePropertySet::getLayeredShorthandValue(const StylePropertyShorthand& shorthand) const
 {
-    String res;
+    StringBuilder result;
 
     const unsigned size = shorthand.length();
     // Begin by collecting the properties into an array.
@@ -334,7 +340,7 @@ String StylePropertySet::getLayeredShorthandValue(const StylePropertyShorthand&
     // Now stitch the properties together.  Implicit initial values are flagged as such and
     // can safely be omitted.
     for (size_t i = 0; i < numLayers; i++) {
-        String layerRes;
+        StringBuilder layerResult;
         bool useRepeatXShorthand = false;
         bool useRepeatYShorthand = false;
         bool useSingleWordShorthand = false;
@@ -388,37 +394,39 @@ String StylePropertySet::getLayeredShorthandValue(const StylePropertyShorthand&
             }
 
             if (value && !value->isImplicitInitialValue()) {
-                if (!layerRes.isNull())
-                    layerRes += " ";
+                if (!layerResult.isEmpty())
+                    layerResult.append(' ');
                 if (foundBackgroundPositionYCSSProperty && shorthand.properties()[j] == CSSPropertyBackgroundSize) 
-                    layerRes += "/ ";
+                    layerResult.appendLiteral("/ ");
                 if (!foundBackgroundPositionYCSSProperty && shorthand.properties()[j] == CSSPropertyBackgroundSize) 
                     continue;
 
                 if (useRepeatXShorthand) {
                     useRepeatXShorthand = false;
-                    layerRes += getValueName(CSSValueRepeatX);
+                    layerResult.append(getValueName(CSSValueRepeatX));
                 } else if (useRepeatYShorthand) {
                     useRepeatYShorthand = false;
-                    layerRes += getValueName(CSSValueRepeatY);
+                    layerResult.append(getValueName(CSSValueRepeatY));
                 } else if (useSingleWordShorthand) {
                     useSingleWordShorthand = false;
-                    layerRes += value->cssText();
+                    layerResult.append(value->cssText());
                 } else
-                    layerRes += value->cssText();
+                    layerResult.append(value->cssText());
 
                 if (shorthand.properties()[j] == CSSPropertyBackgroundPositionY)
                     foundBackgroundPositionYCSSProperty = true;
             }
         }
 
-        if (!layerRes.isNull()) {
-            if (!res.isNull())
-                res += ", ";
-            res += layerRes;
+        if (!layerResult.isEmpty()) {
+            if (!result.isEmpty())
+                result.appendLiteral(", ");
+            result.append(layerResult);
         }
     }
-    return res;
+    if (result.isEmpty())
+        return String();
+    return result.toString();
 }
 
 String StylePropertySet::getShorthandValue(const StylePropertyShorthand& shorthand) const