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

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
« no previous file with comments | « remoting/client/ui/desktop_viewport.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..0b243af4bc8e450e69b2b7d7fac0b4d937d36774 100644
--- a/remoting/client/ui/desktop_viewport.cc
+++ b/remoting/client/ui/desktop_viewport.cc
@@ -35,9 +35,27 @@ void DesktopViewport::SetSurfaceSize(int surface_width, int surface_height) {
return;
}
+ // Only reset the viewport if both dimensions have changed, otherwise keep
+ // the offset and scale and just change the constraint. This is to cover these
+ // use cases:
+ // * Rotation => Reset
+ // * Keyboard => No reset
+ // * Settings menu => No reset
+ //
+ // TODO(yuweih): This is probably too much inferring. Let the caller to decide
+ // when to call ResizeToFit() if things don't work right.
+ 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) {
« no previous file with comments | « remoting/client/ui/desktop_viewport.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698