Chromium Code Reviews| 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/renderer/render_widget.h" | 5 #include "content/renderer/render_widget.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
| (...skipping 670 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 681 std::unique_ptr<cc::SwapPromiseMonitor> latency_info_swap_promise_monitor( | 681 std::unique_ptr<cc::SwapPromiseMonitor> latency_info_swap_promise_monitor( |
| 682 compositor_->CreateLatencyInfoSwapPromiseMonitor(&swap_latency_info)); | 682 compositor_->CreateLatencyInfoSwapPromiseMonitor(&swap_latency_info)); |
| 683 compositor_->SetNeedsForcedRedraw(); | 683 compositor_->SetNeedsForcedRedraw(); |
| 684 } | 684 } |
| 685 ScheduleComposite(); | 685 ScheduleComposite(); |
| 686 } | 686 } |
| 687 | 687 |
| 688 void RenderWidget::OnRequestMoveAck() { | 688 void RenderWidget::OnRequestMoveAck() { |
| 689 DCHECK(pending_window_rect_count_); | 689 DCHECK(pending_window_rect_count_); |
| 690 pending_window_rect_count_--; | 690 pending_window_rect_count_--; |
| 691 if (!pending_window_rect_count_) | |
| 692 view_screen_rect_ = pending_window_rect_; | |
|
bokan
2016/04/21 22:04:44
In making the changes to WebPagePopupImpl, I notic
| |
| 691 } | 693 } |
| 692 | 694 |
| 693 GURL RenderWidget::GetURLForGraphicsContext3D() { | 695 GURL RenderWidget::GetURLForGraphicsContext3D() { |
| 694 return GURL(); | 696 return GURL(); |
| 695 } | 697 } |
| 696 | 698 |
| 697 void RenderWidget::OnHandleInputEvent(const blink::WebInputEvent* input_event, | 699 void RenderWidget::OnHandleInputEvent(const blink::WebInputEvent* input_event, |
| 698 const ui::LatencyInfo& latency_info, | 700 const ui::LatencyInfo& latency_info, |
| 699 InputEventDispatchType dispatch_type) { | 701 InputEventDispatchType dispatch_type) { |
| 700 if (!input_event) | 702 if (!input_event) |
| (...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1142 DCHECK(!params.needs_resize_ack || !next_paint_is_resize_ack()); | 1144 DCHECK(!params.needs_resize_ack || !next_paint_is_resize_ack()); |
| 1143 } | 1145 } |
| 1144 | 1146 |
| 1145 // Ignore this during shutdown. | 1147 // Ignore this during shutdown. |
| 1146 if (!webwidget_) | 1148 if (!webwidget_) |
| 1147 return; | 1149 return; |
| 1148 | 1150 |
| 1149 if (compositor_) | 1151 if (compositor_) |
| 1150 compositor_->setViewportSize(params.physical_backing_size); | 1152 compositor_->setViewportSize(params.physical_backing_size); |
| 1151 | 1153 |
| 1152 bool resized = size_ != params.new_size || | |
| 1153 physical_backing_size_ != params.physical_backing_size; | |
| 1154 | |
| 1155 size_ = params.new_size; | 1154 size_ = params.new_size; |
| 1156 physical_backing_size_ = params.physical_backing_size; | 1155 physical_backing_size_ = params.physical_backing_size; |
| 1157 | 1156 |
| 1158 top_controls_shrink_blink_size_ = params.top_controls_shrink_blink_size; | 1157 top_controls_shrink_blink_size_ = params.top_controls_shrink_blink_size; |
| 1159 top_controls_height_ = params.top_controls_height; | 1158 top_controls_height_ = params.top_controls_height; |
| 1160 visible_viewport_size_ = params.visible_viewport_size; | 1159 visible_viewport_size_ = params.visible_viewport_size; |
| 1161 resizer_rect_ = params.resizer_rect; | 1160 resizer_rect_ = params.resizer_rect; |
| 1162 | 1161 |
| 1163 // NOTE: We may have entered fullscreen mode without changing our size. | 1162 // NOTE: We may have entered fullscreen mode without changing our size. |
| 1164 bool fullscreen_change = | 1163 bool fullscreen_change = |
| 1165 is_fullscreen_granted_ != params.is_fullscreen_granted; | 1164 is_fullscreen_granted_ != params.is_fullscreen_granted; |
| 1166 is_fullscreen_granted_ = params.is_fullscreen_granted; | 1165 is_fullscreen_granted_ = params.is_fullscreen_granted; |
| 1167 display_mode_ = params.display_mode; | 1166 display_mode_ = params.display_mode; |
| 1168 | 1167 |
| 1169 webwidget_->setTopControlsHeight(params.top_controls_height, | 1168 webwidget_->setTopControlsHeight(params.top_controls_height, |
| 1170 top_controls_shrink_blink_size_); | 1169 top_controls_shrink_blink_size_); |
| 1171 | 1170 |
| 1172 if (resized) { | 1171 gfx::Size new_widget_size = size_; |
| 1173 gfx::Size new_widget_size = size_; | 1172 if (IsUseZoomForDSFEnabled()) { |
| 1174 if (IsUseZoomForDSFEnabled()) { | 1173 new_widget_size = gfx::ScaleToCeiledSize(new_widget_size, |
| 1175 new_widget_size = gfx::ScaleToCeiledSize(new_widget_size, | 1174 GetOriginalDeviceScaleFactor()); |
| 1176 GetOriginalDeviceScaleFactor()); | |
| 1177 } | |
| 1178 // When resizing, we want to wait to paint before ACK'ing the resize. This | |
| 1179 // ensures that we only resize as fast as we can paint. We only need to | |
| 1180 // send an ACK if we are resized to a non-empty rect. | |
| 1181 webwidget_->resize(new_widget_size); | |
| 1182 } | 1175 } |
| 1176 // When resizing, we want to wait to paint before ACK'ing the resize. This | |
| 1177 // ensures that we only resize as fast as we can paint. We only need to | |
| 1178 // send an ACK if we are resized to a non-empty rect. | |
| 1179 webwidget_->resize(new_widget_size); | |
| 1180 | |
| 1183 WebSize visual_viewport_size; | 1181 WebSize visual_viewport_size; |
| 1184 | 1182 |
| 1185 if (IsUseZoomForDSFEnabled()) { | 1183 if (IsUseZoomForDSFEnabled()) { |
| 1186 visual_viewport_size = gfx::ScaleToCeiledSize( | 1184 visual_viewport_size = gfx::ScaleToCeiledSize( |
| 1187 params.visible_viewport_size, | 1185 params.visible_viewport_size, |
| 1188 GetOriginalDeviceScaleFactor()); | 1186 GetOriginalDeviceScaleFactor()); |
| 1189 } else { | 1187 } else { |
| 1190 visual_viewport_size = visible_viewport_size_; | 1188 visual_viewport_size = visible_viewport_size_; |
| 1191 } | 1189 } |
| 1192 | 1190 |
| (...skipping 933 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2126 } | 2124 } |
| 2127 | 2125 |
| 2128 float RenderWidget::GetOriginalDeviceScaleFactor() const { | 2126 float RenderWidget::GetOriginalDeviceScaleFactor() const { |
| 2129 return | 2127 return |
| 2130 screen_metrics_emulator_ ? | 2128 screen_metrics_emulator_ ? |
| 2131 screen_metrics_emulator_->original_screen_info().deviceScaleFactor : | 2129 screen_metrics_emulator_->original_screen_info().deviceScaleFactor : |
| 2132 device_scale_factor_; | 2130 device_scale_factor_; |
| 2133 } | 2131 } |
| 2134 | 2132 |
| 2135 } // namespace content | 2133 } // namespace content |
| OLD | NEW |