}
virtual gfx::Point GetDialogPosition(const gfx::Size& size) OVERRIDE {
- views::View* view = browser_view_layout_->delegate_->GetContentsWebView();
+ views::View* view = browser_view_layout_->contents_container_;
gfx::Rect content_area = view->ConvertRectToWidget(view->GetLocalBounds());
const int middle_x = content_area.x() + content_area.width() / 2;
const int top = browser_view_layout_->web_contents_modal_dialog_top_y_;
}
virtual gfx::Size GetMaximumDialogSize() OVERRIDE {
- views::View* view = browser_view_layout_->delegate_->GetContentsWebView();
+ views::View* view = browser_view_layout_->contents_container_;
gfx::Rect content_area = view->ConvertRectToWidget(view->GetLocalBounds());
const int top = browser_view_layout_->web_contents_modal_dialog_top_y_;
return gfx::Size(content_area.width(), content_area.bottom() - top);
// In immersive fullscreen, the infobar always starts near the top of the
// screen, just under the "light bar" rectangular stripes.
if (immersive_mode_controller_->IsEnabled()) {
- top = immersive_mode_controller_->ShouldHideTabIndicators()
- ? browser_view_->y()
- : browser_view_->y() + TabStrip::GetImmersiveHeight();
+ top = browser_view_->y();
+ if (!immersive_mode_controller_->ShouldHideTabIndicators())
+ top += TabStrip::GetImmersiveHeight();
}
// Raise the |infobar_container_| by its vertical overlap.
infobar_container_->SetVisible(InfobarVisible());
}
void BrowserViewLayout::UpdateTopContainerBounds() {
- gfx::Rect top_container_bounds(top_container_->GetPreferredSize());
+ // Set the bounds of the top container view such that it is tall enough to
+ // fully show all of its children. In particular, the bottom of the bookmark
+ // bar can be above the bottom of the toolbar while the bookmark bar is
+ // animating. The top container view is positioned relative to the top of the
+ // client view instead of relative to GetTopInsetInBrowserView() because the
+ // top container view paints parts of the frame (title, window controls)
+ // during an immersive fullscreen reveal.
+ int height = 0;
+ for (int i = 0; i < top_container_->child_count(); ++i) {
+ views::View* child = top_container_->child_at(i);
+ if (!child->visible())
+ continue;
+ int child_bottom = child->bounds().bottom();
+ if (child_bottom > height)
+ height = child_bottom;
+ }
+
+ // Ensure that the top container view reaches the topmost view in the
+ // ClientView because the bounds of the top container view are used in
+ // layout and we assume that this is the case.
+ height = std::max(height, delegate_->GetTopInsetInBrowserView());
+
+ gfx::Rect top_container_bounds(vertical_layout_rect_.width(), height);
// If the immersive mode controller is animating the top container, it may be
- // partly offscreen. The top container is positioned relative to the top of
- // the client view instead of relative to GetTopInsetInBrowserView() because
- // the top container paints parts of the frame (title, window controls) during
- // an immersive reveal.
+ // partly offscreen.
top_container_bounds.set_y(
immersive_mode_controller_->GetTopContainerVerticalOffset(
top_container_bounds.size()));