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

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

Issue 13684002: cros: Instant extended support for immersive fullscreen (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: added one test for immersive instant extended 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
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..7855fdbb353769ef4b2fc766b937c52e666e2961 100644
--- a/chrome/browser/ui/views/frame/contents_container.cc
+++ b/chrome/browser/ui/views/frame/contents_container.cc
@@ -84,6 +84,7 @@ ContentsContainer::ContentsContainer(views::WebView* active)
overlay_web_contents_(NULL),
draw_drop_shadow_(false),
active_top_margin_(0),
+ overlay_top_margin_(0),
overlay_height_(100),
overlay_height_units_(INSTANT_SIZE_PERCENT) {
AddChildView(active_);
@@ -218,14 +219,25 @@ void ContentsContainer::MaybeStackOverlayAtTop() {
Layout();
}
-void ContentsContainer::SetActiveTopMargin(int margin) {
+bool ContentsContainer::SetActiveTopMargin(int margin) {
if (active_top_margin_ == margin)
- return;
+ return false;
active_top_margin_ = margin;
// Make sure we layout next time around. We need this in case our bounds
// haven't changed.
InvalidateLayout();
+ return true;
+}
+
+bool ContentsContainer::SetOverlayTopMargin(int margin) {
+ if (overlay_top_margin_ == margin)
+ return false;
+ overlay_top_margin_ = margin;
+ // Make sure we layout next time around. We need this in case our bounds
+ // haven't changed.
+ InvalidateLayout();
+ return true;
}
gfx::Rect ContentsContainer::GetOverlayBounds() const {
@@ -254,13 +266,16 @@ void ContentsContainer::Layout() {
active_->SetBounds(0, content_y, width(), content_height);
if (overlay_) {
- overlay_->SetBounds(0, 0, width(),
- OverlayHeightInPixels(height(), overlay_height_,
- overlay_height_units_));
+ int target_overlay_height =
+ OverlayHeightInPixels(height(), overlay_height_, overlay_height_units_);
+ // Ensure the overlay doesn't extend outside this container view.
+ int overlay_height =
+ std::min(height() - overlay_top_margin_, target_overlay_height);
kuan 2013/04/17 13:30:26 i think u need to "std::max(0, overlay_height)" in
James Cook 2013/04/17 17:22:58 Good catch. Done.
+ overlay_->SetBounds(0, overlay_top_margin_, width(), overlay_height);
if (draw_drop_shadow_) {
#if !defined(OS_WIN)
DCHECK(shadow_view_.get() && shadow_view_->parent());
- shadow_view_->SetBounds(0, overlay_->bounds().height(), width(),
+ shadow_view_->SetBounds(0, overlay_->bounds().bottom(), width(),
shadow_view_->GetPreferredSize().height());
#endif // !defined(OS_WIN)
}

Powered by Google App Engine
This is Rietveld 408576698