Commit 35a3aaac authored by sky@chromium.org's avatar sky@chromium.org

Fixes regression where showing bookmark bar (or download shelf)

wouldn't do a final layout resulting in the content not laying out
correctly.

BUG=104082
TEST=none
R=ben@chromium.org


Review URL: http://codereview.chromium.org/8573029

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@110320 0039d316-1c4b-4281-b951-d872f2087c98
parent 26109852
// Copyright (c) 2009 The Chromium Authors. All rights reserved.
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
......@@ -30,6 +30,10 @@ class NativeTabContentsContainer {
// Tells the container to update less frequently during resizing operations
// so performance is better.
virtual void SetFastResize(bool fast_resize) = 0;
virtual bool GetFastResize() const = 0;
// Returns the value of GetFastResize() the last time layout occurred.
virtual bool FastResizeAtLastLayout() const = 0;
// Tells the container that the RenderViewHost for the attached TabContents
// has changed and it should update focus.
......@@ -41,6 +45,7 @@ class NativeTabContentsContainer {
// Retrieves the views::View that hosts the TabContents.
virtual views::View* GetView() = 0;
protected:
virtual ~NativeTabContentsContainer() {}
};
......
......@@ -48,7 +48,15 @@ void NativeTabContentsContainerAura::DetachContents(TabContents* contents) {
}
void NativeTabContentsContainerAura::SetFastResize(bool fast_resize) {
NOTIMPLEMENTED();
set_fast_resize(fast_resize);
}
bool NativeTabContentsContainerAura::GetFastResize() const {
return fast_resize();
}
bool NativeTabContentsContainerAura::FastResizeAtLastLayout() const {
return fast_resize_at_last_layout();
}
void NativeTabContentsContainerAura::RenderViewHostChanged(
......
......@@ -19,6 +19,8 @@ class NativeTabContentsContainerAura : public NativeTabContentsContainer,
virtual void AttachContents(TabContents* contents) OVERRIDE;
virtual void DetachContents(TabContents* contents) OVERRIDE;
virtual void SetFastResize(bool fast_resize) OVERRIDE;
virtual bool GetFastResize() const OVERRIDE;
virtual bool FastResizeAtLastLayout() const OVERRIDE;
virtual void RenderViewHostChanged(RenderViewHost* old_host,
RenderViewHost* new_host) OVERRIDE;
virtual void TabContentsFocused(TabContents* tab_contents) OVERRIDE;
......
......@@ -47,6 +47,14 @@ void NativeTabContentsContainerGtk::SetFastResize(bool fast_resize) {
set_fast_resize(fast_resize);
}
bool NativeTabContentsContainerGtk::GetFastResize() const {
return fast_resize();
}
bool NativeTabContentsContainerGtk::FastResizeAtLastLayout() const {
return fast_resize_at_last_layout();
}
void NativeTabContentsContainerGtk::RenderViewHostChanged(
RenderViewHost* old_host,
RenderViewHost* new_host) {
......
......@@ -21,6 +21,8 @@ class NativeTabContentsContainerGtk : public NativeTabContentsContainer,
virtual void AttachContents(TabContents* contents) OVERRIDE;
virtual void DetachContents(TabContents* contents) OVERRIDE;
virtual void SetFastResize(bool fast_resize) OVERRIDE;
virtual bool GetFastResize() const OVERRIDE;
virtual bool FastResizeAtLastLayout() const OVERRIDE;
virtual void RenderViewHostChanged(RenderViewHost* old_host,
RenderViewHost* new_host) OVERRIDE;
virtual void TabContentsFocused(TabContents* tab_contents) OVERRIDE;
......
......@@ -53,6 +53,14 @@ void NativeTabContentsContainerViews::DetachContents(TabContents* contents) {
void NativeTabContentsContainerViews::SetFastResize(bool fast_resize) {
}
bool NativeTabContentsContainerViews::GetFastResize() const {
return false;
}
bool NativeTabContentsContainerViews::FastResizeAtLastLayout() const {
return false;
}
void NativeTabContentsContainerViews::RenderViewHostChanged(
RenderViewHost* old_host,
RenderViewHost* new_host) {
......
......@@ -19,6 +19,8 @@ class NativeTabContentsContainerViews : public NativeTabContentsContainer,
virtual void AttachContents(TabContents* contents) OVERRIDE;
virtual void DetachContents(TabContents* contents) OVERRIDE;
virtual void SetFastResize(bool fast_resize) OVERRIDE;
virtual bool GetFastResize() const OVERRIDE;
virtual bool FastResizeAtLastLayout() const OVERRIDE;
virtual void RenderViewHostChanged(RenderViewHost* old_host,
RenderViewHost* new_host) OVERRIDE;
virtual void TabContentsFocused(TabContents* tab_contents) OVERRIDE;
......
......@@ -62,6 +62,14 @@ void NativeTabContentsContainerWin::SetFastResize(bool fast_resize) {
set_fast_resize(fast_resize);
}
bool NativeTabContentsContainerWin::GetFastResize() const {
return fast_resize();
}
bool NativeTabContentsContainerWin::FastResizeAtLastLayout() const {
return fast_resize_at_last_layout();
}
void NativeTabContentsContainerWin::RenderViewHostChanged(
RenderViewHost* old_host,
RenderViewHost* new_host) {
......
......@@ -19,6 +19,8 @@ class NativeTabContentsContainerWin : public NativeTabContentsContainer,
virtual void AttachContents(TabContents* contents) OVERRIDE;
virtual void DetachContents(TabContents* contents) OVERRIDE;
virtual void SetFastResize(bool fast_resize) OVERRIDE;
virtual bool GetFastResize() const OVERRIDE;
virtual bool FastResizeAtLastLayout() const OVERRIDE;
virtual void RenderViewHostChanged(RenderViewHost* old_host,
RenderViewHost* new_host) OVERRIDE;
virtual void TabContentsFocused(TabContents* tab_contents) OVERRIDE;
......
......@@ -85,8 +85,17 @@ void TabContentsContainer::Observe(
// TabContentsContainer, View overrides:
void TabContentsContainer::Layout() {
if (native_container_)
if (native_container_) {
gfx::Size view_size(native_container_->GetView()->size());
native_container_->GetView()->SetBounds(0, 0, width(), height());
// SetBounds does nothing if the bounds haven't changed. We need to force
// layout if the bounds haven't changed, but fast resize has.
if (view_size.width() == width() && view_size.height() == height() &&
native_container_->FastResizeAtLastLayout() &&
!native_container_->GetFastResize()) {
native_container_->GetView()->Layout();
}
}
}
void TabContentsContainer::GetAccessibleState(ui::AccessibleViewState* state) {
......
......@@ -31,6 +31,7 @@ NativeViewHost::NativeViewHost()
: native_view_(NULL),
views_view_(NULL),
fast_resize_(false),
fast_resize_at_last_layout_(false),
focus_view_(NULL) {
}
......@@ -120,6 +121,7 @@ void NativeViewHost::Layout() {
} else {
native_wrapper_->HideWidget();
}
fast_resize_at_last_layout_ = visible && fast_resize_;
}
void NativeViewHost::OnPaint(gfx::Canvas* canvas) {
......
......@@ -68,6 +68,11 @@ class VIEWS_EXPORT NativeViewHost : public View {
void set_fast_resize(bool fast_resize) { fast_resize_ = fast_resize; }
bool fast_resize() const { return fast_resize_; }
// Value of fast_resize() the last time Layout() was invoked.
bool fast_resize_at_last_layout() const {
return fast_resize_at_last_layout_;
}
// Accessor for |native_view_|.
gfx::NativeView native_view() const { return native_view_; }
......@@ -115,6 +120,9 @@ class VIEWS_EXPORT NativeViewHost : public View {
// in the setter/accessor above.
bool fast_resize_;
// Value of |fast_resize_| during the last call to Layout.
bool fast_resize_at_last_layout_;
// The view that should be given focus when this NativeViewHost is focused.
View* focus_view_;
......
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