Chromium Code Reviews| 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 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 379 // reduce its resource utilization. | 379 // reduce its resource utilization. |
| 380 render_widget_host_->WasHidden(); | 380 render_widget_host_->WasHidden(); |
| 381 | 381 |
| 382 // TODO(darin): what about constrained windows? it doesn't look like they | 382 // TODO(darin): what about constrained windows? it doesn't look like they |
| 383 // see a message when their parent is hidden. maybe there is something more | 383 // see a message when their parent is hidden. maybe there is something more |
| 384 // generic we can do at the TabContents API level instead of relying on | 384 // generic we can do at the TabContents API level instead of relying on |
| 385 // Windows messages. | 385 // Windows messages. |
| 386 } | 386 } |
| 387 | 387 |
| 388 void RenderWidgetHostViewWin::SetSize(const gfx::Size& size) { | 388 void RenderWidgetHostViewWin::SetSize(const gfx::Size& size) { |
| 389 SetBounds(gfx::Rect(GetViewBounds().origin(), size)); | |
| 390 } | |
| 391 | |
| 392 void RenderWidgetHostViewWin::SetBounds(const gfx::Rect& rect) { | |
| 389 if (is_hidden_) | 393 if (is_hidden_) |
| 390 return; | 394 return; |
| 391 | 395 |
| 392 // No SWP_NOREDRAW as autofill popups can resize and the underneath window | 396 // No SWP_NOREDRAW as autofill popups can move and the underneath window |
| 393 // should redraw in that case. | 397 // should redraw in that case. |
| 394 UINT swp_flags = SWP_NOSENDCHANGING | SWP_NOOWNERZORDER | SWP_NOCOPYBITS | | 398 UINT swp_flags = SWP_NOSENDCHANGING | SWP_NOOWNERZORDER | SWP_NOCOPYBITS | |
| 395 SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE | SWP_DEFERERASE; | 399 SWP_NOZORDER | SWP_NOACTIVATE | SWP_DEFERERASE; |
| 396 SetWindowPos(NULL, 0, 0, size.width(), size.height(), swp_flags); | 400 |
| 401 // If the style is not popup, you have to convert the point to client | |
| 402 // coordinate. | |
| 403 CPoint point(rect.x(), rect.y()); | |
|
Ben Goodger (Google)
2011/03/11 03:39:42
POINT... I prefer not to use ATL types.
honten.org
2011/03/12 07:47:07
Done.
| |
| 404 if (GetStyle() & WS_CHILD) | |
| 405 ScreenToClient(&point); | |
| 406 | |
| 407 SetWindowPos(NULL, point.x, point.y, rect.width(), rect.height(), swp_flags); | |
| 397 if (compositor_host_window_) { | 408 if (compositor_host_window_) { |
| 398 ::SetWindowPos(compositor_host_window_, | 409 ::SetWindowPos(compositor_host_window_, NULL, point.x, point.y, |
| 399 NULL, | 410 rect.width(), rect.height(), |
| 400 0, 0, | |
| 401 size.width(), size.height(), | |
| 402 SWP_NOSENDCHANGING | SWP_NOCOPYBITS | SWP_NOZORDER | SWP_NOACTIVATE); | 411 SWP_NOSENDCHANGING | SWP_NOCOPYBITS | SWP_NOZORDER | SWP_NOACTIVATE); |
| 403 } | 412 } |
| 404 render_widget_host_->WasResized(); | 413 render_widget_host_->WasResized(); |
| 405 EnsureTooltip(); | 414 EnsureTooltip(); |
| 406 } | 415 } |
| 407 | 416 |
| 408 gfx::NativeView RenderWidgetHostViewWin::GetNativeView() { | 417 gfx::NativeView RenderWidgetHostViewWin::GetNativeView() { |
| 409 return m_hWnd; | 418 return m_hWnd; |
| 410 } | 419 } |
| 411 | 420 |
| (...skipping 1447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1859 } | 1868 } |
| 1860 | 1869 |
| 1861 // static | 1870 // static |
| 1862 RenderWidgetHostView* | 1871 RenderWidgetHostView* |
| 1863 RenderWidgetHostView::GetRenderWidgetHostViewFromNativeView( | 1872 RenderWidgetHostView::GetRenderWidgetHostViewFromNativeView( |
| 1864 gfx::NativeView native_view) { | 1873 gfx::NativeView native_view) { |
| 1865 return ::IsWindow(native_view) ? | 1874 return ::IsWindow(native_view) ? |
| 1866 reinterpret_cast<RenderWidgetHostView*>( | 1875 reinterpret_cast<RenderWidgetHostView*>( |
| 1867 ViewProp::GetValue(native_view, kRenderWidgetHostViewKey)) : NULL; | 1876 ViewProp::GetValue(native_view, kRenderWidgetHostViewKey)) : NULL; |
| 1868 } | 1877 } |
| OLD | NEW |