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

Side by Side Diff: views/controls/textfield/native_textfield_views.cc

Issue 7458014: Implement Uniscribe RenderText for Windows. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add simple BreakIterator support, use scoped_array, fix home/end, invalidate on toggle insert, etc. Created 9 years, 4 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "views/controls/textfield/native_textfield_views.h" 5 #include "views/controls/textfield/native_textfield_views.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 843 matching lines...) Expand 10 before | Expand all | Expand 10 after
854 model_->MoveCursorRight( 854 model_->MoveCursorRight(
855 control ? gfx::WORD_BREAK : gfx::CHARACTER_BREAK, selection); 855 control ? gfx::WORD_BREAK : gfx::CHARACTER_BREAK, selection);
856 cursor_changed = true; 856 cursor_changed = true;
857 break; 857 break;
858 case ui::VKEY_LEFT: 858 case ui::VKEY_LEFT:
859 model_->MoveCursorLeft( 859 model_->MoveCursorLeft(
860 control ? gfx::WORD_BREAK : gfx::CHARACTER_BREAK, selection); 860 control ? gfx::WORD_BREAK : gfx::CHARACTER_BREAK, selection);
861 cursor_changed = true; 861 cursor_changed = true;
862 break; 862 break;
863 case ui::VKEY_END: 863 case ui::VKEY_END:
864 model_->MoveCursorRight(gfx::LINE_BREAK, selection);
865 cursor_changed = true;
866 break;
867 case ui::VKEY_HOME: 864 case ui::VKEY_HOME:
868 model_->MoveCursorLeft(gfx::LINE_BREAK, selection); 865 if (base::i18n::IsRTL() == (key_code == ui::VKEY_HOME))
866 model_->MoveCursorRight(gfx::LINE_BREAK, selection);
867 else
868 model_->MoveCursorLeft(gfx::LINE_BREAK, selection);
xji 2011/08/18 22:47:54 we need make this platform dependent. in windows,
msw 2011/08/19 10:55:30 Done.
869 cursor_changed = true; 869 cursor_changed = true;
870 break; 870 break;
871 case ui::VKEY_BACK: 871 case ui::VKEY_BACK:
872 if (!editable) 872 if (!editable)
873 break; 873 break;
874 if (!model_->HasSelection()) { 874 if (!model_->HasSelection()) {
875 if (selection && control) { 875 if (selection && control) {
876 // If both shift and control are pressed, then erase upto the 876 // If both shift and control are pressed, then erase upto the
877 // beginning of the buffer in ChromeOS. In windows, do nothing. 877 // beginning of the buffer in ChromeOS. In windows, do nothing.
878 #if defined(OS_WIN) 878 #if defined(OS_WIN)
(...skipping 22 matching lines...) Expand all
901 model_->MoveCursorRight(gfx::LINE_BREAK, true); 901 model_->MoveCursorRight(gfx::LINE_BREAK, true);
902 #endif 902 #endif
903 } else if (control) { 903 } else if (control) {
904 // If only control is pressed, then erase the next word. 904 // If only control is pressed, then erase the next word.
905 model_->MoveCursorRight(gfx::WORD_BREAK, true); 905 model_->MoveCursorRight(gfx::WORD_BREAK, true);
906 } 906 }
907 } 907 }
908 cursor_changed = text_changed = model_->Delete(); 908 cursor_changed = text_changed = model_->Delete();
909 break; 909 break;
910 case ui::VKEY_INSERT: 910 case ui::VKEY_INSERT:
911 GetRenderText()->toggle_insert_mode(); 911 GetRenderText()->ToggleInsertMode();
912 cursor_changed = true; 912 cursor_changed = true;
913 break; 913 break;
914 default: 914 default:
915 break; 915 break;
916 } 916 }
917 917
918 // We must have input method in order to support text input. 918 // We must have input method in order to support text input.
919 DCHECK(textfield_->GetInputMethod()); 919 DCHECK(textfield_->GetInputMethod());
920 920
921 UpdateAfterChange(text_changed, cursor_changed); 921 UpdateAfterChange(text_changed, cursor_changed);
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
1025 // Filter out all control characters, including tab and new line characters, 1025 // Filter out all control characters, including tab and new line characters,
1026 // and all characters with Alt modifier. But we need to allow characters with 1026 // and all characters with Alt modifier. But we need to allow characters with
1027 // AltGr modifier. 1027 // AltGr modifier.
1028 // On Windows AltGr is represented by Alt+Ctrl, and on Linux it's a different 1028 // On Windows AltGr is represented by Alt+Ctrl, and on Linux it's a different
1029 // flag that we don't care about. 1029 // flag that we don't care about.
1030 return ((ch >= 0x20 && ch < 0x7F) || ch > 0x9F) && 1030 return ((ch >= 0x20 && ch < 0x7F) || ch > 0x9F) &&
1031 (flags & ~(ui::EF_SHIFT_DOWN | ui::EF_CAPS_LOCK_DOWN)) != ui::EF_ALT_DOWN; 1031 (flags & ~(ui::EF_SHIFT_DOWN | ui::EF_CAPS_LOCK_DOWN)) != ui::EF_ALT_DOWN;
1032 } 1032 }
1033 1033
1034 } // namespace views 1034 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698