Commit 78e2fe93 authored by skuhne@chromium.org's avatar skuhne@chromium.org

Zzipping windows into the work area upon creation


BUG=122139
TEST=Unittest


Review URL: http://codereview.chromium.org/10091008

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@132491 0039d316-1c4b-4281-b951-d872f2087c98
parent ca8d144f
...@@ -171,6 +171,17 @@ void WindowSizer::DetermineWindowBounds(const gfx::Rect& specified_bounds, ...@@ -171,6 +171,17 @@ void WindowSizer::DetermineWindowBounds(const gfx::Rect& specified_bounds,
GetDefaultWindowBounds(bounds); GetDefaultWindowBounds(bounds);
} }
} }
} else {
// In case that there was a bound given we need to make sure that it is
// visible and fits on the screen.
// Find the size of the work area of the monitor that intersects the bounds
// of the anchor window. Note: AdjustBoundsToBeVisibleOnMonitorContaining
// does not exactly what we want: It makes only sure that "a minimal part"
// is visible on the screen.
gfx::Rect work_area =
monitor_info_provider_->GetMonitorWorkAreaMatching(*bounds);
// Resize so that it fits.
*bounds = bounds->AdjustToFit(work_area);
} }
} }
......
...@@ -176,7 +176,8 @@ static void GetWindowBounds(const gfx::Rect& monitor1_bounds, ...@@ -176,7 +176,8 @@ static void GetWindowBounds(const gfx::Rect& monitor1_bounds,
const gfx::Rect& work_area, const gfx::Rect& work_area,
Source source, Source source,
gfx::Rect* out_bounds, gfx::Rect* out_bounds,
const Browser* browser) { const Browser* browser,
const gfx::Rect& passed_in) {
TestMonitorInfoProvider* mip = new TestMonitorInfoProvider; TestMonitorInfoProvider* mip = new TestMonitorInfoProvider;
mip->AddMonitor(monitor1_bounds, monitor1_work_area); mip->AddMonitor(monitor1_bounds, monitor1_work_area);
if (!monitor2_bounds.IsEmpty()) if (!monitor2_bounds.IsEmpty())
...@@ -188,7 +189,7 @@ static void GetWindowBounds(const gfx::Rect& monitor1_bounds, ...@@ -188,7 +189,7 @@ static void GetWindowBounds(const gfx::Rect& monitor1_bounds,
sp->SetLastActiveState(state, true); sp->SetLastActiveState(state, true);
WindowSizer sizer(sp, mip, browser); WindowSizer sizer(sp, mip, browser);
sizer.DetermineWindowBounds(gfx::Rect(), out_bounds); sizer.DetermineWindowBounds(passed_in, out_bounds);
} }
#endif // CHROME_BROWSER_UI_WINDOW_SIZER_COMMON_UNITTEST_H_ #endif // CHROME_BROWSER_UI_WINDOW_SIZER_COMMON_UNITTEST_H_
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment