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

Unified Diff: chrome/browser/ui/views/frame/contents_container.cc

Issue 13974003: alternate ntp: fix content origin when overlay shrinks to shorter than top bars (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: addressed scott's comment Created 7 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/views/frame/contents_container.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/views/frame/contents_container.cc
diff --git a/chrome/browser/ui/views/frame/contents_container.cc b/chrome/browser/ui/views/frame/contents_container.cc
index d1b45f603673ec87f8bfc27597b4954fea43099d..4652bd355e312baece5aaada37861be8c5c8a59d 100644
--- a/chrome/browser/ui/views/frame/contents_container.cc
+++ b/chrome/browser/ui/views/frame/contents_container.cc
@@ -78,8 +78,10 @@ class ShadowView : public views::View {
} // namespace
-ContentsContainer::ContentsContainer(views::WebView* active)
+ContentsContainer::ContentsContainer(views::WebView* active,
+ views::View* browser_view)
: active_(active),
+ browser_view_(browser_view),
overlay_(NULL),
overlay_web_contents_(NULL),
draw_drop_shadow_(false),
@@ -169,6 +171,17 @@ void ContentsContainer::SetOverlay(views::WebView* overlay,
#endif // !defined(OS_WIN)
}
+ // If |overlay_|'s height has shrunk and |active_top_margin_| was used to
+ // preserve |active_|'s origin in BrowserViewLayout::Layout(), we need to re-
+ // determine if its origin still needs to be preserved. The origin is
+ // preserved if overlay is taller than total height of hidden bookmark and
+ // info bars. In this case, force a re-layout of BrowserView.
+ bool layout_browser_view = false;
+ if (overlay_ && active_top_margin_ > 0 && units == INSTANT_SIZE_PIXELS &&
+ height > 0 && height < overlay_height_) {
+ layout_browser_view = true;
+ }
+
overlay_height_ = height;
overlay_height_units_ = units;
draw_drop_shadow_ = draw_drop_shadow;
@@ -197,7 +210,10 @@ void ContentsContainer::SetOverlay(views::WebView* overlay,
shadow_view_.reset();
}
- Layout();
+ if (layout_browser_view)
+ browser_view_->Layout(); // This will trigger |this| Layout.
+ else
+ Layout();
}
void ContentsContainer::MaybeStackOverlayAtTop() {
« no previous file with comments | « chrome/browser/ui/views/frame/contents_container.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698