Migrate DeprecatedLower to LowerASCII where only compared with ASCII
This CL changes DeprecatedLower calls to LowerASCII where the result
is only ever used in a comparison against one or more ASCII constants
(including predicates like StartsWith) but is otherwise dead, and I
believe it’s the last CL needed to finish our intent to remove Unicode
case-insensitivity for ASCII constants [1].
The correctness of the image_encoder_utils.cc change isn’t obvious,
but you can verify it by heading to the line in Chromium Code Search
[2], hovering over lowercase_mime_type, and observing that the only
reads are == MIME type literals and by two functions:
• IsSupportedImageMIMETypeForEncoding (line 78), which does the same
• ParseImageEncodingMimeType (line 80), which does the same
These changes are potentially author-facing, except where the constant
in question contains none of {s,k,S,K} [3], but I’ve optimistically
made them without any additional tests based on Rick Byers’ reasoning
on blink-dev [4]. Please let me know if that’s not sufficient here.
[1] https://groups.google.com/a/chromium.org/d/topic/blink-dev/sFOpNuQ91UU
[2] https://source.chromium.org/chromium/chromium/src/+/f7455871a37e53362183771af7de36844df73a38:third_party/blink/renderer/platform/image-encoders/image_encoder_utils.cc;l=36
[3] https://www.unicode.org/Public/UCD/latest/ucd/CaseFolding.txt
[4] https://groups.google.com/a/chromium.org/d/msg/blink-dev/sFOpNuQ91UU/3u1HxbnQCQAJ
Change-Id: I10e621bb2a6947bc3004d9a0c156dcae2e05a6e8
Bug: 627682
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2114510
Commit-Queue: Delan Azabani <dazabani@igalia.com>
Reviewed-by: Frédéric Wang <fwang@igalia.com>
Reviewed-by: Yoshifumi Inoue <yosin@chromium.org>
Reviewed-by: Dmitry Gozman <dgozman@chromium.org>
Reviewed-by: Darwin Huang <huangdarwin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#753581}
diff --git a/third_party/blink/renderer/core/clipboard/data_transfer.cc b/third_party/blink/renderer/core/clipboard/data_transfer.cc
index 1a3df92..047fb19 100644
--- a/third_party/blink/renderer/core/clipboard/data_transfer.cc
+++ b/third_party/blink/renderer/core/clipboard/data_transfer.cc
@@ -204,11 +204,11 @@
}
// We provide the IE clipboard types (URL and Text), and the clipboard types
-// specified in the WHATWG Web Applications 1.0 draft see
-// http://www.whatwg.org/specs/web-apps/current-work/ Section 6.3.5.3
+// specified in the HTML spec. See
+// https://html.spec.whatwg.org/multipage/dnd.html#the-datatransfer-interface
static String NormalizeType(const String& type,
bool* convert_to_url = nullptr) {
- String clean_type = type.StripWhiteSpace().DeprecatedLower();
+ String clean_type = type.StripWhiteSpace().LowerASCII();
if (clean_type == kMimeTypeText ||
clean_type.StartsWith(kMimeTypeTextPlainEtc))
return kMimeTypeTextPlain;
diff --git a/third_party/blink/renderer/core/editing/commands/editing_command_test.cc b/third_party/blink/renderer/core/editing/commands/editing_command_test.cc
index 834407d..c2c2f90 100644
--- a/third_party/blink/renderer/core/editing/commands/editing_command_test.cc
+++ b/third_party/blink/renderer/core/editing/commands/editing_command_test.cc
@@ -62,7 +62,7 @@
Editor& dummy_editor = GetDocument().GetFrame()->GetEditor();
for (const auto& entry : kCommandNameEntries) {
const EditorCommand lower_name_command =
- dummy_editor.CreateCommand(String(entry.name).DeprecatedLower());
+ dummy_editor.CreateCommand(String(entry.name).LowerASCII());
EXPECT_EQ(static_cast<int>(entry.type), lower_name_command.IdForHistogram())
<< entry.name;
const EditorCommand upper_name_command =
diff --git a/third_party/blink/renderer/core/inspector/dom_patch_support.cc b/third_party/blink/renderer/core/inspector/dom_patch_support.cc
index 22986df..2c9111e 100644
--- a/third_party/blink/renderer/core/inspector/dom_patch_support.cc
+++ b/third_party/blink/renderer/core/inspector/dom_patch_support.cc
@@ -132,7 +132,7 @@
old_list.push_back(CreateDigest(child, nullptr));
// Compose the new list.
- String markup_copy = markup.DeprecatedLower();
+ String markup_copy = markup.LowerASCII();
HeapVector<Member<Digest>> new_list;
for (Node* child = parent_node->firstChild(); child != node;
child = child->nextSibling())
diff --git a/third_party/blink/renderer/platform/image-encoders/image_encoder_utils.cc b/third_party/blink/renderer/platform/image-encoders/image_encoder_utils.cc
index 7ecb343..97cf9c9 100644
--- a/third_party/blink/renderer/platform/image-encoders/image_encoder_utils.cc
+++ b/third_party/blink/renderer/platform/image-encoders/image_encoder_utils.cc
@@ -33,7 +33,7 @@
ImageEncodingMimeType ImageEncoderUtils::ToEncodingMimeType(
const String& mime_type_name,
const EncodeReason encode_reason) {
- String lowercase_mime_type = mime_type_name.DeprecatedLower();
+ String lowercase_mime_type = mime_type_name.LowerASCII();
RequestedImageMimeType requested_mime_type;
if (mime_type_name.IsNull())
diff --git a/third_party/blink/renderer/platform/mhtml/mhtml_parser.cc b/third_party/blink/renderer/platform/mhtml/mhtml_parser.cc
index b287748..c055297e 100644
--- a/third_party/blink/renderer/platform/mhtml/mhtml_parser.cc
+++ b/third_party/blink/renderer/platform/mhtml/mhtml_parser.cc
@@ -234,7 +234,7 @@
MIMEHeader::Encoding MIMEHeader::ParseContentTransferEncoding(
const String& text) {
- String encoding = text.StripWhiteSpace().DeprecatedLower();
+ String encoding = text.StripWhiteSpace().LowerASCII();
if (encoding == "base64")
return Encoding::kBase64;
if (encoding == "quoted-printable")
diff --git a/third_party/blink/renderer/platform/network/mime/mime_type_registry.cc b/third_party/blink/renderer/platform/network/mime/mime_type_registry.cc
index 4e1d64b..e35ee692 100644
--- a/third_party/blink/renderer/platform/network/mime/mime_type_registry.cc
+++ b/third_party/blink/renderer/platform/network/mime/mime_type_registry.cc
@@ -193,7 +193,7 @@
static const unsigned kFontLen = 5;
if (!mime_type.StartsWithIgnoringASCIICase("font/"))
return false;
- String sub_type = mime_type.Substring(kFontLen).DeprecatedLower();
+ String sub_type = mime_type.Substring(kFontLen).LowerASCII();
return sub_type == "woff" || sub_type == "woff2" || sub_type == "otf" ||
sub_type == "ttf" || sub_type == "sfnt";
}