OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "content/browser/renderer_host/render_widget_host_impl.h" | 5 #include "content/browser/renderer_host/render_widget_host_impl.h" |
6 | 6 |
7 #include <math.h> | 7 #include <math.h> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
(...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
473 | 473 |
474 void RenderWidgetHostImpl::WasResized() { | 474 void RenderWidgetHostImpl::WasResized() { |
475 if (resize_ack_pending_ || !process_->HasConnection() || !view_ || | 475 if (resize_ack_pending_ || !process_->HasConnection() || !view_ || |
476 !renderer_initialized_ || should_auto_resize_) { | 476 !renderer_initialized_ || should_auto_resize_) { |
477 return; | 477 return; |
478 } | 478 } |
479 | 479 |
480 gfx::Rect view_bounds = view_->GetViewBounds(); | 480 gfx::Rect view_bounds = view_->GetViewBounds(); |
481 gfx::Size new_size(view_bounds.size()); | 481 gfx::Size new_size(view_bounds.size()); |
482 | 482 |
| 483 gfx::Size old_physical_backing_size = physical_backing_size_; |
| 484 physical_backing_size_ = view_->GetPhysicalBackingSize(); |
483 bool was_fullscreen = is_fullscreen_; | 485 bool was_fullscreen = is_fullscreen_; |
484 is_fullscreen_ = IsFullscreen(); | 486 is_fullscreen_ = IsFullscreen(); |
485 bool fullscreen_changed = was_fullscreen != is_fullscreen_; | 487 |
486 bool size_changed = new_size != current_size_; | 488 bool size_changed = new_size != current_size_; |
| 489 bool side_payload_changed = |
| 490 old_physical_backing_size != physical_backing_size_ || |
| 491 was_fullscreen != is_fullscreen_; |
487 | 492 |
488 // Avoid asking the RenderWidget to resize to its current size, since it | 493 if (!size_changed && !side_payload_changed) |
489 // won't send us a PaintRect message in that case. | |
490 if (!size_changed && !fullscreen_changed) | |
491 return; | 494 return; |
492 | 495 |
493 if (in_flight_size_ != gfx::Size() && new_size == in_flight_size_ && | 496 if (in_flight_size_ != gfx::Size() && new_size == in_flight_size_ && |
494 !fullscreen_changed) | 497 !side_payload_changed) |
495 return; | 498 return; |
496 | 499 |
497 // We don't expect to receive an ACK when the requested size is empty. | 500 // We don't expect to receive an ACK when the requested size is empty or when |
| 501 // the main viewport size didn't change. |
498 if (!new_size.IsEmpty() && size_changed) | 502 if (!new_size.IsEmpty() && size_changed) |
499 resize_ack_pending_ = true; | 503 resize_ack_pending_ = true; |
500 | 504 |
501 if (!Send(new ViewMsg_Resize(routing_id_, new_size, | 505 if (!Send(new ViewMsg_Resize(routing_id_, new_size, physical_backing_size_, |
502 GetRootWindowResizerRect(), is_fullscreen_))) { | 506 GetRootWindowResizerRect(), is_fullscreen_))) { |
503 resize_ack_pending_ = false; | 507 resize_ack_pending_ = false; |
504 } else { | 508 } else { |
505 in_flight_size_ = new_size; | 509 in_flight_size_ = new_size; |
506 } | 510 } |
507 } | 511 } |
508 | 512 |
509 void RenderWidgetHostImpl::ResizeRectChanged(const gfx::Rect& new_rect) { | 513 void RenderWidgetHostImpl::ResizeRectChanged(const gfx::Rect& new_rect) { |
510 Send(new ViewMsg_ChangeResizeRect(routing_id_, new_rect)); | 514 Send(new ViewMsg_ChangeResizeRect(routing_id_, new_rect)); |
511 } | 515 } |
512 | 516 |
(...skipping 1853 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2366 return; | 2370 return; |
2367 | 2371 |
2368 OnRenderAutoResized(new_size); | 2372 OnRenderAutoResized(new_size); |
2369 } | 2373 } |
2370 | 2374 |
2371 void RenderWidgetHostImpl::DetachDelegate() { | 2375 void RenderWidgetHostImpl::DetachDelegate() { |
2372 delegate_ = NULL; | 2376 delegate_ = NULL; |
2373 } | 2377 } |
2374 | 2378 |
2375 } // namespace content | 2379 } // namespace content |
OLD | NEW |