| 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 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 delegate_(delegate), | 161 delegate_(delegate), |
| 162 process_(process), | 162 process_(process), |
| 163 routing_id_(routing_id), | 163 routing_id_(routing_id), |
| 164 surface_id_(0), | 164 surface_id_(0), |
| 165 is_loading_(false), | 165 is_loading_(false), |
| 166 is_hidden_(hidden), | 166 is_hidden_(hidden), |
| 167 is_fullscreen_(false), | 167 is_fullscreen_(false), |
| 168 repaint_ack_pending_(false), | 168 repaint_ack_pending_(false), |
| 169 resize_ack_pending_(false), | 169 resize_ack_pending_(false), |
| 170 screen_info_out_of_date_(false), | 170 screen_info_out_of_date_(false), |
| 171 overdraw_bottom_height_(0.f), | 171 top_controls_layout_height_(0.f), |
| 172 should_auto_resize_(false), | 172 should_auto_resize_(false), |
| 173 waiting_for_screen_rects_ack_(false), | 173 waiting_for_screen_rects_ack_(false), |
| 174 needs_repainting_on_restore_(false), | 174 needs_repainting_on_restore_(false), |
| 175 is_unresponsive_(false), | 175 is_unresponsive_(false), |
| 176 in_flight_event_count_(0), | 176 in_flight_event_count_(0), |
| 177 in_get_backing_store_(false), | 177 in_get_backing_store_(false), |
| 178 ignore_input_events_(false), | 178 ignore_input_events_(false), |
| 179 input_method_active_(false), | 179 input_method_active_(false), |
| 180 text_direction_updated_(false), | 180 text_direction_updated_(false), |
| 181 text_direction_(blink::WebTextDirectionLeftToRight), | 181 text_direction_(blink::WebTextDirectionLeftToRight), |
| (...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 557 !renderer_initialized_ || should_auto_resize_ || !delegate_) { | 557 !renderer_initialized_ || should_auto_resize_ || !delegate_) { |
| 558 return; | 558 return; |
| 559 } | 559 } |
| 560 | 560 |
| 561 gfx::Size new_size(view_->GetRequestedRendererSize()); | 561 gfx::Size new_size(view_->GetRequestedRendererSize()); |
| 562 | 562 |
| 563 gfx::Size old_physical_backing_size = physical_backing_size_; | 563 gfx::Size old_physical_backing_size = physical_backing_size_; |
| 564 physical_backing_size_ = view_->GetPhysicalBackingSize(); | 564 physical_backing_size_ = view_->GetPhysicalBackingSize(); |
| 565 bool was_fullscreen = is_fullscreen_; | 565 bool was_fullscreen = is_fullscreen_; |
| 566 is_fullscreen_ = IsFullscreen(); | 566 is_fullscreen_ = IsFullscreen(); |
| 567 float old_overdraw_bottom_height = overdraw_bottom_height_; | 567 float old_top_controls_layout_height = |
| 568 overdraw_bottom_height_ = view_->GetOverdrawBottomHeight(); | 568 top_controls_layout_height_; |
| 569 top_controls_layout_height_ = |
| 570 view_->GetTopControlsLayoutHeight(); |
| 569 gfx::Size old_visible_viewport_size = visible_viewport_size_; | 571 gfx::Size old_visible_viewport_size = visible_viewport_size_; |
| 570 visible_viewport_size_ = view_->GetVisibleViewportSize(); | 572 visible_viewport_size_ = view_->GetVisibleViewportSize(); |
| 571 | 573 |
| 572 bool size_changed = new_size != last_requested_size_; | 574 bool size_changed = new_size != last_requested_size_; |
| 573 bool side_payload_changed = | 575 bool side_payload_changed = |
| 574 screen_info_out_of_date_ || | 576 screen_info_out_of_date_ || |
| 575 old_physical_backing_size != physical_backing_size_ || | 577 old_physical_backing_size != physical_backing_size_ || |
| 576 was_fullscreen != is_fullscreen_ || | 578 was_fullscreen != is_fullscreen_ || |
| 577 old_overdraw_bottom_height != overdraw_bottom_height_ || | 579 old_top_controls_layout_height != |
| 580 top_controls_layout_height_ || |
| 578 old_visible_viewport_size != visible_viewport_size_; | 581 old_visible_viewport_size != visible_viewport_size_; |
| 579 | 582 |
| 580 if (!size_changed && !side_payload_changed) | 583 if (!size_changed && !side_payload_changed) |
| 581 return; | 584 return; |
| 582 | 585 |
| 583 if (!screen_info_) { | 586 if (!screen_info_) { |
| 584 screen_info_.reset(new blink::WebScreenInfo); | 587 screen_info_.reset(new blink::WebScreenInfo); |
| 585 GetWebScreenInfo(screen_info_.get()); | 588 GetWebScreenInfo(screen_info_.get()); |
| 586 } | 589 } |
| 587 | 590 |
| 588 // We don't expect to receive an ACK when the requested size or the physical | 591 // We don't expect to receive an ACK when the requested size or the physical |
| 589 // backing size is empty, or when the main viewport size didn't change. | 592 // backing size is empty, or when the main viewport size didn't change. |
| 590 if (!new_size.IsEmpty() && !physical_backing_size_.IsEmpty() && size_changed) | 593 if (!new_size.IsEmpty() && !physical_backing_size_.IsEmpty() && size_changed) |
| 591 resize_ack_pending_ = g_check_for_pending_resize_ack; | 594 resize_ack_pending_ = g_check_for_pending_resize_ack; |
| 592 | 595 |
| 593 ViewMsg_Resize_Params params; | 596 ViewMsg_Resize_Params params; |
| 594 params.screen_info = *screen_info_; | 597 params.screen_info = *screen_info_; |
| 595 params.new_size = new_size; | 598 params.new_size = new_size; |
| 596 params.physical_backing_size = physical_backing_size_; | 599 params.physical_backing_size = physical_backing_size_; |
| 597 params.overdraw_bottom_height = overdraw_bottom_height_; | 600 params.top_controls_layout_height = top_controls_layout_height_; |
| 598 params.visible_viewport_size = visible_viewport_size_; | 601 params.visible_viewport_size = visible_viewport_size_; |
| 599 params.resizer_rect = GetRootWindowResizerRect(); | 602 params.resizer_rect = GetRootWindowResizerRect(); |
| 600 params.is_fullscreen = is_fullscreen_; | 603 params.is_fullscreen = is_fullscreen_; |
| 601 if (!Send(new ViewMsg_Resize(routing_id_, params))) { | 604 if (!Send(new ViewMsg_Resize(routing_id_, params))) { |
| 602 resize_ack_pending_ = false; | 605 resize_ack_pending_ = false; |
| 603 } else { | 606 } else { |
| 604 last_requested_size_ = new_size; | 607 last_requested_size_ = new_size; |
| 605 } | 608 } |
| 606 } | 609 } |
| 607 | 610 |
| (...skipping 1721 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2329 } | 2332 } |
| 2330 #endif | 2333 #endif |
| 2331 | 2334 |
| 2332 SkColorType RenderWidgetHostImpl::PreferredReadbackFormat() { | 2335 SkColorType RenderWidgetHostImpl::PreferredReadbackFormat() { |
| 2333 if (view_) | 2336 if (view_) |
| 2334 return view_->PreferredReadbackFormat(); | 2337 return view_->PreferredReadbackFormat(); |
| 2335 return kN32_SkColorType; | 2338 return kN32_SkColorType; |
| 2336 } | 2339 } |
| 2337 | 2340 |
| 2338 } // namespace content | 2341 } // namespace content |
| OLD | NEW |