Index: chrome/browser/ui/omnibox/omnibox_edit_model.cc |
diff --git a/chrome/browser/ui/omnibox/omnibox_edit_model.cc b/chrome/browser/ui/omnibox/omnibox_edit_model.cc |
index 02eb0f1102c50386d8ad588f590a9878967eb2f1..566b75215642955d1a5549d33c37aaeabd31b1dd 100644 |
--- a/chrome/browser/ui/omnibox/omnibox_edit_model.cc |
+++ b/chrome/browser/ui/omnibox/omnibox_edit_model.cc |
@@ -7,6 +7,7 @@ |
#include <string> |
#include "base/format_macros.h" |
+#include "base/i18n/rtl.h" |
#include "base/metrics/histogram.h" |
#include "base/string_util.h" |
#include "base/stringprintf.h" |
@@ -998,9 +999,24 @@ bool OmniboxEditModel::OnAfterPossibleChange(const string16& old_text, |
MaybeAcceptKeywordBySpace(user_text_)); |
} |
-void OmniboxEditModel::PopupBoundsChangedTo(const gfx::Rect& bounds) { |
+void OmniboxEditModel::OnPopupBoundsChanged(const gfx::Rect& bounds) { |
if (InstantController* instant = controller_->GetInstant()) |
- instant->SetOmniboxBounds(bounds); |
+ instant->SetPopupBounds(bounds); |
+} |
+ |
+void OmniboxEditModel::OnOmniboxBoundsChanged(const gfx::Rect& omnibox_bounds, |
+ const gfx::Rect& parent_bounds) { |
+ if (InstantController* instant = controller_->GetInstant()) { |
+ int start = omnibox_bounds.x(); |
+ int end = parent_bounds.x() + parent_bounds.width() - |
+ omnibox_bounds.width() - start; |
+ if (base::i18n::IsRTL()) { |
+ int tmp = start; |
dhollowa
2012/11/28 16:44:08
std::swap(start, end)
melevin
2012/11/28 20:28:19
I've always been conflicted about this function. I
dhollowa
2012/11/28 20:44:33
Yes. It expresses intent clearly and adds to read
|
+ start = end; |
+ end = tmp; |
+ } |
+ instant->SetMarginSize(start, end); |
+ } |
} |
void OmniboxEditModel::OnResultChanged(bool default_match_changed) { |
@@ -1037,14 +1053,14 @@ void OmniboxEditModel::OnResultChanged(bool default_match_changed) { |
} |
if (popup_->IsOpen()) { |
- PopupBoundsChangedTo(popup_->view()->GetTargetBounds()); |
+ OnPopupBoundsChanged(popup_->view()->GetTargetBounds()); |
} else if (was_open) { |
// Accepts the temporary text as the user text, because it makes little |
// sense to have temporary text when the popup is closed. |
InternalSetUserText(UserTextFromDisplayText(view_->GetText())); |
has_temporary_text_ = false; |
is_temporary_text_set_by_instant_ = false; |
- PopupBoundsChangedTo(gfx::Rect()); |
+ OnPopupBoundsChanged(gfx::Rect()); |
NotifySearchTabHelper(); |
} |