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

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: Fix RenderText::RightEndSelectionModel. Created 9 years, 3 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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 } else { 100 } else {
101 aggregated_clicks_ = 0; 101 aggregated_clicks_ = 0;
102 } 102 }
103 last_click_time_ = event.time_stamp(); 103 last_click_time_ = event.time_stamp();
104 last_click_location_ = event.location(); 104 last_click_location_ = event.location();
105 105
106 initiating_drag_ = false; 106 initiating_drag_ = false;
107 bool can_drag = true; 107 bool can_drag = true;
108 #if defined(TOUCH_UI) 108 #if defined(TOUCH_UI)
109 can_drag = false; 109 can_drag = false;
110 #endif 110 #endif
xji 2011/08/25 05:58:38 are the changes here related to bidi/complex scrip
msw 2011/08/26 16:26:25 I fixed the ui::VKEY_HOME/END code below, which no
msw 2011/08/26 16:26:25 The TOUCH_UI check? That's from crrev.com/97424, n
111 switch(aggregated_clicks_) { 111 switch(aggregated_clicks_) {
112 case 0: 112 case 0:
113 if (can_drag && GetRenderText()->IsPointInSelection(event.location())) 113 if (can_drag && GetRenderText()->IsPointInSelection(event.location()))
114 initiating_drag_ = true; 114 initiating_drag_ = true;
115 else 115 else
116 MoveCursorTo(event.location(), event.IsShiftDown()); 116 MoveCursorTo(event.location(), event.IsShiftDown());
117 break; 117 break;
118 case 1: 118 case 1:
119 model_->SelectWord(); 119 model_->SelectWord();
120 OnCaretBoundsChanged(); 120 OnCaretBoundsChanged();
(...skipping 745 matching lines...) Expand 10 before | Expand all | Expand 10 after
866 model_->MoveCursorRight( 866 model_->MoveCursorRight(
867 control ? gfx::WORD_BREAK : gfx::CHARACTER_BREAK, selection); 867 control ? gfx::WORD_BREAK : gfx::CHARACTER_BREAK, selection);
868 cursor_changed = true; 868 cursor_changed = true;
869 break; 869 break;
870 case ui::VKEY_LEFT: 870 case ui::VKEY_LEFT:
871 model_->MoveCursorLeft( 871 model_->MoveCursorLeft(
872 control ? gfx::WORD_BREAK : gfx::CHARACTER_BREAK, selection); 872 control ? gfx::WORD_BREAK : gfx::CHARACTER_BREAK, selection);
873 cursor_changed = true; 873 cursor_changed = true;
874 break; 874 break;
875 case ui::VKEY_END: 875 case ui::VKEY_END:
876 model_->MoveCursorRight(gfx::LINE_BREAK, selection);
877 cursor_changed = true;
878 break;
879 case ui::VKEY_HOME: 876 case ui::VKEY_HOME:
880 model_->MoveCursorLeft(gfx::LINE_BREAK, selection); 877 // TODO(msw): Implement RenderText::GetTextDirection for platforms.
878 // Windows string directionality is determined by UI directionality.
879 // Linux/ChromeOS uses the first strong directionality character.
880 #if defined(OS_WIN)
881 if (base::i18n::IsRTL() == (key_code == ui::VKEY_HOME))
882 #else
883 if (key_code == ui::VKEY_END)
884 #endif
885 model_->MoveCursorRight(gfx::LINE_BREAK, selection);
886 else
887 model_->MoveCursorLeft(gfx::LINE_BREAK, selection);
881 cursor_changed = true; 888 cursor_changed = true;
882 break; 889 break;
883 case ui::VKEY_BACK: 890 case ui::VKEY_BACK:
884 if (!editable) 891 if (!editable)
885 break; 892 break;
886 if (!model_->HasSelection()) { 893 if (!model_->HasSelection()) {
887 if (selection && control) { 894 if (selection && control) {
888 // If both shift and control are pressed, then erase upto the 895 // If both shift and control are pressed, then erase upto the
889 // beginning of the buffer in ChromeOS. In windows, do nothing. 896 // beginning of the buffer in ChromeOS. In windows, do nothing.
890 #if defined(OS_WIN) 897 #if defined(OS_WIN)
(...skipping 22 matching lines...) Expand all
913 model_->MoveCursorRight(gfx::LINE_BREAK, true); 920 model_->MoveCursorRight(gfx::LINE_BREAK, true);
914 #endif 921 #endif
915 } else if (control) { 922 } else if (control) {
916 // If only control is pressed, then erase the next word. 923 // If only control is pressed, then erase the next word.
917 model_->MoveCursorRight(gfx::WORD_BREAK, true); 924 model_->MoveCursorRight(gfx::WORD_BREAK, true);
918 } 925 }
919 } 926 }
920 cursor_changed = text_changed = model_->Delete(); 927 cursor_changed = text_changed = model_->Delete();
921 break; 928 break;
922 case ui::VKEY_INSERT: 929 case ui::VKEY_INSERT:
923 GetRenderText()->toggle_insert_mode(); 930 GetRenderText()->ToggleInsertMode();
924 cursor_changed = true; 931 cursor_changed = true;
925 break; 932 break;
926 default: 933 default:
927 break; 934 break;
928 } 935 }
929 936
930 // We must have input method in order to support text input. 937 // We must have input method in order to support text input.
931 DCHECK(textfield_->GetInputMethod()); 938 DCHECK(textfield_->GetInputMethod());
932 939
933 UpdateAfterChange(text_changed, cursor_changed); 940 UpdateAfterChange(text_changed, cursor_changed);
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
1037 // Filter out all control characters, including tab and new line characters, 1044 // Filter out all control characters, including tab and new line characters,
1038 // and all characters with Alt modifier. But we need to allow characters with 1045 // and all characters with Alt modifier. But we need to allow characters with
1039 // AltGr modifier. 1046 // AltGr modifier.
1040 // On Windows AltGr is represented by Alt+Ctrl, and on Linux it's a different 1047 // On Windows AltGr is represented by Alt+Ctrl, and on Linux it's a different
1041 // flag that we don't care about. 1048 // flag that we don't care about.
1042 return ((ch >= 0x20 && ch < 0x7F) || ch > 0x9F) && 1049 return ((ch >= 0x20 && ch < 0x7F) || ch > 0x9F) &&
1043 (flags & ~(ui::EF_SHIFT_DOWN | ui::EF_CAPS_LOCK_DOWN)) != ui::EF_ALT_DOWN; 1050 (flags & ~(ui::EF_SHIFT_DOWN | ui::EF_CAPS_LOCK_DOWN)) != ui::EF_ALT_DOWN;
1044 } 1051 }
1045 1052
1046 } // namespace views 1053 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698