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

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: . 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 7aa4893269ee952fa42c2712cf1534eb5ba945c6..bbe0828b60beca2661e3e0da4a7970e4d97feeef 100644
--- a/chrome/browser/ui/views/omnibox/omnibox_view_views.cc
+++ b/chrome/browser/ui/views/omnibox/omnibox_view_views.cc
@@ -507,8 +507,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) {

Powered by Google App Engine
This is Rietveld 408576698