Chromium Code Reviews| Index: content/browser/renderer_host/render_widget_host.cc |
| diff --git a/content/browser/renderer_host/render_widget_host.cc b/content/browser/renderer_host/render_widget_host.cc |
| index 38f81153ccc981d2af9676192c33a7cd9f880602..cfb63cf25db78cb0089e55e53208da44ace5276e 100644 |
| --- a/content/browser/renderer_host/render_widget_host.cc |
| +++ b/content/browser/renderer_host/render_widget_host.cc |
| @@ -347,46 +347,34 @@ void RenderWidgetHost::WasResized() { |
| } |
| #if !defined(OS_MACOSX) |
| - gfx::Size new_size = view_->GetViewBounds().size(); |
| + gfx::Rect view_bounds = view_->GetViewBounds(); |
| #else |
| // When UI scaling is enabled on OS X, allocate a smaller bitmap and |
| // pixel-scale it up. |
| // TODO(thakis): Use pixel size on mac and set UI scale in renderer. |
| // http://crbug.com/31960 |
| - gfx::Size new_size(view_->GetViewCocoaBounds().size()); |
| + gfx::Rect view_bounds(view_->GetViewCocoaBounds().size()); |
| #endif |
| - gfx::Rect reserved_rect = view_->reserved_contents_rect(); |
| + gfx::Size new_size(view_bounds.width(), view_bounds.height()); |
|
sky
2012/01/23 15:45:34
nit: view_bounds.size()
Nico
2012/01/23 15:54:14
Done.
|
| // Avoid asking the RenderWidget to resize to its current size, since it |
| - // won't send us a PaintRect message in that case, unless reserved area is |
| - // changed, but even in this case PaintRect message won't be sent. |
| - if (new_size == current_size_ && reserved_rect == current_reserved_rect_) |
| + // won't send us a PaintRect message in that case. |
| + if (new_size == current_size_) |
| return; |
| - if (in_flight_size_ != gfx::Size() && new_size == in_flight_size_ && |
| - in_flight_reserved_rect_ == reserved_rect) { |
| + if (in_flight_size_ != gfx::Size() && new_size == in_flight_size_) { |
| return; |
| } |
| - // We don't expect to receive an ACK when the requested size is empty or |
| - // only reserved area is changed. |
| - resize_ack_pending_ = !new_size.IsEmpty() && new_size != current_size_; |
| + // We don't expect to receive an ACK when the requested size is empty. |
| + if (!new_size.IsEmpty()) |
| + resize_ack_pending_ = true; |
| - if (!Send(new ViewMsg_Resize(routing_id_, new_size, reserved_rect, |
| - IsFullscreen()))) { |
| + if (!Send(new ViewMsg_Resize(routing_id_, new_size, |
| + GetRootWindowResizerRect(), IsFullscreen()))) { |
| resize_ack_pending_ = false; |
| } else { |
| - if (resize_ack_pending_) { |
|
sky
2012/01/23 15:45:34
How come we don't need this if/else anymore?
Nico
2012/01/23 15:54:14
The changelist I'm reverting here added it: http:/
|
| - in_flight_size_ = new_size; |
| - in_flight_reserved_rect_ = reserved_rect; |
| - } else { |
| - // Message was sent successfully, but we do not expect to receive an ACK, |
| - // so update current values right away. |
| - current_size_ = new_size; |
| - // TODO(alekseys): send a message from renderer to ack a reserved rect |
| - // changes only. |
| - current_reserved_rect_ = reserved_rect; |
| - } |
| + in_flight_size_ = new_size; |
| } |
| } |
| @@ -778,9 +766,7 @@ void RenderWidgetHost::RendererExited(base::TerminationStatus status, |
| repaint_ack_pending_ = false; |
| in_flight_size_.SetSize(0, 0); |
| - in_flight_reserved_rect_.SetRect(0, 0, 0, 0); |
| current_size_.SetSize(0, 0); |
| - current_reserved_rect_.SetRect(0, 0, 0, 0); |
| is_hidden_ = false; |
| is_accelerated_compositing_active_ = false; |
| @@ -843,6 +829,10 @@ void RenderWidgetHost::ImeCancelComposition() { |
| std::vector<WebKit::WebCompositionUnderline>(), 0, 0)); |
| } |
| +gfx::Rect RenderWidgetHost::GetRootWindowResizerRect() const { |
| + return gfx::Rect(); |
| +} |
| + |
| void RenderWidgetHost::RequestToLockMouse() { |
| // Directly reject to lock the mouse. Subclass can override this method to |
| // decide whether to allow mouse lock or not. |
| @@ -1009,15 +999,7 @@ void RenderWidgetHost::OnMsgUpdateRect( |
| DCHECK(resize_ack_pending_); |
| resize_ack_pending_ = false; |
| in_flight_size_.SetSize(0, 0); |
| - in_flight_reserved_rect_.SetRect(0, 0, 0, 0); |
| } |
| - // Update our knowledge of the RenderWidget's resizer rect. |
| - // ViewMsg_Resize is acknowledged only when view size is actually changed, |
| - // otherwise current_reserved_rect_ is updated immediately after sending |
| - // ViewMsg_Resize to the RenderWidget and can be clobbered by |
| - // OnMsgUpdateRect called for a paint that was initiated before the resize |
| - // message was sent. |
| - current_reserved_rect_ = params.resizer_rect; |
| } |
| bool is_repaint_ack = |
| @@ -1137,9 +1119,11 @@ void RenderWidgetHost::DidUpdateBackingStore( |
| bool is_resize_ack = |
| ViewHostMsg_UpdateRect_Flags::is_resize_ack(params.flags); |
| if (is_resize_ack && view_) { |
| - // WasResized checks the current size and sends the resize update only |
| - // when something was actually changed. |
| - WasResized(); |
| + gfx::Rect view_bounds = view_->GetViewBounds(); |
| + if (current_size_.width() != view_bounds.width() || |
|
sky
2012/01/23 15:45:34
nit: current_size_ != view_bounds.size()
Nico
2012/01/23 15:54:14
Done.
|
| + current_size_.height() != view_bounds.height()) { |
| + WasResized(); |
| + } |
| } |
| // Log the time delta for processing a paint message. |