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 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 } | 133 } |
134 | 134 |
135 void RenderWidgetScreenMetricsEmulator::OnResize(const ResizeParams& params) { | 135 void RenderWidgetScreenMetricsEmulator::OnResize(const ResizeParams& params) { |
136 original_resize_params_ = params; | 136 original_resize_params_ = params; |
137 Apply(); | 137 Apply(); |
138 | 138 |
139 if (params.needs_resize_ack) | 139 if (params.needs_resize_ack) |
140 delegate_->Redraw(); | 140 delegate_->Redraw(); |
141 } | 141 } |
142 | 142 |
| 143 void RenderWidgetScreenMetricsEmulator::OnUpdateWindowScreenRectMessage( |
| 144 const gfx::Rect& window_screen_rect) { |
| 145 original_window_screen_rect_ = window_screen_rect; |
| 146 if (emulation_params_.screenPosition == |
| 147 blink::WebDeviceEmulationParams::Desktop) |
| 148 Apply(); |
| 149 } |
| 150 |
143 void RenderWidgetScreenMetricsEmulator::OnUpdateScreenRects( | 151 void RenderWidgetScreenMetricsEmulator::OnUpdateScreenRects( |
144 const gfx::Rect& view_screen_rect, | 152 const gfx::Rect& view_screen_rect, |
145 const gfx::Rect& window_screen_rect) { | 153 const gfx::Rect& window_screen_rect) { |
146 original_view_screen_rect_ = view_screen_rect; | 154 original_view_screen_rect_ = view_screen_rect; |
147 original_window_screen_rect_ = window_screen_rect; | 155 original_window_screen_rect_ = window_screen_rect; |
148 if (emulation_params_.screenPosition == | 156 if (emulation_params_.screenPosition == |
149 blink::WebDeviceEmulationParams::Desktop) { | 157 blink::WebDeviceEmulationParams::Desktop) { |
150 Apply(); | 158 Apply(); |
151 } | 159 } |
152 } | 160 } |
153 | 161 |
154 void RenderWidgetScreenMetricsEmulator::OnShowContextMenu( | 162 void RenderWidgetScreenMetricsEmulator::OnShowContextMenu( |
155 ContextMenuParams* params) { | 163 ContextMenuParams* params) { |
156 params->x *= scale_; | 164 params->x *= scale_; |
157 params->x += offset_.x(); | 165 params->x += offset_.x(); |
158 params->y *= scale_; | 166 params->y *= scale_; |
159 params->y += offset_.y(); | 167 params->y += offset_.y(); |
160 } | 168 } |
161 | 169 |
162 gfx::Rect RenderWidgetScreenMetricsEmulator::AdjustValidationMessageAnchor( | 170 gfx::Rect RenderWidgetScreenMetricsEmulator::AdjustValidationMessageAnchor( |
163 const gfx::Rect& anchor) { | 171 const gfx::Rect& anchor) { |
164 gfx::Rect scaled = gfx::ScaleToEnclosedRect(anchor, scale_); | 172 gfx::Rect scaled = gfx::ScaleToEnclosedRect(anchor, scale_); |
165 scaled.set_x(scaled.x() + offset_.x()); | 173 scaled.set_x(scaled.x() + offset_.x()); |
166 scaled.set_y(scaled.y() + offset_.y()); | 174 scaled.set_y(scaled.y() + offset_.y()); |
167 return scaled; | 175 return scaled; |
168 } | 176 } |
169 | 177 |
170 } // namespace content | 178 } // namespace content |
OLD | NEW |