Reland "[skottie] AllCaps support"

This reverts commit 6142500513e17b9ace6ee89af9e52dd8041a236f.

Reason for revert: relanding with fixes

Original change's description:
> Revert "[skottie] AllCaps support"
>
> This reverts commit efc7ca4a719029ea636addec9f0c138df01ce420.
>
> Reason for revert: broke Chromium, NoDEPS builds
>
> Original change's description:
> > [skottie] AllCaps support
> >
> > AfterEffects and Bodymovin support an "AllCaps" text flag which forces
> > text capitalization.
> >
> >   * add toUpper() bindings to SkUnicode/SkICU
> >   * add capitalization options to SkottieShaper
> >   * plumb existing Lottie 'ca' (AllCaps) prop
> >   * also fix a couple of unrelated whoopsies
> >
> > Change-Id: I8e80921b66530e9830938004946082c6e450b04b
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/445104
> > Reviewed-by: Ben Wagner <bungeman@google.com>
> > Commit-Queue: Florin Malita <fmalita@google.com>
>
> TBR=bungeman@google.com,fmalita@chromium.org,fmalita@google.com,jlavrova@google.com,skcq-be@skia-corp.google.com.iam.gserviceaccount.com
>
> Change-Id: I3bb43f37f07cfc021e397df578499a4c4da15ca3
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/444980
> Reviewed-by: Florin Malita <fmalita@google.com>
> Commit-Queue: Florin Malita <fmalita@google.com>

Change-Id: Id729e09d4cade0cead193ffc5e6bd4fea1cdcff6
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/445598
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Florin Malita <fmalita@google.com>
diff --git a/modules/skunicode/src/SkUnicode_icu.cpp b/modules/skunicode/src/SkUnicode_icu.cpp
index 4d5b960..7b33f2a 100644
--- a/modules/skunicode/src/SkUnicode_icu.cpp
+++ b/modules/skunicode/src/SkUnicode_icu.cpp
@@ -498,6 +498,37 @@
         }
     }
 
+    SkString toUpper(const SkString& str) override {
+        // Convert to UTF16 since that's what ICU wants.
+        std::unique_ptr<uint16_t[]> str16;
+        const auto str16len = utf8ToUtf16(str.c_str(), str.size(), &str16);
+        if (str16len <= 0) {
+            return SkString();
+        }
+
+        UErrorCode icu_err = U_ZERO_ERROR;
+        const auto upper16len = sk_u_strToUpper(nullptr, 0, (UChar*)(str16.get()), str16len,
+                                                nullptr, &icu_err);
+        if (icu_err != U_BUFFER_OVERFLOW_ERROR || upper16len <= 0) {
+            return SkString();
+        }
+
+        SkAutoSTArray<128, uint16_t> upper16(upper16len);
+        icu_err = U_ZERO_ERROR;
+        sk_u_strToUpper((UChar*)(upper16.get()), SkToS32(upper16.size()),
+                        (UChar*)(str16.get()), str16len,
+                        nullptr, &icu_err);
+        SkASSERT(!U_FAILURE(icu_err));
+
+        // ... and back to utf8 'cause that's what we want.
+        std::unique_ptr<char[]> upper8;
+        auto upper8len = utf16ToUtf8(upper16.data(), upper16.size(), &upper8);
+
+        return upper8len >= 0
+                ? SkString(upper8.get(), upper8len)
+                : SkString();
+    }
+
     bool getBidiRegions(const char utf8[],
                         int utf8Units,
                         TextDirection dir,