OLD | NEW |
---|---|
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/bookmarks/bookmark_bar_instructions_view.h" | 5 #include "chrome/browser/ui/views/bookmarks/bookmark_bar_instructions_view.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "chrome/browser/defaults.h" | 10 #include "chrome/browser/defaults.h" |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
62 | 62 |
63 gfx::Size BookmarkBarInstructionsView::GetPreferredSize() const { | 63 gfx::Size BookmarkBarInstructionsView::GetPreferredSize() const { |
64 int height = 0, width = 0; | 64 int height = 0, width = 0; |
65 for (int i = 0; i < child_count(); ++i) { | 65 for (int i = 0; i < child_count(); ++i) { |
66 const views::View* view = child_at(i); | 66 const views::View* view = child_at(i); |
67 gfx::Size pref = view->GetPreferredSize(); | 67 gfx::Size pref = view->GetPreferredSize(); |
68 height = std::max(pref.height(), height); | 68 height = std::max(pref.height(), height); |
69 width += pref.width(); | 69 width += pref.width(); |
70 } | 70 } |
71 width += (child_count() - 1) * GetViewPadding(); | 71 width += (child_count() - 1) * GetViewPadding(); |
72 height += GetInsets().height(); | |
sky
2016/08/08 20:10:40
If you're going to accommodate insets for the heig
kylix_rd
2016/08/10 14:53:51
Done.
| |
72 return gfx::Size(width, height); | 73 return gfx::Size(width, height); |
73 } | 74 } |
74 | 75 |
75 void BookmarkBarInstructionsView::Layout() { | 76 void BookmarkBarInstructionsView::Layout() { |
76 int remaining_width = width(); | 77 int remaining_width = width(); |
77 int x = 0; | 78 int x = 0; |
78 for (int i = 0; i < child_count(); ++i) { | 79 for (int i = 0; i < child_count(); ++i) { |
79 views::View* view = child_at(i); | 80 views::View* view = child_at(i); |
80 gfx::Size pref = view->GetPreferredSize(); | 81 gfx::Size pref = view->GetPreferredSize(); |
81 int view_width = std::min(remaining_width, pref.width()); | 82 int view_width = std::min(remaining_width, pref.width()); |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
138 // code (which only adjusts luminance) doesn't work well in this case. | 139 // code (which only adjusts luminance) doesn't work well in this case. |
139 SkColor bg = theme_provider->GetColor(ThemeProperties::COLOR_TOOLBAR); | 140 SkColor bg = theme_provider->GetColor(ThemeProperties::COLOR_TOOLBAR); |
140 SkColor link_color = | 141 SkColor link_color = |
141 GetNativeTheme()->GetSystemColor(ui::NativeTheme::kColorId_LinkEnabled); | 142 GetNativeTheme()->GetSystemColor(ui::NativeTheme::kColorId_LinkEnabled); |
142 bool link_has_contrast = color_utils::GetContrastRatio(link_color, bg) >= | 143 bool link_has_contrast = color_utils::GetContrastRatio(link_color, bg) >= |
143 color_utils::kMinimumReadableContrastRatio; | 144 color_utils::kMinimumReadableContrastRatio; |
144 import_link_->SetUnderline(!link_has_contrast); | 145 import_link_->SetUnderline(!link_has_contrast); |
145 import_link_->SetEnabledColor(link_has_contrast ? link_color : text_color); | 146 import_link_->SetEnabledColor(link_has_contrast ? link_color : text_color); |
146 } | 147 } |
147 } | 148 } |
OLD | NEW |