OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/devtools/render_widget_screen_metrics_emulator.h" | 5 #include "content/renderer/devtools/render_widget_screen_metrics_emulator.h" |
6 | 6 |
7 #include "content/common/resize_params.h" | 7 #include "content/common/resize_params.h" |
8 #include "content/public/common/context_menu_params.h" | 8 #include "content/public/common/context_menu_params.h" |
9 #include "content/renderer/devtools/render_widget_screen_metrics_emulator_delega
te.h" | 9 #include "content/renderer/devtools/render_widget_screen_metrics_emulator_delega
te.h" |
10 | 10 |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 modified_resize_params.screen_info.rect = screen_rect; | 92 modified_resize_params.screen_info.rect = screen_rect; |
93 modified_resize_params.screen_info.availableRect = screen_rect; | 93 modified_resize_params.screen_info.availableRect = screen_rect; |
94 window_screen_rect = applied_widget_rect_; | 94 window_screen_rect = applied_widget_rect_; |
95 } | 95 } |
96 | 96 |
97 modified_resize_params.screen_info.deviceScaleFactor = | 97 modified_resize_params.screen_info.deviceScaleFactor = |
98 emulation_params_.deviceScaleFactor | 98 emulation_params_.deviceScaleFactor |
99 ? emulation_params_.deviceScaleFactor | 99 ? emulation_params_.deviceScaleFactor |
100 : original_screen_info().deviceScaleFactor; | 100 : original_screen_info().deviceScaleFactor; |
101 | 101 |
102 if (emulation_params_.screenOrientationType != | |
103 blink::WebScreenOrientationUndefined) { | |
104 modified_resize_params.screen_info.orientationType = | |
105 emulation_params_.screenOrientationType; | |
106 modified_resize_params.screen_info.orientationAngle = | |
107 emulation_params_.screenOrientationAngle; | |
108 } | |
109 | |
110 // Pass three emulation parameters to the blink side: | 102 // Pass three emulation parameters to the blink side: |
111 // - we keep the real device scale factor in compositor to produce sharp image | 103 // - we keep the real device scale factor in compositor to produce sharp image |
112 // even when emulating different scale factor; | 104 // even when emulating different scale factor; |
113 // - in order to fit into view, WebView applies offset and scale to the | 105 // - in order to fit into view, WebView applies offset and scale to the |
114 // root layer. | 106 // root layer. |
115 blink::WebDeviceEmulationParams modified_emulation_params = emulation_params_; | 107 blink::WebDeviceEmulationParams modified_emulation_params = emulation_params_; |
116 modified_emulation_params.deviceScaleFactor = | 108 modified_emulation_params.deviceScaleFactor = |
117 original_screen_info().deviceScaleFactor; | 109 original_screen_info().deviceScaleFactor; |
118 modified_emulation_params.offset = | 110 modified_emulation_params.offset = |
119 blink::WebFloatPoint(offset_.x(), offset_.y()); | 111 blink::WebFloatPoint(offset_.x(), offset_.y()); |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 | 153 |
162 gfx::Rect RenderWidgetScreenMetricsEmulator::AdjustValidationMessageAnchor( | 154 gfx::Rect RenderWidgetScreenMetricsEmulator::AdjustValidationMessageAnchor( |
163 const gfx::Rect& anchor) { | 155 const gfx::Rect& anchor) { |
164 gfx::Rect scaled = gfx::ScaleToEnclosedRect(anchor, scale_); | 156 gfx::Rect scaled = gfx::ScaleToEnclosedRect(anchor, scale_); |
165 scaled.set_x(scaled.x() + offset_.x()); | 157 scaled.set_x(scaled.x() + offset_.x()); |
166 scaled.set_y(scaled.y() + offset_.y()); | 158 scaled.set_y(scaled.y() + offset_.y()); |
167 return scaled; | 159 return scaled; |
168 } | 160 } |
169 | 161 |
170 } // namespace content | 162 } // namespace content |
OLD | NEW |