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

Unified Diff: chrome/browser/ui/views/location_bar/location_bar_view.cc

Issue 2713253002: Adjust ellision strategy for omnibox search chip. (Closed)
Patch Set: Created 3 years, 10 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/location_bar/location_bar_view.cc
diff --git a/chrome/browser/ui/views/location_bar/location_bar_view.cc b/chrome/browser/ui/views/location_bar/location_bar_view.cc
index a2cbbbe733709e5a2f77e9139b2991e360eebf81..50317ca1af0a1da16999ec1ce76d99e19006fbd3 100644
--- a/chrome/browser/ui/views/location_bar/location_bar_view.cc
+++ b/chrome/browser/ui/views/location_bar/location_bar_view.cc
@@ -575,14 +575,14 @@ void LocationBarView::Layout() {
leading_decorations.LayoutPass2(&entry_width);
trailing_decorations.LayoutPass2(&entry_width);
- int location_needed_width = omnibox_view_->GetTextWidth();
- int available_width = entry_width - location_needed_width;
+ int location_desired_width = omnibox_view_->GetTextWidth();
+ int available_width = entry_width - location_desired_width;
// The bounds must be wide enough for all the decorations to fit.
gfx::Rect location_bounds(edge_thickness, vertical_padding,
std::max(full_width, full_width - entry_width),
location_height);
- leading_decorations.LayoutPass3(&location_bounds, &available_width);
- trailing_decorations.LayoutPass3(&location_bounds, &available_width);
+ leading_decorations.LayoutPass3(&location_bounds, &available_width, false);
+ trailing_decorations.LayoutPass3(&location_bounds, &available_width, true);
// Layout |ime_inline_autocomplete_view_| next to the user input.
if (ime_inline_autocomplete_view_->visible()) {
@@ -592,10 +592,10 @@ void LocationBarView::Layout() {
ime_inline_autocomplete_view_->GetInsets().width();
// All the target languages (IMEs) are LTR, and we do not need to support
// RTL so far. In other words, no testable RTL environment so far.
- int x = location_needed_width;
+ int x = location_desired_width;
if (width > entry_width)
x = 0;
- else if (location_needed_width + width > entry_width)
+ else if (location_desired_width + width > entry_width)
x = entry_width - width;
location_bounds.set_width(x);
ime_inline_autocomplete_view_->SetBounds(
@@ -605,6 +605,14 @@ void LocationBarView::Layout() {
omnibox_view_->SetBoundsRect(location_bounds);
}
+bool LocationBarView::OnMousePressed(const ui::MouseEvent& event) {
+ return static_cast<views::View*>(omnibox_view_)->OnMousePressed(event);
Peter Kasting 2017/02/25 06:17:11 I don't like forwarding these. It seems strange g
Evan Stade 2017/03/07 18:10:22 well the location icon is usually a security indic
+}
+
+void LocationBarView::OnMouseReleased(const ui::MouseEvent& event) {
+ static_cast<views::View*>(omnibox_view_)->OnMouseReleased(event);
+}
+
void LocationBarView::OnNativeThemeChanged(const ui::NativeTheme* theme) {
RefreshLocationIcon();
if (is_popup_mode_) {

Powered by Google App Engine
This is Rietveld 408576698