Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5)

Unified Diff: components/test_runner/event_sender.cc

Issue 1878083002: Implement IsAsciiUpper and IsAsciiLower in base/strings/string_util.h (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: git sync Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: components/test_runner/event_sender.cc
diff --git a/components/test_runner/event_sender.cc b/components/test_runner/event_sender.cc
index e8b66d0dd34f81a4aab2dd92f24f28bcc4cedea6..58b8f1c179ad0271b0cfa6f2f8d1e08f2af055dd 100644
--- a/components/test_runner/event_sender.cc
+++ b/components/test_runner/event_sender.cc
@@ -397,11 +397,6 @@ std::vector<std::string> MakeMenuItemStringsFor(
// WebKit impl and layout test results.
const float kScrollbarPixelsPerTick = 40.0f;
-bool NeedsShiftModifier(int keyCode) {
- // If code is an uppercase letter, assign a SHIFT key to eventDown.modifier.
- return (keyCode & 0xFF) >= 'A' && (keyCode & 0xFF) <= 'Z';
-}
-
// Get the edit command corresponding to a keyboard event.
// Returns true if the specified event corresponds to an edit command, the name
// of the edit command will be stored in |*name|.
@@ -1529,14 +1524,14 @@ void EventSender::KeyDown(const std::string& code_str,
return;
}
text = code = code_str16[0];
- needs_shift_key_modifier = NeedsShiftModifier(code);
- if ((code & 0xFF) >= 'a' && (code & 0xFF) <= 'z')
+ needs_shift_key_modifier = base::IsAsciiUpper(code & 0xFF);
+ if (base::IsAsciiLower(code & 0xFF))
code -= 'a' - 'A';
- if ((code >= 'A' && code <= 'Z') || (code >= 'a' && code <= 'z')) {
+ if (base::IsAsciiAlpha(code)) {
domString.assign("Key");
domString.push_back(
base::ToUpperASCII(static_cast<base::char16>(code)));
- } else if (code >= '0' && code <= '9') {
+ } else if (base::IsAsciiDigit(code)) {
domString.assign("Digit");
domString.push_back(code);
} else if (code == ' ') {

Powered by Google App Engine
This is Rietveld 408576698