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

Unified Diff: chrome/browser/ui/views/omnibox/omnibox_view_views.cc

Issue 10412009: Enable disabled omnibox tests on aura (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sync Created 8 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/views/omnibox/omnibox_view_views.cc
diff --git a/chrome/browser/ui/views/omnibox/omnibox_view_views.cc b/chrome/browser/ui/views/omnibox/omnibox_view_views.cc
index fec59621baee963a1339932eb842b85d2468406d..46c09cad26be7b7fb86eeb63aa95f06166323b02 100644
--- a/chrome/browser/ui/views/omnibox/omnibox_view_views.cc
+++ b/chrome/browser/ui/views/omnibox/omnibox_view_views.cc
@@ -531,8 +531,15 @@ void OmniboxViewViews::GetSelectionBounds(string16::size_type* start,
string16::size_type* end) const {
ui::Range range;
textfield_->GetSelectedRange(&range);
- *start = static_cast<size_t>(range.end());
- *end = static_cast<size_t>(range.start());
+ if (range.is_empty()) {
+ // Omnibox API expects that selection bounds is at cursor position
+ // if there is no selection.
+ *start = textfield_->GetCursorPosition();
+ *end = textfield_->GetCursorPosition();
+ } else {
+ *start = static_cast<size_t>(range.end());
+ *end = static_cast<size_t>(range.start());
+ }
}
void OmniboxViewViews::SelectAll(bool reversed) {
« no previous file with comments | « chrome/browser/ui/omnibox/omnibox_view_browsertest.cc ('k') | ui/views/controls/textfield/native_textfield_views.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698