| Index: chrome/browser/ui/views/infobars/infobar_container.cc
|
| diff --git a/chrome/browser/ui/views/infobars/infobar_container.cc b/chrome/browser/ui/views/infobars/infobar_container.cc
|
| index d8a1c728e2fdfed109b8454095633f299bcb3ba2..60e0e3aef1abf706c835c8b7c9c6fa0a56b31d94 100644
|
| --- a/chrome/browser/ui/views/infobars/infobar_container.cc
|
| +++ b/chrome/browser/ui/views/infobars/infobar_container.cc
|
| @@ -33,6 +33,18 @@ InfoBarContainer::~InfoBarContainer() {
|
| ChangeTabContents(NULL);
|
| }
|
|
|
| +InfoBarContainer::Heights InfoBarContainer::GetHeights() const {
|
| + int offset = 0;
|
| + int bar_height = 0;
|
| + for (int i = 0; i < child_count(); ++i) {
|
| + const InfoBarView* infobar =
|
| + static_cast<const InfoBarView*>(GetChildViewAt(i));
|
| + offset = std::min(offset, bar_height - infobar->preferred_tab_height());
|
| + bar_height += infobar->preferred_bar_height();
|
| + }
|
| + return Heights(-offset, bar_height);
|
| +}
|
| +
|
| void InfoBarContainer::ChangeTabContents(TabContents* contents) {
|
| registrar_.RemoveAll();
|
|
|
| @@ -80,32 +92,28 @@ void InfoBarContainer::RemoveInfoBar(InfoBarView* infobar) {
|
| infobars_.erase(infobar);
|
| }
|
|
|
| -void InfoBarContainer::PaintInfoBarArrows(gfx::Canvas* canvas,
|
| - View* outer_view,
|
| - int arrow_center_x) {
|
| - for (int i = 0; i < child_count(); ++i) {
|
| - InfoBarView* infobar = static_cast<InfoBarView*>(GetChildViewAt(i));
|
| - infobar->PaintArrow(canvas, outer_view, arrow_center_x);
|
| - }
|
| -}
|
| -
|
| gfx::Size InfoBarContainer::GetPreferredSize() {
|
| - // We do not have a preferred width (we will expand to fit the available width
|
| - // of the delegate). Our preferred height is the sum of the preferred heights
|
| - // of the InfoBars contained within us.
|
| - int height = 0;
|
| - for (int i = 0; i < child_count(); ++i)
|
| - height += GetChildViewAt(i)->GetPreferredSize().height();
|
| - return gfx::Size(0, height);
|
| + // We do not have a preferred width (we will expand to fit the
|
| + // available width of the delegate). Our preferred height is the sum
|
| + // of the preferred heights of the InfoBars contained within us and
|
| + // the tab_height.
|
| + return gfx::Size(0, GetHeights().height());
|
| }
|
|
|
| void InfoBarContainer::Layout() {
|
| - int top = 0;
|
| + // Because multiple infobars may be animating, the tab of a
|
| + // vertically lower bar may be "higher". Get the overall heights of
|
| + // this InfoBarContainer before laying out.
|
| + Heights heights = GetHeights();
|
| +
|
| + int top = heights.tab_height();
|
| for (int i = 0; i < child_count(); ++i) {
|
| View* child = GetChildViewAt(i);
|
| + InfoBarView* infobar = static_cast<InfoBarView*>(child);
|
| gfx::Size ps = child->GetPreferredSize();
|
| - child->SetBounds(0, top, width(), ps.height());
|
| - top += ps.height();
|
| + child->SetBounds(0, top - infobar->preferred_tab_height(),
|
| + width(), ps.height());
|
| + top += infobar->preferred_bar_height();
|
| }
|
| }
|
|
|
|
|