Commit 8e34fa1d authored by msw@chromium.org's avatar msw@chromium.org

Only compute LocationBarView::AvailableWidth as needed.

NOTE: THIS IS NOT A CRASH FIX!!! It's only an adjustment to reduce unnecessary work in potentially crashy code paths :-/

BUG=141702
TEST=no location bar layout regressions; fewer crashes?


Review URL: https://chromiumcodereview.appspot.com/10831253

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@151118 0039d316-1c4b-4281-b951-d872f2087c98
parent ee0e5804
......@@ -695,10 +695,9 @@ void LocationBarView::Layout() {
entry_width -= (total_padding + ev_bubble_width);
}
int max_edit_width = location_entry_->GetMaxEditWidth(entry_width);
const int max_edit_width = location_entry_->GetMaxEditWidth(entry_width);
if (max_edit_width < 0)
return;
const int available_width = AvailableWidth(max_edit_width);
const bool show_keyword_hint = !keyword.empty() && is_keyword_hint;
selected_keyword_view_->SetVisible(show_selected_keyword);
......@@ -814,8 +813,8 @@ void LocationBarView::Layout() {
if (show_selected_keyword) {
selected_keyword_view_->SetBounds(0, location_y + kBubbleVerticalPadding,
0, selected_keyword_view_->GetPreferredSize().height());
LayoutView(selected_keyword_view_, kItemEditPadding, available_width,
true, &location_bounds);
LayoutView(selected_keyword_view_, kItemEditPadding,
AvailableWidth(max_edit_width), true, &location_bounds);
location_bounds.set_x(selected_keyword_view_->visible() ?
(offset + selected_keyword_view_->width() + kItemEditPadding) :
(kEdgeThickness + kEdgeEditPadding));
......@@ -826,8 +825,8 @@ void LocationBarView::Layout() {
// its left. So we undo the enlargement, then include it in the padding for
// the added view.
location_bounds.Inset(0, 0, kEditInternalSpace, 0);
LayoutView(keyword_hint_view_, kItemEditPadding, available_width, false,
&location_bounds);
LayoutView(keyword_hint_view_, kItemEditPadding,
AvailableWidth(max_edit_width), false, &location_bounds);
if (!keyword_hint_view_->visible()) {
// Put back the enlargement that we undid above.
location_bounds.Inset(0, 0, -kEditInternalSpace, 0);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment