Remove remaining WTF_DEPRECATED_STRING_OPERATORS from cpp files
authorparoga@webkit.org <paroga@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 24 Sep 2012 15:38:03 +0000 (15:38 +0000)
committerparoga@webkit.org <paroga@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 24 Sep 2012 15:38:03 +0000 (15:38 +0000)
https://bugs.webkit.org/show_bug.cgi?id=97412

Reviewed by Adam Barth.

Source/WebCore:

* css/StylePropertySet.cpp: Removed useless define.

Source/WebKit/chromium:

* src/WebPageSerializerImpl.cpp:
(WebKit::WebPageSerializerImpl::openTagToString): Replaced operator+= with StringBuilder::append().
(WebKit::WebPageSerializerImpl::endTagToString): Ditto.

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

Source/WebCore/ChangeLog
Source/WebCore/css/StylePropertySet.cpp
Source/WebKit/chromium/ChangeLog
Source/WebKit/chromium/src/WebPageSerializerImpl.cpp

index a47986a..8fcd520 100644 (file)
@@ -1,3 +1,12 @@
+2012-09-24  Patrick Gansterer  <paroga@webkit.org>
+
+        Remove remaining WTF_DEPRECATED_STRING_OPERATORS from cpp files
+        https://bugs.webkit.org/show_bug.cgi?id=97412
+
+        Reviewed by Adam Barth.
+
+        * css/StylePropertySet.cpp: Removed useless define.
+
 2012-09-20  Emil A Eklund  <eae@chromium.org>
 
         snapToSize rounds the incorrectly for negative locations
index 6e3c0fd..0abb5fe 100644 (file)
@@ -19,8 +19,6 @@
  * Boston, MA 02110-1301, USA.
  */
 
-#define WTF_DEPRECATED_STRING_OPERATORS
-
 #include "config.h"
 #include "StylePropertySet.h"
 
index 340eed6..d5777b4 100644 (file)
@@ -1,3 +1,14 @@
+2012-09-24  Patrick Gansterer  <paroga@webkit.org>
+
+        Remove remaining WTF_DEPRECATED_STRING_OPERATORS from cpp files
+        https://bugs.webkit.org/show_bug.cgi?id=97412
+
+        Reviewed by Adam Barth.
+
+        * src/WebPageSerializerImpl.cpp:
+        (WebKit::WebPageSerializerImpl::openTagToString): Replaced operator+= with StringBuilder::append().
+        (WebKit::WebPageSerializerImpl::endTagToString): Ditto.
+
 2012-09-24  Yury Semikhatsky  <yurys@chromium.org>
 
         Unreviewed, rolling out r122243.
index 793ca8b..02a665a 100644 (file)
@@ -75,8 +75,6 @@
 // override the incorrect base URL and make sure we alway load correct local
 // saved resource files.
 
-#define WTF_DEPRECATED_STRING_OPERATORS
-
 #include "config.h"
 #include "WebPageSerializerImpl.h"
 
@@ -300,23 +298,24 @@ void WebPageSerializerImpl::encodeAndFlushBuffer(
 void WebPageSerializerImpl::openTagToString(Element* element,
                                             SerializeDomParam* param)
 {
-    // FIXME: use StringBuilder instead of String.
     bool needSkip;
+    StringBuilder result;
     // Do pre action for open tag.
-    String result = preActionBeforeSerializeOpenTag(element, param, &needSkip);
+    result.append(preActionBeforeSerializeOpenTag(element, param, &needSkip));
     if (needSkip)
         return;
     // Add open tag
-    result += "<" + element->nodeName().lower();
+    result.append('<');
+    result.append(element->nodeName().lower());
     // Go through all attributes and serialize them.
     if (element->hasAttributes()) {
         unsigned numAttrs = element->attributeCount();
         for (unsigned i = 0; i < numAttrs; i++) {
-            result += " ";
+            result.append(' ');
             // Add attribute pair
             const Attribute *attribute = element->attributeItem(i);
-            result += attribute->name().toString();
-            result += "=\"";
+            result.append(attribute->name().toString());
+            result.appendLiteral("=\"");
             if (!attribute->value().isEmpty()) {
                 const String& attrValue = attribute->value();
 
@@ -326,7 +325,7 @@ void WebPageSerializerImpl::openTagToString(Element* element,
                 if (elementHasLegalLinkAttribute(element, attrName)) {
                     // For links start with "javascript:", we do not change it.
                     if (attrValue.startsWith("javascript:", false))
-                        result += attrValue;
+                        result.append(attrValue);
                     else {
                         // Get the absolute link
                         WebFrameImpl* subFrame = WebFrameImpl::fromFrameOwnerElement(element);
@@ -334,20 +333,23 @@ void WebPageSerializerImpl::openTagToString(Element* element,
                                                         param->document->completeURL(attrValue);
                         // Check whether we have local files for those link.
                         if (m_localLinks.contains(completeURL)) {
-                            if (!param->directoryName.isEmpty())
-                                result += "./" + param->directoryName + "/";
-                            result += m_localLinks.get(completeURL);
+                            if (!param->directoryName.isEmpty()) {
+                                result.appendLiteral("./");
+                                result.append(param->directoryName);
+                                result.append('/');
+                            }
+                            result.append(m_localLinks.get(completeURL));
                         } else
-                            result += completeURL;
+                            result.append(completeURL);
                     }
                 } else {
                     if (param->isHTMLDocument)
-                        result += m_htmlEntities.convertEntitiesInString(attrValue);
+                        result.append(m_htmlEntities.convertEntitiesInString(attrValue));
                     else
-                        result += m_xmlEntities.convertEntitiesInString(attrValue);
+                        result.append(m_xmlEntities.convertEntitiesInString(attrValue));
                 }
             }
-            result += "\"";
+            result.append('\"');
         }
     }
 
@@ -355,11 +357,11 @@ void WebPageSerializerImpl::openTagToString(Element* element,
     String addedContents = postActionAfterSerializeOpenTag(element, param);
     // Complete the open tag for element when it has child/children.
     if (element->hasChildNodes() || param->haveAddedContentsBeforeEnd)
-        result += ">";
+        result.append('>');
     // Append the added contents generate in  post action of open tag.
-    result += addedContents;
+    result.append(addedContents);
     // Save the result to data buffer.
-    saveHTMLContentToBuffer(result, param);
+    saveHTMLContentToBuffer(result.toString(), param);
 }
 
 // Serialize end tag of an specified element.
@@ -367,37 +369,36 @@ void WebPageSerializerImpl::endTagToString(Element* element,
                                            SerializeDomParam* param)
 {
     bool needSkip;
+    StringBuilder result;
     // Do pre action for end tag.
-    String result = preActionBeforeSerializeEndTag(element,
-                                                   param,
-                                                   &needSkip);
+    result.append(preActionBeforeSerializeEndTag(element, param, &needSkip));
     if (needSkip)
         return;
     // Write end tag when element has child/children.
     if (element->hasChildNodes() || param->haveAddedContentsBeforeEnd) {
-        result += "</";
-        result += element->nodeName().lower();
-        result += ">";
+        result.appendLiteral("</");
+        result.append(element->nodeName().lower());
+        result.append('>');
     } else {
         // Check whether we have to write end tag for empty element.
         if (param->isHTMLDocument) {
-            result += ">";
+            result.append('>');
             // FIXME: This code is horribly wrong.  WebPageSerializerImpl must die.
             if (!static_cast<const HTMLElement*>(element)->ieForbidsInsertHTML()) {
                 // We need to write end tag when it is required.
-                result += "</";
-                result += element->nodeName().lower();
-                result += ">";
+                result.appendLiteral("</");
+                result.append(element->nodeName().lower());
+                result.append('>');
             }
         } else {
             // For xml base document.
-            result += " />";
+            result.appendLiteral(" />");
         }
     }
     // Do post action for end tag.
-    result += postActionAfterSerializeEndTag(element, param);
+    result.append(postActionAfterSerializeEndTag(element, param));
     // Save the result to data buffer.
-    saveHTMLContentToBuffer(result, param);
+    saveHTMLContentToBuffer(result.toString(), param);
 }
 
 void WebPageSerializerImpl::buildContentForNode(Node* node,