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

Unified Diff: chrome/browser/ui/views/location_bar/location_bar_layout.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_layout.cc
diff --git a/chrome/browser/ui/views/location_bar/location_bar_layout.cc b/chrome/browser/ui/views/location_bar/location_bar_layout.cc
index d28201821314512c0194701164f07fbcd4dfdd36..c04bf3af637899613f798c9711994f8cd68376c6 100644
--- a/chrome/browser/ui/views/location_bar/location_bar_layout.cc
+++ b/chrome/browser/ui/views/location_bar/location_bar_layout.cc
@@ -128,18 +128,23 @@ void LocationBarLayout::LayoutPass2(int *entry_width) {
}
}
-void LocationBarLayout::LayoutPass3(gfx::Rect* bounds, int* available_width) {
+void LocationBarLayout::LayoutPass3(gfx::Rect* bounds,
+ int* available_width,
+ bool allow_collapse) {
bool first_visible = true;
for (const auto& decoration : decorations_) {
// Collapse decorations if needed.
if (decoration->auto_collapse) {
int padding = (first_visible ? decoration->edge_item_padding
: decoration->item_padding);
- // Try preferred size, if it fails try minimum size, if it fails collapse.
+ // Try preferred size and if it fails try minimum size.
decoration->computed_width = decoration->view->GetPreferredSize().width();
if (decoration->computed_width + padding > *available_width)
decoration->computed_width = decoration->view->GetMinimumSize().width();
- if (decoration->computed_width + padding > *available_width) {
+ // If there's insufficient room for the minimum size of the decoration and
+ // we are allowed to collapse, hide the decoration.
+ if (allow_collapse &&
+ decoration->computed_width + padding > *available_width) {
decoration->computed_width = 0;
decoration->view->SetVisible(false);
} else {

Powered by Google App Engine
This is Rietveld 408576698