Chromium Code Reviews| Index: remoting/client/ui/desktop_viewport.cc |
| diff --git a/remoting/client/ui/desktop_viewport.cc b/remoting/client/ui/desktop_viewport.cc |
| index c150f1bb6b02f4e58ab31bbc9bf372b1852ef27a..77a9d9e6f9205bc7d37b6d968e9d7258ba9e7cf2 100644 |
| --- a/remoting/client/ui/desktop_viewport.cc |
| +++ b/remoting/client/ui/desktop_viewport.cc |
| @@ -35,9 +35,21 @@ void DesktopViewport::SetSurfaceSize(int surface_width, int surface_height) { |
| return; |
| } |
| + // Only reset the viewport if both dimensions have changed. This is to |
| + // preserve the viewport state in case the surface is just scrolled up. |
|
nicholss
2017/05/26 20:12:49
The keyboard showing changes the size of the viewp
Yuwei
2017/05/30 19:27:08
Done.
|
| + // E.g. when showing the soft keyboard. |
| + bool need_to_reset = |
| + surface_width != surface_size_.x && surface_height != surface_size_.y; |
| + |
| surface_size_.x = surface_width; |
| surface_size_.y = surface_height; |
| - ResizeToFit(); |
| + |
| + if (need_to_reset) { |
| + ResizeToFit(); |
| + return; |
| + } |
| + |
| + UpdateViewport(); |
| } |
| void DesktopViewport::MoveDesktop(float dx, float dy) { |