- return std::max(minimum_length_for_text,
- controller_common_.RoundedElementBounds().width());
+ int width = std::max(minimum_required_width,
+ controller_common_.RoundedElementBounds().width());
+
+ if (display_password_) {
+ // Make sure that the width will always be large enough to display the
+ // password and suggestion on one line.
+ width = std::max(width,
+ gfx::GetStringWidth(current_password_ + SuggestedText(),
+ font_list_) + 2 * kHorizontalPadding);
+ }
+
+ return width;