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

Side by Side Diff: content/renderer/pepper/event_conversion.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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/renderer/pepper/event_conversion.h" 5 #include "content/renderer/pepper/event_conversion.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 #include <string.h> 9 #include <string.h>
10 10
(...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after
526 std::string functionKeyName = base::StringPrintf("F%d", i); 526 std::string functionKeyName = base::StringPrintf("F%d", i);
527 if (functionKeyName == char_text) { 527 if (functionKeyName == char_text) {
528 vk_code = VK_F1 + (i - 1); 528 vk_code = VK_F1 + (i - 1);
529 break; 529 break;
530 } 530 }
531 } 531 }
532 if (!vk_code) { 532 if (!vk_code) {
533 base::string16 char_text16 = base::UTF8ToUTF16(char_text); 533 base::string16 char_text16 = base::UTF8ToUTF16(char_text);
534 DCHECK_EQ(char_text16.size(), 1U); 534 DCHECK_EQ(char_text16.size(), 1U);
535 vk_text = vk_code = char_text16[0]; 535 vk_text = vk_code = char_text16[0];
536 *needs_shift_modifier = 536 *needs_shift_modifier = base::IsAsciiUpper(vk_code & 0xFF);
537 (vk_code & 0xFF) >= 'A' && (vk_code & 0xFF) <= 'Z'; 537 if (base::IsAsciiLower(vk_code & 0xFF))
538 if ((vk_code & 0xFF) >= 'a' && (vk_code & 0xFF) <= 'z')
539 vk_code -= 'a' - 'A'; 538 vk_code -= 'a' - 'A';
540 *generate_char = true; 539 *generate_char = true;
541 } 540 }
542 } 541 }
543 542
544 *code = vk_code; 543 *code = vk_code;
545 *text = vk_text; 544 *text = vk_text;
546 } 545 }
547 546
548 } // namespace 547 } // namespace
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
744 case WebInputEvent::TouchStart: 743 case WebInputEvent::TouchStart:
745 return PP_INPUTEVENT_CLASS_TOUCH; 744 return PP_INPUTEVENT_CLASS_TOUCH;
746 case WebInputEvent::Undefined: 745 case WebInputEvent::Undefined:
747 default: 746 default:
748 CHECK(WebInputEvent::isGestureEventType(type)); 747 CHECK(WebInputEvent::isGestureEventType(type));
749 return PP_InputEvent_Class(0); 748 return PP_InputEvent_Class(0);
750 } 749 }
751 } 750 }
752 751
753 } // namespace content 752 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698