Title: [127639] trunk/Source
Revision
127639
Author
[email protected]
Date
2012-09-05 13:31:57 -0700 (Wed, 05 Sep 2012)

Log Message

More fixes for String::operator+=() on Mac
https://bugs.webkit.org/show_bug.cgi?id=95880

Patch by Benjamin Poulain <[email protected]> on 2012-09-05
Reviewed by Adam Barth.

Source/WebCore: 

Followup for r127574, I forgot some use of strings.

* css/StylePropertySet.cpp:
(WebCore::StylePropertySet::getShorthandValue): Use String builder to construct the shorthand.

Source/WebKit/mac: 

* WebView/WebRenderLayer.mm:
(+[WebRenderLayer nameForLayer:]): Use StringBuilder to concatenate the class names
efficiently.
* WebView/WebView.mm:
(+[WebView _decodeData:]): This is a legitimate use of String::append(), there
is no other concatenation done on that string.

Source/WebKit2: 

* UIProcess/WebInspectorProxy.cpp:
(WebKit::WebInspectorProxy::createInspectorPage): This is a legitimate use of append(),
there is no other concatenation outside that branch.
* WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp:
(WebKit::parseRFC822HeaderFields): Use string operators instead of +=.
* WebProcess/Plugins/Netscape/NetscapePlugin.cpp:
(WebKit::NetscapePlugin::userAgent): Another legitimate use of append().

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (127638 => 127639)


--- trunk/Source/WebCore/ChangeLog	2012-09-05 20:28:50 UTC (rev 127638)
+++ trunk/Source/WebCore/ChangeLog	2012-09-05 20:31:57 UTC (rev 127639)
@@ -1,3 +1,15 @@
+2012-09-05  Benjamin Poulain  <[email protected]>
+
+        More fixes for String::operator+=() on Mac
+        https://bugs.webkit.org/show_bug.cgi?id=95880
+
+        Reviewed by Adam Barth.
+
+        Followup for r127574, I forgot some use of strings.
+
+        * css/StylePropertySet.cpp:
+        (WebCore::StylePropertySet::getShorthandValue): Use String builder to construct the shorthand.
+
 2012-09-05  James Robinson  <[email protected]>
 
         [chromium] Put webcore_platform_files in separate gyp target instead of relying on exclusion patterns

Modified: trunk/Source/WebCore/css/StylePropertySet.cpp (127638 => 127639)


--- trunk/Source/WebCore/css/StylePropertySet.cpp	2012-09-05 20:28:50 UTC (rev 127638)
+++ trunk/Source/WebCore/css/StylePropertySet.cpp	2012-09-05 20:31:57 UTC (rev 127639)
@@ -431,7 +431,7 @@
 
 String StylePropertySet::getShorthandValue(const StylePropertyShorthand& shorthand) const
 {
-    String res;
+    StringBuilder result;
     for (unsigned i = 0; i < shorthand.length(); ++i) {
         if (!isPropertyImplicit(shorthand.properties()[i])) {
             RefPtr<CSSValue> value = getPropertyCSSValue(shorthand.properties()[i]);
@@ -439,12 +439,14 @@
                 return String();
             if (value->isInitialValue())
                 continue;
-            if (!res.isNull())
-                res += " ";
-            res += value->cssText();
+            if (!result.isEmpty())
+                result.append(' ');
+            result.append(value->cssText());
         }
     }
-    return res;
+    if (result.isEmpty())
+        return String();
+    return result.toString();
 }
 
 // only returns a non-null value if all properties have the same, non-null value

Modified: trunk/Source/WebKit/mac/ChangeLog (127638 => 127639)


--- trunk/Source/WebKit/mac/ChangeLog	2012-09-05 20:28:50 UTC (rev 127638)
+++ trunk/Source/WebKit/mac/ChangeLog	2012-09-05 20:31:57 UTC (rev 127639)
@@ -1,3 +1,17 @@
+2012-09-05  Benjamin Poulain  <[email protected]>
+
+        More fixes for String::operator+=() on Mac
+        https://bugs.webkit.org/show_bug.cgi?id=95880
+
+        Reviewed by Adam Barth.
+
+        * WebView/WebRenderLayer.mm:
+        (+[WebRenderLayer nameForLayer:]): Use StringBuilder to concatenate the class names
+        efficiently.
+        * WebView/WebView.mm:
+        (+[WebView _decodeData:]): This is a legitimate use of String::append(), there
+        is no other concatenation done on that string.
+
 2012-09-01  Mark Lam  <[email protected]>
 
         Added #include <_javascript_Core/Identifier.h>.

Modified: trunk/Source/WebKit/mac/WebView/WebRenderLayer.mm (127638 => 127639)


--- trunk/Source/WebKit/mac/WebView/WebRenderLayer.mm	2012-09-05 20:28:50 UTC (rev 127638)
+++ trunk/Source/WebKit/mac/WebView/WebRenderLayer.mm	2012-09-05 20:31:57 UTC (rev 127639)
@@ -59,13 +59,13 @@
 
         if (node->hasClass()) {
             StyledElement* styledElement = static_cast<StyledElement*>(node);
-            String classes;
+            StringBuilder classes;
             for (size_t i = 0; i < styledElement->classNames().size(); ++i) {
                 if (i > 0)
-                    classes += " ";
-                classes += styledElement->classNames()[i];
+                    classes.append(' ');
+                classes.append(styledElement->classNames()[i]);
             }
-            name = [name stringByAppendingFormat:@" class=\"%@\"", (NSString *)classes];
+            name = [name stringByAppendingFormat:@" class=\"%@\"", (NSString *)classes.toString()];
         }
     }
 

Modified: trunk/Source/WebKit/mac/WebView/WebView.mm (127638 => 127639)


--- trunk/Source/WebKit/mac/WebView/WebView.mm	2012-09-05 20:28:50 UTC (rev 127638)
+++ trunk/Source/WebKit/mac/WebView/WebView.mm	2012-09-05 20:31:57 UTC (rev 127639)
@@ -1787,7 +1787,7 @@
     HTMLNames::init(); // this method is used for importing bookmarks at startup, so HTMLNames are likely to be uninitialized yet
     RefPtr<TextResourceDecoder> decoder = TextResourceDecoder::create("text/html"); // bookmark files are HTML
     String result = decoder->decode(static_cast<const char*>([data bytes]), [data length]);
-    result += decoder->flush();
+    result.append(decoder->flush());
     return result;
 }
 

Modified: trunk/Source/WebKit2/ChangeLog (127638 => 127639)


--- trunk/Source/WebKit2/ChangeLog	2012-09-05 20:28:50 UTC (rev 127638)
+++ trunk/Source/WebKit2/ChangeLog	2012-09-05 20:31:57 UTC (rev 127639)
@@ -1,3 +1,18 @@
+2012-09-05  Benjamin Poulain  <[email protected]>
+
+        More fixes for String::operator+=() on Mac
+        https://bugs.webkit.org/show_bug.cgi?id=95880
+
+        Reviewed by Adam Barth.
+
+        * UIProcess/WebInspectorProxy.cpp:
+        (WebKit::WebInspectorProxy::createInspectorPage): This is a legitimate use of append(),
+        there is no other concatenation outside that branch.
+        * WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp:
+        (WebKit::parseRFC822HeaderFields): Use string operators instead of +=.
+        * WebProcess/Plugins/Netscape/NetscapePlugin.cpp:
+        (WebKit::NetscapePlugin::userAgent): Another legitimate use of append().
+
 2012-09-05  Alexey Proskuryakov  <[email protected]>
 
         [WK2] Make visited link tracking work in multi-process mode

Modified: trunk/Source/WebKit2/UIProcess/WebInspectorProxy.cpp (127638 => 127639)


--- trunk/Source/WebKit2/UIProcess/WebInspectorProxy.cpp	2012-09-05 20:28:50 UTC (rev 127638)
+++ trunk/Source/WebKit2/UIProcess/WebInspectorProxy.cpp	2012-09-05 20:31:57 UTC (rev 127639)
@@ -329,7 +329,7 @@
 
     String url = ""
     if (m_isAttached)
-        url += "?docked=true";
+        url.append("?docked=true");
 
     m_page->process()->assumeReadAccessToBaseURL(inspectorBaseURL());
 

Modified: trunk/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp (127638 => 127639)


--- trunk/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp	2012-09-05 20:28:50 UTC (rev 127638)
+++ trunk/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp	2012-09-05 20:31:57 UTC (rev 127639)
@@ -203,12 +203,8 @@
                 value = String(colon, endOfLine - colon);
             
             String oldValue = headerFields.get(lastHeaderKey);
-            if (!oldValue.isNull()) {
-                String tmp = oldValue;
-                tmp += ", ";
-                tmp += value;
-                value = tmp;
-            }
+            if (!oldValue.isNull())
+                value = oldValue + ", " + value;
             
             headerFields.set(lastHeaderKey, value);
         }

Modified: trunk/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.cpp (127638 => 127639)


--- trunk/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.cpp	2012-09-05 20:28:50 UTC (rev 127638)
+++ trunk/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.cpp	2012-09-05 20:31:57 UTC (rev 127639)
@@ -161,7 +161,7 @@
 
 #if PLUGIN_ARCHITECTURE(MAC)
         if (quirks().contains(PluginQuirks::AppendVersion3UserAgent))
-            userAgent += " Version/3.2.1";
+            userAgent.append(" Version/3.2.1");
 #endif
 
         m_userAgent = userAgent.utf8();
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to