Index: content/browser/renderer_host/render_widget_host_view_aura.cc |
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 9f43ca61d648d1ed57a50bf6cb1d272d576d9fed..37c1a9dd671f09284496f10c9e78687e971e269b 100644 |
--- a/content/browser/renderer_host/render_widget_host_view_aura.cc |
+++ b/content/browser/renderer_host/render_widget_host_view_aura.cc |
@@ -677,17 +677,7 @@ void RenderWidgetHostViewAura::InitAsPopup( |
aura::RootWindow* root = popup_parent_host_view_->window_->GetRootWindow(); |
window_->SetDefaultParentByRootWindow(root, bounds_in_screen); |
- // TODO(erg): While I could make sure details of the StackingClient are |
- // hidden behind aura, hiding the details of the ScreenPositionClient will |
- // take another effort. |
- aura::client::ScreenPositionClient* screen_position_client = |
- aura::client::GetScreenPositionClient(root); |
- gfx::Point origin_in_parent(bounds_in_screen.origin()); |
- if (screen_position_client) { |
- screen_position_client->ConvertPointFromScreen( |
- window_->parent(), &origin_in_parent); |
- } |
- SetBounds(gfx::Rect(origin_in_parent, bounds_in_screen.size())); |
+ SetBounds(bounds_in_screen); |
Show(); |
} |
@@ -713,6 +703,7 @@ void RenderWidgetHostViewAura::InitAsFullscreen( |
parent = reference_window->GetRootWindow(); |
bounds = display.bounds(); |
} |
+ |
window_->SetDefaultParentByRootWindow(parent, bounds); |
Show(); |
Focus(); |
@@ -763,56 +754,25 @@ void RenderWidgetHostViewAura::WasHidden() { |
} |
void RenderWidgetHostViewAura::SetSize(const gfx::Size& size) { |
- SetBounds(gfx::Rect(window_->bounds().origin(), size)); |
+ // For a set size operation, we don't care what coordinate system the origin |
+ // of the window is stored in, it's only important to make sure the origin |
+ // remains constant after the operation. |
+ InternalSetBounds(gfx::Rect(window_->bounds().origin(), size)); |
} |
void RenderWidgetHostViewAura::SetBounds(const gfx::Rect& rect) { |
- if (HasDisplayPropertyChanged(window_)) |
- host_->InvalidateScreenInfo(); |
- |
- window_->SetBounds(rect); |
- host_->WasResized(); |
- MaybeCreateResizeLock(); |
- if (touch_editing_client_) { |
- touch_editing_client_->OnSelectionOrCursorChanged(selection_anchor_rect_, |
- selection_focus_rect_); |
+ // RenderWidgetHostViewAura::SetBounds() takes screen coordinates, but |
+ // Window::SetBounds() takes parent coordinates, so we do the conversion here. |
+ aura::RootWindow* root = window_->GetRootWindow(); |
+ aura::client::ScreenPositionClient* screen_position_client = |
+ aura::client::GetScreenPositionClient(root); |
+ gfx::Point origin_in_parent(rect.origin()); |
+ if (screen_position_client) { |
+ screen_position_client->ConvertPointFromScreen( |
+ window_->parent(), &origin_in_parent); |
} |
-} |
-void RenderWidgetHostViewAura::MaybeCreateResizeLock() { |
- gfx::Size desired_size = window_->bounds().size(); |
- if (!host_->should_auto_resize() && |
- !resize_lock_.get() && |
- desired_size != current_frame_size_ && |
- host_->is_accelerated_compositing_active()) { |
- aura::RootWindow* root_window = window_->GetRootWindow(); |
- ui::Compositor* compositor = root_window ? |
- root_window->compositor() : NULL; |
- if (root_window && compositor) { |
- // Listen to changes in the compositor lock state. |
- if (!compositor->HasObserver(this)) |
- compositor->AddObserver(this); |
- |
-// On Windows while resizing, the the resize locks makes us mis-paint a white |
-// vertical strip (including the non-client area) if the content composition is |
-// lagging the UI composition. So here we disable the throttling so that the UI |
-// bits can draw ahead of the content thereby reducing the amount of whiteout. |
-// Because this causes the content to be drawn at wrong sizes while resizing |
-// we compensate by blocking the UI thread in Compositor::Draw() by issuing a |
-// FinishAllRendering() if we are resizing. |
-#if !defined (OS_WIN) |
- bool defer_compositor_lock = |
- can_lock_compositor_ == NO_PENDING_RENDERER_FRAME || |
- can_lock_compositor_ == NO_PENDING_COMMIT; |
- |
- if (can_lock_compositor_ == YES) |
- can_lock_compositor_ = YES_DID_LOCK; |
- |
- resize_lock_.reset(new ResizeLock(root_window, desired_size, |
- defer_compositor_lock)); |
-#endif |
- } |
- } |
+ InternalSetBounds(gfx::Rect(origin_in_parent, rect.size())); |
} |
gfx::NativeView RenderWidgetHostViewAura::GetNativeView() const { |
@@ -1180,6 +1140,7 @@ void RenderWidgetHostViewAura::CopyFromCompositingSurface( |
} |
const gfx::Size& dst_size_in_pixel = ConvertViewSizeToPixel(this, dst_size); |
+ |
scoped_ptr<cc::CopyOutputRequest> request = |
cc::CopyOutputRequest::CreateRequest(base::Bind( |
&RenderWidgetHostViewAura::CopyFromCompositingSurfaceHasResult, |
@@ -1252,6 +1213,55 @@ bool RenderWidgetHostViewAura::ShouldSkipFrame(gfx::Size size_in_dip) const { |
return size_in_dip != resize_lock_->expected_size(); |
} |
+void RenderWidgetHostViewAura::InternalSetBounds(const gfx::Rect& rect) { |
+ if (HasDisplayPropertyChanged(window_)) |
+ host_->InvalidateScreenInfo(); |
+ |
+ window_->SetBounds(rect); |
+ host_->WasResized(); |
+ MaybeCreateResizeLock(); |
+ if (touch_editing_client_) { |
+ touch_editing_client_->OnSelectionOrCursorChanged(selection_anchor_rect_, |
+ selection_focus_rect_); |
+ } |
+} |
+ |
+void RenderWidgetHostViewAura::MaybeCreateResizeLock() { |
+ gfx::Size desired_size = window_->bounds().size(); |
+ if (!host_->should_auto_resize() && |
+ !resize_lock_.get() && |
+ desired_size != current_frame_size_ && |
+ host_->is_accelerated_compositing_active()) { |
+ aura::RootWindow* root_window = window_->GetRootWindow(); |
+ ui::Compositor* compositor = root_window ? |
+ root_window->compositor() : NULL; |
+ if (root_window && compositor) { |
+ // Listen to changes in the compositor lock state. |
+ if (!compositor->HasObserver(this)) |
+ compositor->AddObserver(this); |
+ |
+// On Windows while resizing, the the resize locks makes us mis-paint a white |
+// vertical strip (including the non-client area) if the content composition is |
+// lagging the UI composition. So here we disable the throttling so that the UI |
+// bits can draw ahead of the content thereby reducing the amount of whiteout. |
+// Because this causes the content to be drawn at wrong sizes while resizing |
+// we compensate by blocking the UI thread in Compositor::Draw() by issuing a |
+// FinishAllRendering() if we are resizing. |
+#if !defined (OS_WIN) |
+ bool defer_compositor_lock = |
+ can_lock_compositor_ == NO_PENDING_RENDERER_FRAME || |
+ can_lock_compositor_ == NO_PENDING_COMMIT; |
+ |
+ if (can_lock_compositor_ == YES) |
+ can_lock_compositor_ = YES_DID_LOCK; |
+ |
+ resize_lock_.reset(new ResizeLock(root_window, desired_size, |
+ defer_compositor_lock)); |
+#endif |
+ } |
+ } |
+} |
+ |
void RenderWidgetHostViewAura::CheckResizeLock() { |
if (!resize_lock_ || resize_lock_->expected_size() != current_frame_size_) |
return; |