Get rid of most calls to String::upper; mostly replace them with convertToASCIIUppercase
authordarin@apple.com <darin@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 1 Feb 2016 01:50:50 +0000 (01:50 +0000)
committerdarin@apple.com <darin@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 1 Feb 2016 01:50:50 +0000 (01:50 +0000)
https://bugs.webkit.org/show_bug.cgi?id=153715

Reviewed by Gyuyoung Kim.

Source/WebCore:

* editing/cocoa/HTMLConverter.mm:
(HTMLConverter::computedAttributesForElement): Use convertToASCIILowercase to fold
ASCII case when searching for fonts by name.

* platform/network/cf/ResourceResponseCFNet.cpp:
(WebCore::ResourceResponse::platformLazyInit): Use convertToASCIIUppercase to make
the HTTP version string canonical. Not sure why it's needed at all, but the letters
we might be uppercasing are "HTTP", so no need to handle non-ASCII.
* platform/network/cocoa/ResourceResponseCocoa.mm:
(WebCore::ResourceResponse::platformLazyInit): Ditto.

* rendering/svg/SVGRenderTreeAsText.cpp:
(WebCore::operator<<): Use convertToASCIIUppercase when writing the spread
method type into a text stream. The method types are all ASCII.

Source/WebKit2:

* UIProcess/API/efl/tests/test_ewk2_text_checker.cpp:
Use convertToASCIIUppercase on language names.

Source/WTF:

* wtf/text/AtomicString.h:
(WTF::AtomicString::upper): Deleted.

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

Source/WTF/ChangeLog
Source/WTF/wtf/text/AtomicString.h
Source/WebCore/ChangeLog
Source/WebCore/editing/cocoa/HTMLConverter.mm
Source/WebCore/platform/network/cf/ResourceResponseCFNet.cpp
Source/WebCore/platform/network/cocoa/ResourceResponseCocoa.mm
Source/WebCore/rendering/svg/SVGRenderTreeAsText.cpp
Source/WebKit2/ChangeLog
Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_text_checker.cpp

index 168bc1f..3f98cbd 100644 (file)
@@ -1,3 +1,13 @@
+2016-01-31  Darin Adler  <darin@apple.com>
+
+        Get rid of most calls to String::upper; mostly replace them with convertToASCIIUppercase
+        https://bugs.webkit.org/show_bug.cgi?id=153715
+
+        Reviewed by Gyuyoung Kim.
+
+        * wtf/text/AtomicString.h:
+        (WTF::AtomicString::upper): Deleted.
+
 2016-01-31  Dan Bernstein  <mitz@apple.com>
 
         [Cocoa] Remove unused definition of HAVE_HEADER_DETECTION_H
index 73f2688..a9e4069 100644 (file)
@@ -156,7 +156,6 @@ public:
     WTF_EXPORT_STRING_API AtomicString convertToASCIILowercase() const;
     WTF_EXPORT_STRING_API AtomicString convertToASCIIUppercase() const;
     WTF_EXPORT_STRING_API AtomicString lower() const;
-    AtomicString upper() const { return AtomicString(impl()->upper()); }
 
     int toInt(bool* ok = 0) const { return m_string.toInt(ok); }
     double toDouble(bool* ok = 0) const { return m_string.toDouble(ok); }
index 4869771..cb5b1de 100644 (file)
@@ -1,3 +1,25 @@
+2016-01-31  Darin Adler  <darin@apple.com>
+
+        Get rid of most calls to String::upper; mostly replace them with convertToASCIIUppercase
+        https://bugs.webkit.org/show_bug.cgi?id=153715
+
+        Reviewed by Gyuyoung Kim.
+
+        * editing/cocoa/HTMLConverter.mm:
+        (HTMLConverter::computedAttributesForElement): Use convertToASCIILowercase to fold
+        ASCII case when searching for fonts by name.
+
+        * platform/network/cf/ResourceResponseCFNet.cpp:
+        (WebCore::ResourceResponse::platformLazyInit): Use convertToASCIIUppercase to make
+        the HTTP version string canonical. Not sure why it's needed at all, but the letters
+        we might be uppercasing are "HTTP", so no need to handle non-ASCII.
+        * platform/network/cocoa/ResourceResponseCocoa.mm:
+        (WebCore::ResourceResponse::platformLazyInit): Ditto.
+
+        * rendering/svg/SVGRenderTreeAsText.cpp:
+        (WebCore::operator<<): Use convertToASCIIUppercase when writing the spread
+        method type into a text stream. The method types are all ASCII.
+
 2016-01-31  Dan Bernstein  <mitz@apple.com>
 
         [Cocoa] Remove __has_include guards around use of WebKitAdditions
index 716f34c..5f45e63 100644 (file)
@@ -1089,7 +1089,7 @@ NSDictionary *HTMLConverter::computedAttributesForElement(Element& element)
     if (!font) {
         String fontName = _caches->propertyValueForNode(element, CSSPropertyFontFamily);
         if (fontName.length())
-            font = _fontForNameAndSize(fontName.upper(), fontSize, _fontCache);
+            font = _fontForNameAndSize(fontName.convertToASCIILowercase(), fontSize, _fontCache);
         if (!font)
             font = [PlatformFontClass fontWithName:@"Times" size:fontSize];
 
index 1390a48..f715bf2 100644 (file)
@@ -86,8 +86,7 @@ void ResourceResponse::platformLazyInit(InitLevel initLevel)
 
         CFHTTPMessageRef httpResponse = CFURLResponseGetHTTPResponse(m_cfResponse.get());
         if (httpResponse) {
-            RetainPtr<CFStringRef> messageString = adoptCF(CFHTTPMessageCopyVersion(httpResponse));
-            m_httpVersion = String(messageString.get()).upper();
+            m_httpVersion = String(adoptCF(CFHTTPMessageCopyVersion(httpResponse)).get()).convertToASCIIUppercase();
             m_httpStatusCode = CFHTTPMessageGetResponseStatusCode(httpResponse);
             
             if (initLevel < AllFields) {
index 3650c7e..e7be41d 100644 (file)
@@ -187,8 +187,7 @@ void ResourceResponse::platformLazyInit(InitLevel initLevel)
             NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *)m_nsResponse.get();
 
             CFHTTPMessageRef messageRef = CFURLResponseGetHTTPResponse([httpResponse _CFURLResponse]);
-            RetainPtr<CFStringRef> messageString = adoptCF(CFHTTPMessageCopyVersion(messageRef));
-            m_httpVersion = String(messageString.get()).upper();
+            m_httpVersion = String(adoptCF(CFHTTPMessageCopyVersion(messageRef)).get()).convertToASCIIUppercase();
             m_httpStatusCode = [httpResponse statusCode];
             
             if (initLevel < AllFields) {
index 6d795c8..da5cc6b 100644 (file)
@@ -145,7 +145,7 @@ static TextStream& operator<<(TextStream& ts, const DashArray& a)
 
 static TextStream& operator<<(TextStream& ts, const SVGSpreadMethodType& type)
 {
-    ts << SVGPropertyTraits<SVGSpreadMethodType>::toString(type).upper();
+    ts << SVGPropertyTraits<SVGSpreadMethodType>::toString(type).convertToASCIIUppercase();
     return ts;
 }
 
index ee790bd..8d86d4e 100644 (file)
@@ -1,3 +1,13 @@
+2016-01-31  Darin Adler  <darin@apple.com>
+
+        Get rid of most calls to String::upper; mostly replace them with convertToASCIIUppercase
+        https://bugs.webkit.org/show_bug.cgi?id=153715
+
+        Reviewed by Gyuyoung Kim.
+
+        * UIProcess/API/efl/tests/test_ewk2_text_checker.cpp:
+        Use convertToASCIIUppercase on language names.
+
 2016-01-31  Dan Bernstein  <mitz@apple.com>
 
         [Cocoa] Remove __has_include guards around use of WebKitAdditions
index 6b2a022..f1bbf73 100644 (file)
@@ -700,9 +700,9 @@ TEST_F(EWK2TextCheckerTest, ewk_text_checker_spell_checking_languages)
     // Case sensitivity of dictionaries doesn't affect on loading the dictionaries,
     // the Enchant library will 'normalize' them.
     WTF::StringBuilder languages;
-    languages.append(String(firstExpected).upper());
+    languages.append(String(firstExpected).convertToASCIIUppercase());
     languages.append(',');
-    languages.append(String(lastExpected).lower());
+    languages.append(String(lastExpected).convertToASCIILowercase());
 
     // Set both languages (the first and the last) from the list.
     ewk_text_checker_spell_checking_languages_set(languages.toString().utf8().data());