Use emptyString instead of String("")
authorkseo@webkit.org <kseo@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 31 Jul 2013 23:54:09 +0000 (23:54 +0000)
committerkseo@webkit.org <kseo@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 31 Jul 2013 23:54:09 +0000 (23:54 +0000)
https://bugs.webkit.org/show_bug.cgi?id=119335

Reviewed by Darin Adler.

Use emptyString() instead of String("") because it is better style and
faster. This is a followup to r116908, removing all occurrences of
String("") from WebKit.

Source/JavaScriptCore:

* runtime/RegExpConstructor.cpp:
(JSC::constructRegExp):
* runtime/RegExpPrototype.cpp:
(JSC::regExpProtoFuncCompile):
* runtime/StringPrototype.cpp:
(JSC::stringProtoFuncMatch):
(JSC::stringProtoFuncSearch):

Source/WebCore:

No behavior change, no new tests needed.

* platform/graphics/blackberry/LayerAnimation.h:
(WebCore::LayerAnimation::name):
* platform/mac/PlatformEventFactoryMac.mm:
(WebCore::textFromEvent):
(WebCore::unmodifiedTextFromEvent):
(WebCore::keyIdentifierForKeyEvent):

Source/WebKit/mac:

* WebCoreSupport/WebFrameLoaderClient.mm:
(WebFrameLoaderClient::userAgent):

Source/WebKit/qt:

* WebCoreSupport/ChromeClientQt.cpp:
(WebCore::ChromeClientQt::runJavaScriptPrompt):

Source/WebKit2:

* Shared/mac/WebEventFactory.mm:
(WebKit::textFromEvent):
(WebKit::unmodifiedTextFromEvent):

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

13 files changed:
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/runtime/RegExpConstructor.cpp
Source/JavaScriptCore/runtime/RegExpPrototype.cpp
Source/JavaScriptCore/runtime/StringPrototype.cpp
Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/blackberry/LayerAnimation.h
Source/WebCore/platform/mac/PlatformEventFactoryMac.mm
Source/WebKit/mac/ChangeLog
Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm
Source/WebKit/qt/ChangeLog
Source/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp
Source/WebKit2/ChangeLog
Source/WebKit2/Shared/mac/WebEventFactory.mm

index 839d0fe..5544cae 100644 (file)
@@ -1,3 +1,22 @@
+2013-07-31  Kwang Yul Seo  <skyul@company100.net>
+
+        Use emptyString instead of String("")
+        https://bugs.webkit.org/show_bug.cgi?id=119335
+
+        Reviewed by Darin Adler.
+
+        Use emptyString() instead of String("") because it is better style and
+        faster. This is a followup to r116908, removing all occurrences of
+        String("") from WebKit.
+
+        * runtime/RegExpConstructor.cpp:
+        (JSC::constructRegExp):
+        * runtime/RegExpPrototype.cpp:
+        (JSC::regExpProtoFuncCompile):
+        * runtime/StringPrototype.cpp:
+        (JSC::stringProtoFuncMatch):
+        (JSC::stringProtoFuncSearch):
+
 2013-07-31  Ruth Fong  <ruth_fong@apple.com>
 
         <input type=color> Mac UI behaviour
index a27a4ae..7ea1248 100644 (file)
@@ -270,7 +270,7 @@ JSObject* constructRegExp(ExecState* exec, JSGlobalObject* globalObject, const A
         return asObject(arg0);
     }
 
-    String pattern = arg0.isUndefined() ? String("") : arg0.toString(exec)->value(exec);
+    String pattern = arg0.isUndefined() ? emptyString() : arg0.toString(exec)->value(exec);
     if (exec->hadException())
         return 0;
 
index 8071f81..8f0b223 100644 (file)
@@ -108,7 +108,7 @@ EncodedJSValue JSC_HOST_CALL regExpProtoFuncCompile(ExecState* exec)
             return throwVMError(exec, createTypeError(exec, ASCIILiteral("Cannot supply flags when constructing one RegExp from another.")));
         regExp = asRegExpObject(arg0)->regExp();
     } else {
-        String pattern = !exec->argumentCount() ? String("") : arg0.toString(exec)->value(exec);
+        String pattern = !exec->argumentCount() ? emptyString() : arg0.toString(exec)->value(exec);
         if (exec->hadException())
             return JSValue::encode(jsUndefined());
 
index a672a21..825cccb 100644 (file)
@@ -851,7 +851,7 @@ EncodedJSValue JSC_HOST_CALL stringProtoFuncMatch(ExecState* exec)
          *  replaced with the result of the expression new RegExp(regexp).
          *  Per ECMA 15.10.4.1, if a0 is undefined substitute the empty string.
          */
-        regExp = RegExp::create(exec->vm(), a0.isUndefined() ? String("") : a0.toString(exec)->value(exec), NoFlags);
+        regExp = RegExp::create(exec->vm(), a0.isUndefined() ? emptyString() : a0.toString(exec)->value(exec), NoFlags);
         if (!regExp->isValid())
             return throwVMError(exec, createSyntaxError(exec, regExp->errorMessage()));
     }
@@ -902,7 +902,7 @@ EncodedJSValue JSC_HOST_CALL stringProtoFuncSearch(ExecState* exec)
          *  replaced with the result of the expression new RegExp(regexp).
          *  Per ECMA 15.10.4.1, if a0 is undefined substitute the empty string.
          */
-        reg = RegExp::create(exec->vm(), a0.isUndefined() ? String("") : a0.toString(exec)->value(exec), NoFlags);
+        reg = RegExp::create(exec->vm(), a0.isUndefined() ? emptyString() : a0.toString(exec)->value(exec), NoFlags);
         if (!reg->isValid())
             return throwVMError(exec, createSyntaxError(exec, reg->errorMessage()));
     }
index eafc0d7..ba110f8 100644 (file)
@@ -1,3 +1,23 @@
+2013-07-31  Kwang Yul Seo  <skyul@company100.net>
+
+        Use emptyString instead of String("")
+        https://bugs.webkit.org/show_bug.cgi?id=119335
+
+        Reviewed by Darin Adler.
+
+        Use emptyString() instead of String("") because it is better style and
+        faster. This is a followup to r116908, removing all occurrences of
+        String("") from WebKit.
+
+        No behavior change, no new tests needed.
+
+        * platform/graphics/blackberry/LayerAnimation.h:
+        (WebCore::LayerAnimation::name):
+        * platform/mac/PlatformEventFactoryMac.mm:
+        (WebCore::textFromEvent):
+        (WebCore::unmodifiedTextFromEvent):
+        (WebCore::keyIdentifierForKeyEvent):
+
 2013-07-31  Ruth Fong  <ruth_fong@apple.com>
 
         <input type=color> Mac UI behaviour
index 2c61b21..ba2bd02 100644 (file)
@@ -59,7 +59,7 @@ public:
     String name() const
     {
         if (m_name.isEmpty())
-            return String("");
+            return emptyString();
         return String(m_name);
     }
 
index 2684fb7..596cf4d 100644 (file)
@@ -232,14 +232,14 @@ static PlatformEvent::Type gestureEventTypeForEvent(NSEvent *event)
 static inline String textFromEvent(NSEvent* event)
 {
     if ([event type] == NSFlagsChanged)
-        return String("");
+        return emptyString();
     return String([event characters]);
 }
 
 static inline String unmodifiedTextFromEvent(NSEvent* event)
 {
     if ([event type] == NSFlagsChanged)
-        return String("");
+        return emptyString();
     return String([event charactersIgnoringModifiers]);
 }
 
@@ -268,7 +268,7 @@ String keyIdentifierForKeyEvent(NSEvent* event)
                 
             default:
                 ASSERT_NOT_REACHED();
-                return String("");
+                return emptyString();
         }
     
     NSString *s = [event charactersIgnoringModifiers];
index be5b0b5..1068a55 100644 (file)
@@ -1,3 +1,17 @@
+2013-07-31  Kwang Yul Seo  <skyul@company100.net>
+
+        Use emptyString instead of String("")
+        https://bugs.webkit.org/show_bug.cgi?id=119335
+
+        Reviewed by Darin Adler.
+
+        Use emptyString() instead of String("") because it is better style and
+        faster. This is a followup to r116908, removing all occurrences of
+        String("") from WebKit.
+
+        * WebCoreSupport/WebFrameLoaderClient.mm:
+        (WebFrameLoaderClient::userAgent):
+
 2013-07-31  Ruth Fong  <ruth_fong@apple.com>
 
         <input type=color> Mac UI behaviour
index 5fceb35..1e5cb18 100644 (file)
@@ -1334,7 +1334,7 @@ String WebFrameLoaderClient::userAgent(const KURL& url)
     // Most other call sites are tolerant of nil because of Objective-C behavior, but this one
     // is not because the return value of _userAgentForURL is a const KURL&.
     if (!webView)
-        return String("");
+        return emptyString();
 
     return [webView _userAgentString];
 }
index e814799..796ade1 100644 (file)
@@ -1,3 +1,17 @@
+2013-07-31  Kwang Yul Seo  <skyul@company100.net>
+
+        Use emptyString instead of String("")
+        https://bugs.webkit.org/show_bug.cgi?id=119335
+
+        Reviewed by Darin Adler.
+
+        Use emptyString() instead of String("") because it is better style and
+        faster. This is a followup to r116908, removing all occurrences of
+        String("") from WebKit.
+
+        * WebCoreSupport/ChromeClientQt.cpp:
+        (WebCore::ChromeClientQt::runJavaScriptPrompt):
+
 2013-07-31  Michael BrĂ¼ning  <michael.bruning@digia.com>
 
         [Qt][WK1] navigator.plugins shows too few entries.
index 1aeae89..344d3e7 100644 (file)
@@ -357,7 +357,7 @@ bool ChromeClientQt::runJavaScriptPrompt(Frame* f, const String& message, const
     // Fix up a quirk in the QInputDialog class. If no input happened the string should be empty
     // but it is null. See https://bugs.webkit.org/show_bug.cgi?id=30914.
     if (rc && x.isNull())
-        result = String("");
+        result = emptyString();
     else
         result = x;
 
index a30929f..5274fda 100644 (file)
@@ -1,3 +1,18 @@
+2013-07-31  Kwang Yul Seo  <skyul@company100.net>
+
+        Use emptyString instead of String("")
+        https://bugs.webkit.org/show_bug.cgi?id=119335
+
+        Reviewed by Darin Adler.
+
+        Use emptyString() instead of String("") because it is better style and
+        faster. This is a followup to r116908, removing all occurrences of
+        String("") from WebKit.
+
+        * Shared/mac/WebEventFactory.mm:
+        (WebKit::textFromEvent):
+        (WebKit::unmodifiedTextFromEvent):
+
 2013-07-31  Ruth Fong  <ruth_fong@apple.com>
 
         <input type=color> Mac UI behaviour
index d83802a..dac6f1a 100644 (file)
@@ -255,14 +255,14 @@ static WebEvent::Type gestureEventTypeForEvent(NSEvent *event)
 static inline String textFromEvent(NSEvent* event)
 {
     if ([event type] == NSFlagsChanged)
-        return String("");
+        return emptyString();
     return String([event characters]);
 }
 
 static inline String unmodifiedTextFromEvent(NSEvent* event)
 {
     if ([event type] == NSFlagsChanged)
-        return String("");
+        return emptyString();
     return String([event charactersIgnoringModifiers]);
 }