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..b170ff012ec92245d346f0cb8e5d92c5add0ffbe 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_); |
@@ -211,6 +212,7 @@ void ContentsContainer::MaybeStackOverlayAtTop() { |
RemoveChildView(shadow_view_.get()); |
removed_shadow = true; |
} |
+ // TODO(jamescook): This can be done more efficiently with ReorderChildView(). |
kuan
2013/04/15 18:49:36
i think not. when porting 1993 to windows, mad@ h
James Cook
2013/04/16 18:51:01
OK. Removed TODO.
|
RemoveChildView(overlay_); |
AddChildView(overlay_); |
if (removed_shadow) // Add back shadow view if it was removed. |
@@ -228,6 +230,15 @@ void ContentsContainer::SetActiveTopMargin(int margin) { |
InvalidateLayout(); |
} |
+void ContentsContainer::SetOverlayTopMargin(int margin) { |
+ if (overlay_top_margin_ == margin) |
+ return; |
+ overlay_top_margin_ = margin; |
+ // Make sure we layout next time around. We need this in case our bounds |
+ // haven't changed. |
+ InvalidateLayout(); |
+} |
+ |
gfx::Rect ContentsContainer::GetOverlayBounds() const { |
gfx::Point screen_loc; |
ConvertPointToScreen(this, &screen_loc); |
@@ -254,13 +265,13 @@ 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 overlay_height_pixels = |
+ OverlayHeightInPixels(height(), overlay_height_, overlay_height_units_); |
+ overlay_->SetBounds(0, overlay_top_margin_, width(), overlay_height_pixels); |
kuan
2013/04/15 18:49:36
so u have problem making the height like content_h
James Cook
2013/04/16 18:51:01
I thought that clamping the overlay size was causi
|
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) |
} |