Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2594)

Unified Diff: remoting/client/ui/desktop_viewport.cc

Issue 2909703002: [CRD iOS] Preserve viewport state when toggling the soft keyboard (Closed)
Patch Set: Merge ToT Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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) {
« remoting/client/ui/desktop_viewport.h ('K') | « remoting/client/ui/desktop_viewport.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698