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 463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
474 | 474 |
475 void RenderWidgetHostImpl::WasResized() { | 475 void RenderWidgetHostImpl::WasResized() { |
476 if (resize_ack_pending_ || !process_->HasConnection() || !view_ || | 476 if (resize_ack_pending_ || !process_->HasConnection() || !view_ || |
477 !renderer_initialized_ || should_auto_resize_) { | 477 !renderer_initialized_ || should_auto_resize_) { |
478 return; | 478 return; |
479 } | 479 } |
480 | 480 |
481 gfx::Rect view_bounds = view_->GetViewBounds(); | 481 gfx::Rect view_bounds = view_->GetViewBounds(); |
482 gfx::Size new_size(view_bounds.size()); | 482 gfx::Size new_size(view_bounds.size()); |
483 | 483 |
| 484 gfx::Size old_physical_backing_size = physical_backing_size_; |
| 485 physical_backing_size_ = view_->GetPhysicalBackingSize(); |
484 bool was_fullscreen = is_fullscreen_; | 486 bool was_fullscreen = is_fullscreen_; |
485 is_fullscreen_ = IsFullscreen(); | 487 is_fullscreen_ = IsFullscreen(); |
486 bool fullscreen_changed = was_fullscreen != is_fullscreen_; | 488 |
487 bool size_changed = new_size != current_size_; | 489 bool size_changed = new_size != current_size_; |
| 490 bool side_payload_changed = |
| 491 old_physical_backing_size != physical_backing_size_ || |
| 492 was_fullscreen != is_fullscreen_; |
488 | 493 |
489 // Avoid asking the RenderWidget to resize to its current size, since it | 494 if (!size_changed && !side_payload_changed) |
490 // won't send us a PaintRect message in that case. | |
491 if (!size_changed && !fullscreen_changed) | |
492 return; | 495 return; |
493 | 496 |
494 if (in_flight_size_ != gfx::Size() && new_size == in_flight_size_ && | 497 if (in_flight_size_ != gfx::Size() && new_size == in_flight_size_ && |
495 !fullscreen_changed) | 498 !side_payload_changed) |
496 return; | 499 return; |
497 | 500 |
498 // We don't expect to receive an ACK when the requested size is empty. | 501 // We don't expect to receive an ACK when the requested size is empty or when |
| 502 // the main viewport size didn't change. |
499 if (!new_size.IsEmpty() && size_changed) | 503 if (!new_size.IsEmpty() && size_changed) |
500 resize_ack_pending_ = true; | 504 resize_ack_pending_ = true; |
501 | 505 |
502 if (!Send(new ViewMsg_Resize(routing_id_, new_size, | 506 if (!Send(new ViewMsg_Resize(routing_id_, new_size, physical_backing_size_, |
503 GetRootWindowResizerRect(), is_fullscreen_))) { | 507 GetRootWindowResizerRect(), is_fullscreen_))) { |
504 resize_ack_pending_ = false; | 508 resize_ack_pending_ = false; |
505 } else { | 509 } else { |
506 in_flight_size_ = new_size; | 510 in_flight_size_ = new_size; |
507 } | 511 } |
508 } | 512 } |
509 | 513 |
510 void RenderWidgetHostImpl::ResizeRectChanged(const gfx::Rect& new_rect) { | 514 void RenderWidgetHostImpl::ResizeRectChanged(const gfx::Rect& new_rect) { |
511 Send(new ViewMsg_ChangeResizeRect(routing_id_, new_rect)); | 515 Send(new ViewMsg_ChangeResizeRect(routing_id_, new_rect)); |
512 } | 516 } |
513 | 517 |
(...skipping 1873 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2387 return; | 2391 return; |
2388 | 2392 |
2389 OnRenderAutoResized(new_size); | 2393 OnRenderAutoResized(new_size); |
2390 } | 2394 } |
2391 | 2395 |
2392 void RenderWidgetHostImpl::DetachDelegate() { | 2396 void RenderWidgetHostImpl::DetachDelegate() { |
2393 delegate_ = NULL; | 2397 delegate_ = NULL; |
2394 } | 2398 } |
2395 | 2399 |
2396 } // namespace content | 2400 } // namespace content |
OLD | NEW |