Changeset 127639 in webkit


Ignore:
Timestamp:
Sep 5, 2012 1:31:57 PM (12 years ago)
Author:
benjamin@webkit.org
Message:

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

Patch by Benjamin Poulain <bpoulain@apple.com> 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().

Location:
trunk/Source
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r127635 r127639  
     12012-09-05  Benjamin Poulain  <bpoulain@apple.com>
     2
     3        More fixes for String::operator+=() on Mac
     4        https://bugs.webkit.org/show_bug.cgi?id=95880
     5
     6        Reviewed by Adam Barth.
     7
     8        Followup for r127574, I forgot some use of strings.
     9
     10        * css/StylePropertySet.cpp:
     11        (WebCore::StylePropertySet::getShorthandValue): Use String builder to construct the shorthand.
     12
    1132012-09-05  James Robinson  <jamesr@chromium.org>
    214
  • trunk/Source/WebCore/css/StylePropertySet.cpp

    r127593 r127639  
    432432String StylePropertySet::getShorthandValue(const StylePropertyShorthand& shorthand) const
    433433{
    434     String res;
     434    StringBuilder result;
    435435    for (unsigned i = 0; i < shorthand.length(); ++i) {
    436436        if (!isPropertyImplicit(shorthand.properties()[i])) {
     
    440440            if (value->isInitialValue())
    441441                continue;
    442             if (!res.isNull())
    443                 res += " ";
    444             res += value->cssText();
    445         }
    446     }
    447     return res;
     442            if (!result.isEmpty())
     443                result.append(' ');
     444            result.append(value->cssText());
     445        }
     446    }
     447    if (result.isEmpty())
     448        return String();
     449    return result.toString();
    448450}
    449451
  • trunk/Source/WebKit/mac/ChangeLog

    r127372 r127639  
     12012-09-05  Benjamin Poulain  <bpoulain@apple.com>
     2
     3        More fixes for String::operator+=() on Mac
     4        https://bugs.webkit.org/show_bug.cgi?id=95880
     5
     6        Reviewed by Adam Barth.
     7
     8        * WebView/WebRenderLayer.mm:
     9        (+[WebRenderLayer nameForLayer:]): Use StringBuilder to concatenate the class names
     10        efficiently.
     11        * WebView/WebView.mm:
     12        (+[WebView _decodeData:]): This is a legitimate use of String::append(), there
     13        is no other concatenation done on that string.
     14
    1152012-09-01  Mark Lam  <mark.lam@apple.com>
    216
  • trunk/Source/WebKit/mac/WebView/WebRenderLayer.mm

    r95901 r127639  
    6060        if (node->hasClass()) {
    6161            StyledElement* styledElement = static_cast<StyledElement*>(node);
    62             String classes;
     62            StringBuilder classes;
    6363            for (size_t i = 0; i < styledElement->classNames().size(); ++i) {
    6464                if (i > 0)
    65                     classes += " ";
    66                 classes += styledElement->classNames()[i];
     65                    classes.append(' ');
     66                classes.append(styledElement->classNames()[i]);
    6767            }
    68             name = [name stringByAppendingFormat:@" class=\"%@\"", (NSString *)classes];
     68            name = [name stringByAppendingFormat:@" class=\"%@\"", (NSString *)classes.toString()];
    6969        }
    7070    }
  • trunk/Source/WebKit/mac/WebView/WebView.mm

    r127191 r127639  
    17881788    RefPtr<TextResourceDecoder> decoder = TextResourceDecoder::create("text/html"); // bookmark files are HTML
    17891789    String result = decoder->decode(static_cast<const char*>([data bytes]), [data length]);
    1790     result += decoder->flush();
     1790    result.append(decoder->flush());
    17911791    return result;
    17921792}
  • trunk/Source/WebKit2/ChangeLog

    r127614 r127639  
     12012-09-05  Benjamin Poulain  <bpoulain@apple.com>
     2
     3        More fixes for String::operator+=() on Mac
     4        https://bugs.webkit.org/show_bug.cgi?id=95880
     5
     6        Reviewed by Adam Barth.
     7
     8        * UIProcess/WebInspectorProxy.cpp:
     9        (WebKit::WebInspectorProxy::createInspectorPage): This is a legitimate use of append(),
     10        there is no other concatenation outside that branch.
     11        * WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp:
     12        (WebKit::parseRFC822HeaderFields): Use string operators instead of +=.
     13        * WebProcess/Plugins/Netscape/NetscapePlugin.cpp:
     14        (WebKit::NetscapePlugin::userAgent): Another legitimate use of append().
     15
    1162012-09-05  Alexey Proskuryakov  <ap@apple.com>
    217
  • trunk/Source/WebKit2/UIProcess/WebInspectorProxy.cpp

    r124613 r127639  
    330330    String url = inspectorPageURL();
    331331    if (m_isAttached)
    332         url += "?docked=true";
     332        url.append("?docked=true");
    333333
    334334    m_page->process()->assumeReadAccessToBaseURL(inspectorBaseURL());
  • trunk/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp

    r122400 r127639  
    204204           
    205205            String oldValue = headerFields.get(lastHeaderKey);
    206             if (!oldValue.isNull()) {
    207                 String tmp = oldValue;
    208                 tmp += ", ";
    209                 tmp += value;
    210                 value = tmp;
    211             }
     206            if (!oldValue.isNull())
     207                value = oldValue + ", " + value;
    212208           
    213209            headerFields.set(lastHeaderKey, value);
  • trunk/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.cpp

    r127202 r127639  
    162162#if PLUGIN_ARCHITECTURE(MAC)
    163163        if (quirks().contains(PluginQuirks::AppendVersion3UserAgent))
    164             userAgent += " Version/3.2.1";
     164            userAgent.append(" Version/3.2.1");
    165165#endif
    166166
Note: See TracChangeset for help on using the changeset viewer.