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

Unified Diff: mojo/services/native_viewport/native_viewport_win.cc

Issue 292813008: Implement SetViewContents in the client lib (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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 | « mojo/mojo_services.gypi ('k') | mojo/services/public/cpp/view_manager/lib/DEPS » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/services/native_viewport/native_viewport_win.cc
diff --git a/mojo/services/native_viewport/native_viewport_win.cc b/mojo/services/native_viewport/native_viewport_win.cc
index 86e7ce9a53e7c0186e8be2a2ac437613d1f8154b..84bfdc37f7cf1fccc56aa429baf484309cbe59cb 100644
--- a/mojo/services/native_viewport/native_viewport_win.cc
+++ b/mojo/services/native_viewport/native_viewport_win.cc
@@ -20,7 +20,14 @@ gfx::Rect GetWindowBoundsForClientBounds(DWORD style, DWORD ex_style,
wr.right = bounds.x() + bounds.width();
wr.bottom = bounds.y() + bounds.height();
AdjustWindowRectEx(&wr, style, FALSE, ex_style);
- return gfx::Rect(wr.left, wr.top, wr.right - wr.left, wr.bottom - wr.top);
+
+ // Make sure to keep the window onscreen, as AdjustWindowRectEx() may have
+ // moved part of it offscreen.
+ gfx::Rect window_bounds(wr.left, wr.top,
+ wr.right - wr.left, wr.bottom - wr.top);
+ window_bounds.set_x(std::max(0, window_bounds.x()));
+ window_bounds.set_y(std::max(0, window_bounds.y()));
+ return window_bounds;
}
}
« no previous file with comments | « mojo/mojo_services.gypi ('k') | mojo/services/public/cpp/view_manager/lib/DEPS » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698