Commit f6cd0d23 authored by mad@chromium.org's avatar mad@chromium.org

Stack preview back at top after an active contents switch.

BUG=161233

Review URL: https://codereview.chromium.org/11428083

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@170973 0039d316-1c4b-4281-b951-d872f2087c98
parent 3cd61655
...@@ -1661,15 +1661,7 @@ void BrowserView::ActiveTabChanged(content::WebContents* old_contents, ...@@ -1661,15 +1661,7 @@ void BrowserView::ActiveTabChanged(content::WebContents* old_contents,
if (change_tab_contents) { if (change_tab_contents) {
contents_container_->SetWebContents(new_contents); contents_container_->SetWebContents(new_contents);
#if defined(USE_AURA) contents_->MaybeStackPreviewAtTop();
// Put the Instant preview back on top in case it is showing custom new tab
// page content.
if (contents_->preview_web_contents()) {
ui::Layer* preview_layer =
contents_->preview_web_contents()->GetNativeView()->layer();
preview_layer->parent()->StackAtTop(preview_layer);
}
#endif
} }
if (!browser_->tab_strip_model()->closing_all() && GetWidget()->IsActive() && if (!browser_->tab_strip_model()->closing_all() && GetWidget()->IsActive() &&
......
...@@ -54,6 +54,14 @@ void ContentsContainer::SetPreview(views::WebView* preview, ...@@ -54,6 +54,14 @@ void ContentsContainer::SetPreview(views::WebView* preview,
Layout(); Layout();
} }
void ContentsContainer::MaybeStackPreviewAtTop() {
if (preview_) {
RemoveChildView(preview_);
AddChildView(preview_);
Layout();
}
}
void ContentsContainer::SetActiveTopMargin(int margin) { void ContentsContainer::SetActiveTopMargin(int margin) {
if (active_top_margin_ == margin) if (active_top_margin_ == margin)
return; return;
......
...@@ -45,6 +45,10 @@ class ContentsContainer : public views::View { ...@@ -45,6 +45,10 @@ class ContentsContainer : public views::View {
int height, int height,
InstantSizeUnits units); InstantSizeUnits units);
// When the active content is reset and we have a visible preview,
// the preview must be stacked back at top.
void MaybeStackPreviewAtTop();
content::WebContents* preview_web_contents() const { content::WebContents* preview_web_contents() const {
return preview_web_contents_; return preview_web_contents_;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment