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

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

Issue 2024003002: Add GetTextDirection to ui::TextInputClient API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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
« no previous file with comments | « ui/views/controls/textfield/textfield.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "ui/views/controls/textfield/textfield.h" 5 #include "ui/views/controls/textfield/textfield.h"
6 6
7 #include <string> 7 #include <string>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/trace_event/trace_event.h" 10 #include "base/trace_event/trace_event.h"
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after
356 } 356 }
357 357
358 void Textfield::InsertOrReplaceText(const base::string16& new_text) { 358 void Textfield::InsertOrReplaceText(const base::string16& new_text) {
359 if (new_text.empty()) 359 if (new_text.empty())
360 return; 360 return;
361 model_->InsertText(new_text); 361 model_->InsertText(new_text);
362 OnCaretBoundsChanged(); 362 OnCaretBoundsChanged();
363 SchedulePaint(); 363 SchedulePaint();
364 } 364 }
365 365
366 base::i18n::TextDirection Textfield::GetTextDirection() const {
367 return GetRenderText()->GetDisplayTextDirection();
368 }
369
370 base::string16 Textfield::GetSelectedText() const { 366 base::string16 Textfield::GetSelectedText() const {
371 return model_->GetSelectedText(); 367 return model_->GetSelectedText();
372 } 368 }
373 369
374 void Textfield::SelectAll(bool reversed) { 370 void Textfield::SelectAll(bool reversed) {
375 model_->SelectAll(reversed); 371 model_->SelectAll(reversed);
376 UpdateSelectionClipboard(); 372 UpdateSelectionClipboard();
377 UpdateAfterChange(false, true); 373 UpdateAfterChange(false, true);
378 } 374 }
379 375
(...skipping 1122 matching lines...) Expand 10 before | Expand all | Expand 10 after
1502 ui::TextInputType Textfield::GetTextInputType() const { 1498 ui::TextInputType Textfield::GetTextInputType() const {
1503 if (read_only() || !enabled()) 1499 if (read_only() || !enabled())
1504 return ui::TEXT_INPUT_TYPE_NONE; 1500 return ui::TEXT_INPUT_TYPE_NONE;
1505 return text_input_type_; 1501 return text_input_type_;
1506 } 1502 }
1507 1503
1508 ui::TextInputMode Textfield::GetTextInputMode() const { 1504 ui::TextInputMode Textfield::GetTextInputMode() const {
1509 return ui::TEXT_INPUT_MODE_DEFAULT; 1505 return ui::TEXT_INPUT_MODE_DEFAULT;
1510 } 1506 }
1511 1507
1508 base::i18n::TextDirection Textfield::GetTextDirection() const {
1509 return GetRenderText()->GetDisplayTextDirection();
1510 }
1511
1512 int Textfield::GetTextInputFlags() const { 1512 int Textfield::GetTextInputFlags() const {
1513 return text_input_flags_; 1513 return text_input_flags_;
1514 } 1514 }
1515 1515
1516 bool Textfield::CanComposeInline() const { 1516 bool Textfield::CanComposeInline() const {
1517 return true; 1517 return true;
1518 } 1518 }
1519 1519
1520 gfx::Rect Textfield::GetCaretBounds() const { 1520 gfx::Rect Textfield::GetCaretBounds() const {
1521 gfx::Rect rect = GetRenderText()->GetUpdatedCursorBounds(); 1521 gfx::Rect rect = GetRenderText()->GetUpdatedCursorBounds();
(...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after
1929 RequestFocus(); 1929 RequestFocus();
1930 model_->MoveCursorTo(mouse); 1930 model_->MoveCursorTo(mouse);
1931 if (!selection_clipboard_text.empty()) { 1931 if (!selection_clipboard_text.empty()) {
1932 model_->InsertText(selection_clipboard_text); 1932 model_->InsertText(selection_clipboard_text);
1933 UpdateAfterChange(true, true); 1933 UpdateAfterChange(true, true);
1934 } 1934 }
1935 OnAfterUserAction(); 1935 OnAfterUserAction();
1936 } 1936 }
1937 1937
1938 } // namespace views 1938 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/controls/textfield/textfield.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698