summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-10-20 15:54:56 +0000
committerben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-10-20 15:54:56 +0000
commita3a81e0ed4b8b50066cc558732827cef17038fe3 (patch)
treeedca4078af1379ad9470009538feb5033fef94f9
parent1b8f15d355bc165e483299a3370ece21439e5651 (diff)
downloadchromium_src-a3a81e0ed4b8b50066cc558732827cef17038fe3.zip
chromium_src-a3a81e0ed4b8b50066cc558732827cef17038fe3.tar.gz
chromium_src-a3a81e0ed4b8b50066cc558732827cef17038fe3.tar.bz2
Turns on RWHVA.
1. Makes sure to schedule a compositor draw when accelerated buffers are swapped on linux, otherwise we don't redraw the content area until the next time a draw is scheduled otherwise 2. Updates the logic in the NativeViewHost/NativeTabContentsContainer/View etc code to better deal with switching tabs. http://crbug.com/99757 TEST=none Review URL: http://codereview.chromium.org/8353021 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@106504 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/ui/views/tab_contents/native_tab_contents_container_aura.cc16
-rw-r--r--chrome/browser/ui/views/tab_contents/native_tab_contents_view_aura.cc10
-rw-r--r--content/browser/renderer_host/render_widget_host_view_aura.cc14
-rw-r--r--ui/aura/window.cc1
-rw-r--r--ui/aura/window.h1
-rw-r--r--views/controls/native/native_view_host_aura.cc5
6 files changed, 21 insertions, 26 deletions
diff --git a/chrome/browser/ui/views/tab_contents/native_tab_contents_container_aura.cc b/chrome/browser/ui/views/tab_contents/native_tab_contents_container_aura.cc
index 7c1b6ae..476b2b8 100644
--- a/chrome/browser/ui/views/tab_contents/native_tab_contents_container_aura.cc
+++ b/chrome/browser/ui/views/tab_contents/native_tab_contents_container_aura.cc
@@ -45,18 +45,6 @@ void NativeTabContentsContainerAura::DetachContents(TabContents* contents) {
// TabContentsViewViews so that the window hierarchy is intact for any
// cleanup during Detach().
Detach();
-
- // TODO(brettw) should this move to NativeViewHost::Detach? It
- // needs cleanup regardless.
- aura::Window* container_window = contents->GetNativeView();
- if (container_window) {
- // Hide the contents before adjusting its parent to avoid a full desktop
- // flicker.
- container_window->Hide();
-
- // Reset the parent to NULL to ensure hidden tabs don't receive messages.
- static_cast<TabContentsViewViews*>(contents->view())->Unparent();
- }
}
void NativeTabContentsContainerAura::SetFastResize(bool fast_resize) {
@@ -151,7 +139,7 @@ gfx::NativeViewAccessible
// static
NativeTabContentsContainer* NativeTabContentsContainer::CreateNativeContainer(
TabContentsContainer* container) {
- return new NativeTabContentsContainerViews(container);
+ // return new NativeTabContentsContainerViews(container);
// TODO(beng): switch this over once we're using this container.
- // return new NativeTabContentsContainerAura(container);
+ return new NativeTabContentsContainerAura(container);
}
diff --git a/chrome/browser/ui/views/tab_contents/native_tab_contents_view_aura.cc b/chrome/browser/ui/views/tab_contents/native_tab_contents_view_aura.cc
index b7dd70b..6a3b808 100644
--- a/chrome/browser/ui/views/tab_contents/native_tab_contents_view_aura.cc
+++ b/chrome/browser/ui/views/tab_contents/native_tab_contents_view_aura.cc
@@ -48,11 +48,7 @@ void NativeTabContentsViewAura::InitNativeTabContentsView() {
}
void NativeTabContentsViewAura::Unparent() {
- // Note that we do not DCHECK on focus_manager_ as it may be NULL when used
- // with an external tab container.
- views::Widget::ReparentNativeView(GetNativeView(), NULL);
- // TODO(beng):
- NOTIMPLEMENTED();
+ // Nothing to do.
}
RenderWidgetHostView* NativeTabContentsViewAura::CreateRenderWidgetHostView(
@@ -139,8 +135,8 @@ bool NativeTabContentsViewAura::OnMouseEvent(aura::MouseEvent* event) {
// static
NativeTabContentsView* NativeTabContentsView::CreateNativeTabContentsView(
internal::NativeTabContentsViewDelegate* delegate) {
- return new NativeTabContentsViewViews(delegate);
+ // return new NativeTabContentsViewViews(delegate);
// TODO(beng): switch over to this.
- // return new NativeTabContentsViewAura(delegate);
+ return new NativeTabContentsViewAura(delegate);
}
#endif
diff --git a/content/browser/renderer_host/render_widget_host_view_aura.cc b/content/browser/renderer_host/render_widget_host_view_aura.cc
index e44ded2..299368f 100644
--- a/content/browser/renderer_host/render_widget_host_view_aura.cc
+++ b/content/browser/renderer_host/render_widget_host_view_aura.cc
@@ -154,7 +154,11 @@ void RenderWidgetHostViewAura::ImeCancelComposition() {
void RenderWidgetHostViewAura::DidUpdateBackingStore(
const gfx::Rect& scroll_rect, int scroll_dx, int scroll_dy,
const std::vector<gfx::Rect>& copy_rects) {
- window_->SchedulePaintInRect(scroll_rect);
+ if (!window_->IsVisible())
+ return;
+
+ if (!scroll_rect.IsEmpty())
+ window_->SchedulePaintInRect(scroll_rect);
for (size_t i = 0; i < copy_rects.size(); ++i) {
gfx::Rect rect = copy_rects[i].Subtract(scroll_rect);
@@ -214,6 +218,8 @@ void RenderWidgetHostViewAura::AcceleratedSurfaceBuffersSwapped(
// We have no compositor, so we have no way to display the surface
AcknowledgeSwapBuffers(route_id, gpu_host_id); // Must still send the ACK
} else {
+ window_->layer()->ScheduleDraw();
+
// Add sending an ACK to the list of things to do OnCompositingEnded
on_compositing_ended_callbacks_.push_back(
base::Bind(AcknowledgeSwapBuffers, route_id, gpu_host_id));
@@ -271,11 +277,11 @@ void RenderWidgetHostViewAura::SetScrollOffsetPinning(
#if defined(OS_WIN)
void RenderWidgetHostViewAura::WillWmDestroy() {
- NOTREACHED();
+ // Nothing to do.
}
void RenderWidgetHostViewAura::ShowCompositorHostWindow(bool show) {
- NOTREACHED();
+ // Nothing to do.
}
#endif
@@ -369,6 +375,8 @@ void RenderWidgetHostViewAura::OnCaptureLost() {
}
void RenderWidgetHostViewAura::OnPaint(gfx::Canvas* canvas) {
+ if (!window_->IsVisible())
+ return;
BackingStore* backing_store = host_->GetBackingStore(true);
if (backing_store) {
static_cast<BackingStoreSkia*>(backing_store)->SkiaShowRect(gfx::Point(),
diff --git a/ui/aura/window.cc b/ui/aura/window.cc
index 4ff40e2..e3945e1 100644
--- a/ui/aura/window.cc
+++ b/ui/aura/window.cc
@@ -180,7 +180,6 @@ void Window::MoveChildToFront(Window* child) {
DCHECK(i != children_.end());
children_.erase(i);
- // TODO(beng): this obviously has to handle different window types.
children_.insert(children_.begin() + children_.size(), child);
SchedulePaintInRect(gfx::Rect());
diff --git a/ui/aura/window.h b/ui/aura/window.h
index aa2bd23..a2b9617 100644
--- a/ui/aura/window.h
+++ b/ui/aura/window.h
@@ -144,7 +144,6 @@ class AURA_EXPORT Window : public ui::LayerDelegate {
void SetParent(Window* parent);
// Move the specified child of this Window to the front of the z-order.
- // TODO(beng): this is (obviously) feeble.
void MoveChildToFront(Window* child);
// Returns true if this window can be activated.
diff --git a/views/controls/native/native_view_host_aura.cc b/views/controls/native/native_view_host_aura.cc
index 76949be..af82d3b 100644
--- a/views/controls/native/native_view_host_aura.cc
+++ b/views/controls/native/native_view_host_aura.cc
@@ -23,11 +23,16 @@ NativeViewHostAura::~NativeViewHostAura() {
////////////////////////////////////////////////////////////////////////////////
// NativeViewHostAura, NativeViewHostWrapper implementation:
void NativeViewHostAura::NativeViewAttached() {
+ if (host_->native_view()->parent())
+ host_->native_view()->parent()->RemoveChild(host_->native_view());
host_->GetWidget()->GetNativeView()->AddChild(host_->native_view());
+ host_->native_view()->Show();
host_->Layout();
}
void NativeViewHostAura::NativeViewDetaching(bool destroyed) {
+ host_->native_view()->Hide();
+ host_->GetWidget()->GetNativeView()->RemoveChild(host_->native_view());
}
void NativeViewHostAura::AddedToWidget() {