summaryrefslogtreecommitdiffstats
path: root/ui/views/controls
diff options
context:
space:
mode:
authorshishir@chromium.org <shishir@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-10-20 02:36:22 +0000
committershishir@chromium.org <shishir@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-10-20 02:36:22 +0000
commita75e758412358e9ec1ad1744e1be7263c0d4590b (patch)
tree6eecff701a5e510eb42b80630452462b60c44b51 /ui/views/controls
parent92227599fd145fa9dd1eaaa574d39915316cf9b9 (diff)
downloadchromium_src-a75e758412358e9ec1ad1744e1be7263c0d4590b.zip
chromium_src-a75e758412358e9ec1ad1744e1be7263c0d4590b.tar.gz
chromium_src-a75e758412358e9ec1ad1744e1be7263c0d4590b.tar.bz2
ChromeOS: Commit the suggested text in omnibox correctly for RTL languages.
Note that the ChromeOS omnibox currently does not handle RTL suggested text display correctly. This change will also work when that is fixed. BUG=155356 Review URL: https://chromiumcodereview.appspot.com/11239002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@163132 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/views/controls')
-rw-r--r--ui/views/controls/textfield/native_textfield_views.cc4
-rw-r--r--ui/views/controls/textfield/native_textfield_views.h1
-rw-r--r--ui/views/controls/textfield/native_textfield_win.cc5
-rw-r--r--ui/views/controls/textfield/native_textfield_win.h1
-rw-r--r--ui/views/controls/textfield/native_textfield_wrapper.h4
-rw-r--r--ui/views/controls/textfield/textfield.cc5
-rw-r--r--ui/views/controls/textfield/textfield.h3
7 files changed, 23 insertions, 0 deletions
diff --git a/ui/views/controls/textfield/native_textfield_views.cc b/ui/views/controls/textfield/native_textfield_views.cc
index 49d4b8c..bbecc17 100644
--- a/ui/views/controls/textfield/native_textfield_views.cc
+++ b/ui/views/controls/textfield/native_textfield_views.cc
@@ -371,6 +371,10 @@ void NativeTextfieldViews::AppendText(const string16& text) {
SchedulePaint();
}
+base::i18n::TextDirection NativeTextfieldViews::GetTextDirection() const {
+ return GetRenderText()->GetTextDirection();
+}
+
string16 NativeTextfieldViews::GetSelectedText() const {
return model_->GetSelectedText();
}
diff --git a/ui/views/controls/textfield/native_textfield_views.h b/ui/views/controls/textfield/native_textfield_views.h
index caf9271..ce525a7 100644
--- a/ui/views/controls/textfield/native_textfield_views.h
+++ b/ui/views/controls/textfield/native_textfield_views.h
@@ -93,6 +93,7 @@ class VIEWS_EXPORT NativeTextfieldViews : public TouchSelectionClientView,
virtual string16 GetText() const OVERRIDE;
virtual void UpdateText() OVERRIDE;
virtual void AppendText(const string16& text) OVERRIDE;
+ virtual base::i18n::TextDirection GetTextDirection() const OVERRIDE;
virtual string16 GetSelectedText() const OVERRIDE;
virtual void SelectAll(bool reversed) OVERRIDE;
virtual void ClearSelection() OVERRIDE;
diff --git a/ui/views/controls/textfield/native_textfield_win.cc b/ui/views/controls/textfield/native_textfield_win.cc
index d5277d9..aaec604 100644
--- a/ui/views/controls/textfield/native_textfield_win.cc
+++ b/ui/views/controls/textfield/native_textfield_win.cc
@@ -213,6 +213,11 @@ void NativeTextfieldWin::AppendText(const string16& text) {
reinterpret_cast<LPARAM>(text.c_str()));
}
+base::i18n::TextDirection NativeTextfieldWin::GetTextDirection() const {
+ NOTIMPLEMENTED();
+ return base::i18n::UNKNOWN_DIRECTION;
+}
+
string16 NativeTextfieldWin::GetSelectedText() const {
CHARRANGE sel;
GetSel(sel);
diff --git a/ui/views/controls/textfield/native_textfield_win.h b/ui/views/controls/textfield/native_textfield_win.h
index 513fa52..939786f 100644
--- a/ui/views/controls/textfield/native_textfield_win.h
+++ b/ui/views/controls/textfield/native_textfield_win.h
@@ -68,6 +68,7 @@ class NativeTextfieldWin
virtual string16 GetText() const OVERRIDE;
virtual void UpdateText() OVERRIDE;
virtual void AppendText(const string16& text) OVERRIDE;
+ virtual base::i18n::TextDirection GetTextDirection() const OVERRIDE;
virtual string16 GetSelectedText() const OVERRIDE;
virtual void SelectAll(bool reversed) OVERRIDE;
virtual void ClearSelection() OVERRIDE;
diff --git a/ui/views/controls/textfield/native_textfield_wrapper.h b/ui/views/controls/textfield/native_textfield_wrapper.h
index 70e090d..61b6382 100644
--- a/ui/views/controls/textfield/native_textfield_wrapper.h
+++ b/ui/views/controls/textfield/native_textfield_wrapper.h
@@ -6,6 +6,7 @@
#define UI_VIEWS_CONTROLS_TEXTFIELD_NATIVE_TEXTFIELD_WRAPPER_H_
#include "base/string16.h"
+#include "base/i18n/rtl.h"
#include "ui/gfx/native_widget_types.h"
#include "ui/views/views_export.h"
@@ -44,6 +45,9 @@ class VIEWS_EXPORT NativeTextfieldWrapper {
// text field.
virtual void AppendText(const string16& text) = 0;
+ // Returns the text direction.
+ virtual base::i18n::TextDirection GetTextDirection() const = 0;
+
// Gets the text that is selected in the wrapped native text field.
virtual string16 GetSelectedText() const = 0;
diff --git a/ui/views/controls/textfield/textfield.cc b/ui/views/controls/textfield/textfield.cc
index 25fc4c7..a0e6abb 100644
--- a/ui/views/controls/textfield/textfield.cc
+++ b/ui/views/controls/textfield/textfield.cc
@@ -160,6 +160,11 @@ void Textfield::AppendText(const string16& text) {
native_wrapper_->AppendText(text);
}
+base::i18n::TextDirection Textfield::GetTextDirection() const {
+ return native_wrapper_ ? native_wrapper_->GetTextDirection() :
+ base::i18n::UNKNOWN_DIRECTION;
+}
+
void Textfield::SelectAll(bool reversed) {
if (native_wrapper_)
native_wrapper_->SelectAll(reversed);
diff --git a/ui/views/controls/textfield/textfield.h b/ui/views/controls/textfield/textfield.h
index ac273fe..2a4fe31 100644
--- a/ui/views/controls/textfield/textfield.h
+++ b/ui/views/controls/textfield/textfield.h
@@ -81,6 +81,9 @@ class VIEWS_EXPORT Textfield : public View {
// Appends the given string to the previously-existing text in the field.
void AppendText(const string16& text);
+ // Returns the text direction.
+ base::i18n::TextDirection GetTextDirection() const;
+
// Returns the text that is currently selected.
string16 GetSelectedText() const;