Title: [127555] trunk/Source/WebCore
Revision
127555
Author
[email protected]
Date
2012-09-04 22:33:59 -0700 (Tue, 04 Sep 2012)

Log Message

Remove WTF_DEPRECATED_STRING_OPERATORS from StylePropertySet.cpp
https://bugs.webkit.org/show_bug.cgi?id=95800

Patch by Adam Barth <[email protected]> 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):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (127554 => 127555)


--- trunk/Source/WebCore/ChangeLog	2012-09-05 05:12:26 UTC (rev 127554)
+++ trunk/Source/WebCore/ChangeLog	2012-09-05 05:33:59 UTC (rev 127555)
@@ -1,3 +1,18 @@
+2012-09-04  Adam Barth  <[email protected]>
+
+        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  <[email protected]>
 
         REGRESSION(r126132): MediaSlider and MediaVolumeSlider thumbs don't match mouse when dragged

Modified: trunk/Source/WebCore/css/StylePropertySet.cpp (127554 => 127555)


--- trunk/Source/WebCore/css/StylePropertySet.cpp	2012-09-05 05:12:26 UTC (rev 127554)
+++ trunk/Source/WebCore/css/StylePropertySet.cpp	2012-09-05 05:33:59 UTC (rev 127555)
@@ -300,20 +300,26 @@
     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 @@
     // 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 @@
             }
 
             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
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to