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 <set> | 8 #include <set> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 591 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
602 | 602 |
603 void RenderWidgetHostImpl::WasResized() { | 603 void RenderWidgetHostImpl::WasResized() { |
604 // Skip if the |delegate_| has already been detached because | 604 // Skip if the |delegate_| has already been detached because |
605 // it's web contents is being deleted. | 605 // it's web contents is being deleted. |
606 if (resize_ack_pending_ || !process_->HasConnection() || !view_ || | 606 if (resize_ack_pending_ || !process_->HasConnection() || !view_ || |
607 !renderer_initialized_ || auto_resize_enabled_ || !delegate_) { | 607 !renderer_initialized_ || auto_resize_enabled_ || !delegate_) { |
608 return; | 608 return; |
609 } | 609 } |
610 | 610 |
611 bool size_changed = true; | 611 bool size_changed = true; |
| 612 bool width_changed = true; |
612 bool side_payload_changed = screen_info_out_of_date_; | 613 bool side_payload_changed = screen_info_out_of_date_; |
613 scoped_ptr<ViewMsg_Resize_Params> params(new ViewMsg_Resize_Params); | 614 scoped_ptr<ViewMsg_Resize_Params> params(new ViewMsg_Resize_Params); |
614 | 615 |
615 GetResizeParams(params.get()); | 616 GetResizeParams(params.get()); |
616 if (old_resize_params_) { | 617 if (old_resize_params_) { |
617 size_changed = old_resize_params_->new_size != params->new_size; | 618 size_changed = old_resize_params_->new_size != params->new_size; |
| 619 width_changed = |
| 620 old_resize_params_->new_size.width() != params->new_size.width(); |
618 side_payload_changed = | 621 side_payload_changed = |
619 side_payload_changed || | 622 side_payload_changed || |
620 old_resize_params_->physical_backing_size != | 623 old_resize_params_->physical_backing_size != |
621 params->physical_backing_size || | 624 params->physical_backing_size || |
622 old_resize_params_->is_fullscreen != params->is_fullscreen || | 625 old_resize_params_->is_fullscreen != params->is_fullscreen || |
623 old_resize_params_->top_controls_height != | 626 old_resize_params_->top_controls_height != |
624 params->top_controls_height || | 627 params->top_controls_height || |
625 old_resize_params_->top_controls_shrink_blink_size != | 628 old_resize_params_->top_controls_shrink_blink_size != |
626 params->top_controls_shrink_blink_size || | 629 params->top_controls_shrink_blink_size || |
627 old_resize_params_->visible_viewport_size != | 630 old_resize_params_->visible_viewport_size != |
(...skipping 10 matching lines...) Expand all Loading... |
638 resize_ack_pending_ = g_check_for_pending_resize_ack; | 641 resize_ack_pending_ = g_check_for_pending_resize_ack; |
639 } | 642 } |
640 | 643 |
641 if (!Send(new ViewMsg_Resize(routing_id_, *params))) { | 644 if (!Send(new ViewMsg_Resize(routing_id_, *params))) { |
642 resize_ack_pending_ = false; | 645 resize_ack_pending_ = false; |
643 } else { | 646 } else { |
644 old_resize_params_.swap(params); | 647 old_resize_params_.swap(params); |
645 } | 648 } |
646 | 649 |
647 if (delegate_) | 650 if (delegate_) |
648 delegate_->RenderWidgetWasResized(this); | 651 delegate_->RenderWidgetWasResized(this, width_changed); |
649 } | 652 } |
650 | 653 |
651 void RenderWidgetHostImpl::ResizeRectChanged(const gfx::Rect& new_rect) { | 654 void RenderWidgetHostImpl::ResizeRectChanged(const gfx::Rect& new_rect) { |
652 Send(new ViewMsg_ChangeResizeRect(routing_id_, new_rect)); | 655 Send(new ViewMsg_ChangeResizeRect(routing_id_, new_rect)); |
653 } | 656 } |
654 | 657 |
655 void RenderWidgetHostImpl::GotFocus() { | 658 void RenderWidgetHostImpl::GotFocus() { |
656 Focus(); | 659 Focus(); |
657 if (delegate_) | 660 if (delegate_) |
658 delegate_->RenderWidgetGotFocus(this); | 661 delegate_->RenderWidgetGotFocus(this); |
(...skipping 1525 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2184 } | 2187 } |
2185 #endif | 2188 #endif |
2186 | 2189 |
2187 SkColorType RenderWidgetHostImpl::PreferredReadbackFormat() { | 2190 SkColorType RenderWidgetHostImpl::PreferredReadbackFormat() { |
2188 if (view_) | 2191 if (view_) |
2189 return view_->PreferredReadbackFormat(); | 2192 return view_->PreferredReadbackFormat(); |
2190 return kN32_SkColorType; | 2193 return kN32_SkColorType; |
2191 } | 2194 } |
2192 | 2195 |
2193 } // namespace content | 2196 } // namespace content |
OLD | NEW |