Commit 2b107a34 authored by levin@chromium.org's avatar levin@chromium.org

Make the code for unmaximizing the window during SetBounds much simpler.

This still fixes the original bug and does it in a much simpler (and faster)
way. I was previously attempting to use an API to do this rather than just
setting the style directly but that API may have hidden side effects like
causing a window activation on some versions of Windows.

BUG=69724
TEST=WidgetWinTest::SetBoundsForZoomedWindow

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

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@71767 0039d316-1c4b-4281-b951-d872f2087c98
parent 695e65dc
......@@ -239,8 +239,9 @@ void WidgetWin::GetBounds(gfx::Rect* out, bool including_frame) const {
}
void WidgetWin::SetBounds(const gfx::Rect& bounds) {
if (IsZoomed())
ShowWindow(SW_SHOWNOACTIVATE);
LONG style = GetWindowLong(GWL_STYLE);
if (style & WS_MAXIMIZE)
SetWindowLong(GWL_STYLE, style & ~WS_MAXIMIZE);
SetWindowPos(NULL, bounds.x(), bounds.y(), bounds.width(), bounds.height(),
SWP_NOACTIVATE | SWP_NOZORDER);
}
......
......@@ -74,8 +74,7 @@ TEST_F(WidgetWinTest, SetBoundsForZoomedWindow) {
// cause it to be activated.
window->SetBounds(gfx::Rect(50, 50, 650, 650));
EXPECT_FALSE(window->IsZoomed());
// Re-enable the check below: http://crbug.com/69724
// EXPECT_FALSE(window->IsActive());
EXPECT_FALSE(window->IsActive());
// Cleanup.
window->CloseNow();
......
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