OLD | NEW |
---|---|
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/renderer_host/render_widget_host_view_win.h" | 5 #include "chrome/browser/renderer_host/render_widget_host_view_win.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/i18n/rtl.h" | 10 #include "base/i18n/rtl.h" |
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
359 // reduce its resource utilization. | 359 // reduce its resource utilization. |
360 render_widget_host_->WasHidden(); | 360 render_widget_host_->WasHidden(); |
361 | 361 |
362 // TODO(darin): what about constrained windows? it doesn't look like they | 362 // TODO(darin): what about constrained windows? it doesn't look like they |
363 // see a message when their parent is hidden. maybe there is something more | 363 // see a message when their parent is hidden. maybe there is something more |
364 // generic we can do at the TabContents API level instead of relying on | 364 // generic we can do at the TabContents API level instead of relying on |
365 // Windows messages. | 365 // Windows messages. |
366 } | 366 } |
367 | 367 |
368 void RenderWidgetHostViewWin::SetSize(const gfx::Size& size) { | 368 void RenderWidgetHostViewWin::SetSize(const gfx::Size& size) { |
369 SetBounds(gfx::Rect(GetViewBounds.origin(), size)); | |
370 } | |
371 | |
372 void RenderWidgetHostViewWin::SetBounds(const gfx::Rect& rect) { | |
369 if (is_hidden_) | 373 if (is_hidden_) |
370 return; | 374 return; |
371 | 375 |
372 // No SWP_NOREDRAW as autofill popups can resize and the underneath window | 376 // No SWP_NOREDRAW as autofill popups can move and the underneath window |
373 // should redraw in that case. | 377 // should redraw in that case. |
374 UINT swp_flags = SWP_NOSENDCHANGING | SWP_NOOWNERZORDER | SWP_NOCOPYBITS | | 378 UINT swp_flags = SWP_NOSENDCHANGING | SWP_NOOWNERZORDER | SWP_NOCOPYBITS | |
375 SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE | SWP_DEFERERASE; | 379 SWP_NOZORDER | SWP_NOACTIVATE | SWP_DEFERERASE; |
376 SetWindowPos(NULL, 0, 0, size.width(), size.height(), swp_flags); | 380 |
381 // If the style is not popup, you have to convert the point to client | |
Peter Kasting
2011/03/07 19:25:44
The MSDN docs for SetWindowPos() say that the supp
honten.org
2011/03/07 19:36:07
Yes, I thought so first. But it caused the problem
Peter Kasting
2011/03/07 20:20:15
That sounds like a bug in ScreenToClient(), maybe.
honten.org
2011/03/07 21:19:50
Ok, I ask Ben.
On 2011/03/07 20:20:15, Peter Kast
Ben Goodger (Google)
2011/03/09 02:30:32
Peter is right, this should check for !GetParent(G
honten.org
2011/03/09 02:33:03
I see.
So, for now, if WS_POPUP is specified, WS_
honten.org
2011/03/10 05:55:48
Ben,
Unfortunately, this is not right. Even if I
| |
382 // coordinate. | |
383 CPoint point(rect.x(), rect.y()); | |
384 if (!(GetStyle() & WS_POPUP)) | |
385 ScreenToClient(&point); | |
386 | |
387 SetWindowPos(NULL, point.x, point.y, rect.width(), rect.height(), swp_flags); | |
377 if (compositor_host_window_) { | 388 if (compositor_host_window_) { |
378 ::SetWindowPos(compositor_host_window_, | 389 ::SetWindowPos(compositor_host_window_, NULL, point.x, point.y, |
379 NULL, | 390 rect.width(), rect.height(), |
380 0, 0, | |
381 size.width(), size.height(), | |
382 SWP_NOSENDCHANGING | SWP_NOCOPYBITS | SWP_NOZORDER | SWP_NOACTIVATE); | 391 SWP_NOSENDCHANGING | SWP_NOCOPYBITS | SWP_NOZORDER | SWP_NOACTIVATE); |
383 } | 392 } |
384 render_widget_host_->WasResized(); | 393 render_widget_host_->WasResized(); |
385 EnsureTooltip(); | 394 EnsureTooltip(); |
386 } | 395 } |
387 | 396 |
388 gfx::NativeView RenderWidgetHostViewWin::GetNativeView() { | 397 gfx::NativeView RenderWidgetHostViewWin::GetNativeView() { |
389 return m_hWnd; | 398 return m_hWnd; |
390 } | 399 } |
391 | 400 |
(...skipping 1428 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1820 } | 1829 } |
1821 | 1830 |
1822 // static | 1831 // static |
1823 RenderWidgetHostView* | 1832 RenderWidgetHostView* |
1824 RenderWidgetHostView::GetRenderWidgetHostViewFromNativeView( | 1833 RenderWidgetHostView::GetRenderWidgetHostViewFromNativeView( |
1825 gfx::NativeView native_view) { | 1834 gfx::NativeView native_view) { |
1826 return ::IsWindow(native_view) ? | 1835 return ::IsWindow(native_view) ? |
1827 reinterpret_cast<RenderWidgetHostView*>( | 1836 reinterpret_cast<RenderWidgetHostView*>( |
1828 ViewProp::GetValue(native_view, kRenderWidgetHostViewKey)) : NULL; | 1837 ViewProp::GetValue(native_view, kRenderWidgetHostViewKey)) : NULL; |
1829 } | 1838 } |
OLD | NEW |