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 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
555 !renderer_initialized_ || should_auto_resize_ || !delegate_) { | 555 !renderer_initialized_ || should_auto_resize_ || !delegate_) { |
556 return; | 556 return; |
557 } | 557 } |
558 | 558 |
559 gfx::Size new_size(view_->GetRequestedRendererSize()); | 559 gfx::Size new_size(view_->GetRequestedRendererSize()); |
560 | 560 |
561 gfx::Size old_physical_backing_size = physical_backing_size_; | 561 gfx::Size old_physical_backing_size = physical_backing_size_; |
562 physical_backing_size_ = view_->GetPhysicalBackingSize(); | 562 physical_backing_size_ = view_->GetPhysicalBackingSize(); |
563 bool was_fullscreen = is_fullscreen_; | 563 bool was_fullscreen = is_fullscreen_; |
564 is_fullscreen_ = IsFullscreen(); | 564 is_fullscreen_ = IsFullscreen(); |
565 float old_overdraw_bottom_height = overdraw_bottom_height_; | 565 float old_top_controls_layout_height = |
566 overdraw_bottom_height_ = view_->GetOverdrawBottomHeight(); | 566 top_controls_layout_height_; |
| 567 top_controls_layout_height_ = |
| 568 view_->GetTopControlsLayoutHeight(); |
567 gfx::Size old_visible_viewport_size = visible_viewport_size_; | 569 gfx::Size old_visible_viewport_size = visible_viewport_size_; |
568 visible_viewport_size_ = view_->GetVisibleViewportSize(); | 570 visible_viewport_size_ = view_->GetVisibleViewportSize(); |
569 | 571 |
570 bool size_changed = new_size != last_requested_size_; | 572 bool size_changed = new_size != last_requested_size_; |
571 bool side_payload_changed = | 573 bool side_payload_changed = |
572 screen_info_out_of_date_ || | 574 screen_info_out_of_date_ || |
573 old_physical_backing_size != physical_backing_size_ || | 575 old_physical_backing_size != physical_backing_size_ || |
574 was_fullscreen != is_fullscreen_ || | 576 was_fullscreen != is_fullscreen_ || |
575 old_overdraw_bottom_height != overdraw_bottom_height_ || | 577 old_top_controls_layout_height != |
| 578 top_controls_layout_height_ || |
576 old_visible_viewport_size != visible_viewport_size_; | 579 old_visible_viewport_size != visible_viewport_size_; |
577 | 580 |
578 if (!size_changed && !side_payload_changed) | 581 if (!size_changed && !side_payload_changed) |
579 return; | 582 return; |
580 | 583 |
581 if (!screen_info_) { | 584 if (!screen_info_) { |
582 screen_info_.reset(new blink::WebScreenInfo); | 585 screen_info_.reset(new blink::WebScreenInfo); |
583 GetWebScreenInfo(screen_info_.get()); | 586 GetWebScreenInfo(screen_info_.get()); |
584 } | 587 } |
585 | 588 |
586 // We don't expect to receive an ACK when the requested size or the physical | 589 // We don't expect to receive an ACK when the requested size or the physical |
587 // backing size is empty, or when the main viewport size didn't change. | 590 // backing size is empty, or when the main viewport size didn't change. |
588 if (!new_size.IsEmpty() && !physical_backing_size_.IsEmpty() && size_changed) | 591 if (!new_size.IsEmpty() && !physical_backing_size_.IsEmpty() && size_changed) |
589 resize_ack_pending_ = g_check_for_pending_resize_ack; | 592 resize_ack_pending_ = g_check_for_pending_resize_ack; |
590 | 593 |
591 ViewMsg_Resize_Params params; | 594 ViewMsg_Resize_Params params; |
592 params.screen_info = *screen_info_; | 595 params.screen_info = *screen_info_; |
593 params.new_size = new_size; | 596 params.new_size = new_size; |
594 params.physical_backing_size = physical_backing_size_; | 597 params.physical_backing_size = physical_backing_size_; |
595 params.overdraw_bottom_height = overdraw_bottom_height_; | 598 params.top_controls_layout_height = top_controls_layout_height_; |
596 params.visible_viewport_size = visible_viewport_size_; | 599 params.visible_viewport_size = visible_viewport_size_; |
597 params.resizer_rect = GetRootWindowResizerRect(); | 600 params.resizer_rect = GetRootWindowResizerRect(); |
598 params.is_fullscreen = is_fullscreen_; | 601 params.is_fullscreen = is_fullscreen_; |
599 if (!Send(new ViewMsg_Resize(routing_id_, params))) { | 602 if (!Send(new ViewMsg_Resize(routing_id_, params))) { |
600 resize_ack_pending_ = false; | 603 resize_ack_pending_ = false; |
601 } else { | 604 } else { |
602 last_requested_size_ = new_size; | 605 last_requested_size_ = new_size; |
603 } | 606 } |
604 } | 607 } |
605 | 608 |
(...skipping 1712 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2318 } | 2321 } |
2319 #endif | 2322 #endif |
2320 | 2323 |
2321 SkColorType RenderWidgetHostImpl::PreferredReadbackFormat() { | 2324 SkColorType RenderWidgetHostImpl::PreferredReadbackFormat() { |
2322 if (view_) | 2325 if (view_) |
2323 return view_->PreferredReadbackFormat(); | 2326 return view_->PreferredReadbackFormat(); |
2324 return kN32_SkColorType; | 2327 return kN32_SkColorType; |
2325 } | 2328 } |
2326 | 2329 |
2327 } // namespace content | 2330 } // namespace content |
OLD | NEW |