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

Side by Side Diff: chrome/browser/ui/views/location_bar/location_bar_view.cc

Issue 516943003: Add textfield internal padding from FocusableBorder. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Shrink FocusableBorder; add Textfield and Combobox padding. Created 6 years, 3 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" 5 #include "chrome/browser/ui/views/location_bar/location_bar_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <map> 8 #include <map>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 646 matching lines...) Expand 10 before | Expand all | Expand 10 after
657 if (ShouldShowKeywordBubble()) { 657 if (ShouldShowKeywordBubble()) {
658 // The selected keyword view can collapse completely. 658 // The selected keyword view can collapse completely.
659 } else if (ShouldShowEVBubble()) { 659 } else if (ShouldShowEVBubble()) {
660 leading_width += kBubblePadding + 660 leading_width += kBubblePadding +
661 ev_bubble_view_->GetMinimumSizeForLabelText( 661 ev_bubble_view_->GetMinimumSizeForLabelText(
662 GetToolbarModel()->GetEVCertName()).width(); 662 GetToolbarModel()->GetEVCertName()).width();
663 } else if (!origin_chip_view_->visible()) { 663 } else if (!origin_chip_view_->visible()) {
664 leading_width += 664 leading_width +=
665 kItemPadding + location_icon_view_->GetMinimumSize().width(); 665 kItemPadding + location_icon_view_->GetMinimumSize().width();
666 } 666 }
667 leading_width += kItemPadding - GetEditLeadingInternalSpace(); 667 leading_width += GetEditLeadingInternalSpace();
Peter Kasting 2014/08/29 21:09:11 Hmm, I worry about this implicitly assuming that k
msw 2014/08/30 00:17:48 Done :-/ I also fixed the inversion of GetEditLead
668 668
669 // Compute width of omnibox-trailing content. 669 // Compute width of omnibox-trailing content.
670 int trailing_width = search_button_->visible() ? 670 int trailing_width = search_button_->visible() ?
671 (search_button_->GetMinimumSize().width() + kSearchButtonInset) : 671 (search_button_->GetMinimumSize().width() + kSearchButtonInset) :
672 horizontal_edge_thickness; 672 horizontal_edge_thickness;
673 trailing_width += IncrementalMinimumWidth(star_view_) + 673 trailing_width += IncrementalMinimumWidth(star_view_) +
674 IncrementalMinimumWidth(translate_icon_view_) + 674 IncrementalMinimumWidth(translate_icon_view_) +
675 IncrementalMinimumWidth(open_pdf_in_reader_view_) + 675 IncrementalMinimumWidth(open_pdf_in_reader_view_) +
676 IncrementalMinimumWidth(manage_passwords_icon_view_) + 676 IncrementalMinimumWidth(manage_passwords_icon_view_) +
677 IncrementalMinimumWidth(zoom_view_) + 677 IncrementalMinimumWidth(zoom_view_) +
678 IncrementalMinimumWidth(generated_credit_card_view_) + 678 IncrementalMinimumWidth(generated_credit_card_view_) +
679 IncrementalMinimumWidth(mic_search_view_) + 679 IncrementalMinimumWidth(mic_search_view_) +
680 IncrementalMinimumWidth(add_to_app_launcher_view_) + kItemPadding; 680 IncrementalMinimumWidth(add_to_app_launcher_view_);
681 for (PageActionViews::const_iterator i(page_action_views_.begin()); 681 for (PageActionViews::const_iterator i(page_action_views_.begin());
682 i != page_action_views_.end(); ++i) 682 i != page_action_views_.end(); ++i)
683 trailing_width += IncrementalMinimumWidth((*i)); 683 trailing_width += IncrementalMinimumWidth((*i));
684 for (ContentSettingViews::const_iterator i(content_setting_views_.begin()); 684 for (ContentSettingViews::const_iterator i(content_setting_views_.begin());
685 i != content_setting_views_.end(); ++i) 685 i != content_setting_views_.end(); ++i)
686 trailing_width += IncrementalMinimumWidth((*i)); 686 trailing_width += IncrementalMinimumWidth((*i));
687 687
688 min_size.set_width( 688 min_size.set_width(
689 leading_width + omnibox_view_->GetMinimumSize().width() + trailing_width); 689 leading_width + omnibox_view_->GetMinimumSize().width() + trailing_width);
690 return min_size; 690 return min_size;
691 } 691 }
692 692
693 void LocationBarView::Layout() { 693 void LocationBarView::Layout() {
694 if (!IsInitialized()) 694 if (!IsInitialized())
695 return; 695 return;
696 696
697 origin_chip_view_->SetVisible(GetToolbarModel()->ShouldShowOriginChip()); 697 origin_chip_view_->SetVisible(GetToolbarModel()->ShouldShowOriginChip());
698 selected_keyword_view_->SetVisible(false); 698 selected_keyword_view_->SetVisible(false);
699 location_icon_view_->SetVisible(false); 699 location_icon_view_->SetVisible(false);
700 ev_bubble_view_->SetVisible(false); 700 ev_bubble_view_->SetVisible(false);
701 keyword_hint_view_->SetVisible(false); 701 keyword_hint_view_->SetVisible(false);
702 702
703 LocationBarLayout leading_decorations( 703 LocationBarLayout leading_decorations(
704 LocationBarLayout::LEFT_EDGE, 704 LocationBarLayout::LEFT_EDGE, -GetEditLeadingInternalSpace());
705 kItemPadding - GetEditLeadingInternalSpace()); 705 LocationBarLayout trailing_decorations(LocationBarLayout::RIGHT_EDGE, 0);
706 LocationBarLayout trailing_decorations(LocationBarLayout::RIGHT_EDGE,
707 kItemPadding);
708 706
709 const int origin_chip_preferred_width = 707 const int origin_chip_preferred_width =
710 origin_chip_view_->GetPreferredSize().width(); 708 origin_chip_view_->GetPreferredSize().width();
711 const int origin_chip_width = 709 const int origin_chip_width =
712 origin_chip_view_->visible() ? origin_chip_preferred_width : 0; 710 origin_chip_view_->visible() ? origin_chip_preferred_width : 0;
713 // Always give the origin chip view its desired size and lay it out, even when 711 // Always give the origin chip view its desired size and lay it out, even when
714 // it's not visible, so we can calculate the correct animation values below 712 // it's not visible, so we can calculate the correct animation values below
715 // when switching to tabs that have the origin chip hidden. 713 // when switching to tabs that have the origin chip hidden.
716 origin_chip_view_->SetBounds(0, 0, origin_chip_preferred_width, height()); 714 origin_chip_view_->SetBounds(0, 0, origin_chip_preferred_width, height());
717 origin_chip_view_->Layout(); 715 origin_chip_view_->Layout();
(...skipping 1010 matching lines...) Expand 10 before | Expand all | Expand 10 after
1728 1726
1729 void LocationBarView::ModelChanged(const SearchModel::State& old_state, 1727 void LocationBarView::ModelChanged(const SearchModel::State& old_state,
1730 const SearchModel::State& new_state) { 1728 const SearchModel::State& new_state) {
1731 const bool visible = !GetToolbarModel()->input_in_progress() && 1729 const bool visible = !GetToolbarModel()->input_in_progress() &&
1732 new_state.voice_search_supported; 1730 new_state.voice_search_supported;
1733 if (mic_search_view_->visible() != visible) { 1731 if (mic_search_view_->visible() != visible) {
1734 mic_search_view_->SetVisible(visible); 1732 mic_search_view_->SetVisible(visible);
1735 Layout(); 1733 Layout();
1736 } 1734 }
1737 } 1735 }
OLDNEW
« no previous file with comments | « no previous file | ui/views/controls/combobox/combobox.cc » ('j') | ui/views/controls/combobox/combobox.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698