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 gfx::Rect rect = GetViewBounds(); | |
370 rect.set_size(size); | |
371 SetBounds(rect); | |
372 } | |
373 | |
374 void RenderWidgetHostViewWin::SetBounds(const gfx::Rect& rect) { | |
369 if (is_hidden_) | 375 if (is_hidden_) |
370 return; | 376 return; |
371 | 377 |
372 // No SWP_NOREDRAW as autofill popups can resize and the underneath window | 378 // No SWP_NOREDRAW as autofill popups can move and the underneath window |
373 // should redraw in that case. | 379 // should redraw in that case. |
374 UINT swp_flags = SWP_NOSENDCHANGING | SWP_NOOWNERZORDER | SWP_NOCOPYBITS | | 380 UINT swp_flags = SWP_NOSENDCHANGING | SWP_NOOWNERZORDER | SWP_NOCOPYBITS | |
375 SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE | SWP_DEFERERASE; | 381 SWP_NOZORDER | SWP_NOACTIVATE | SWP_DEFERERASE; |
376 SetWindowPos(NULL, 0, 0, size.width(), size.height(), swp_flags); | 382 gfx::Rect org_rect = GetViewBounds(); |
383 SetWindowPos(NULL, rect.x(), rect.y(), rect.width(), | |
Peter Kasting
2011/02/23 19:46:14
Nit: Wrap as late as possible (before |swp_flags|)
honten.org
2011/02/24 08:03:58
Done.
| |
384 rect.height(), swp_flags); | |
377 if (compositor_host_window_) { | 385 if (compositor_host_window_) { |
378 ::SetWindowPos(compositor_host_window_, | 386 ::SetWindowPos(compositor_host_window_, |
Peter Kasting
2011/02/23 19:46:14
Nit: Just collapse these onto as few lines as poss
honten.org
2011/02/24 08:03:58
Done.
| |
379 NULL, | 387 NULL, |
380 0, 0, | 388 rect.x(), rect.y(), |
381 size.width(), size.height(), | 389 rect.width(), rect.height(), |
382 SWP_NOSENDCHANGING | SWP_NOCOPYBITS | SWP_NOZORDER | SWP_NOACTIVATE); | 390 SWP_NOSENDCHANGING | SWP_NOCOPYBITS | SWP_NOZORDER | SWP_NOACTIVATE); |
383 } | 391 } |
384 render_widget_host_->WasResized(); | 392 render_widget_host_->WasResized(); |
385 EnsureTooltip(); | 393 EnsureTooltip(); |
386 } | 394 } |
387 | 395 |
388 gfx::NativeView RenderWidgetHostViewWin::GetNativeView() { | 396 gfx::NativeView RenderWidgetHostViewWin::GetNativeView() { |
389 return m_hWnd; | 397 return m_hWnd; |
390 } | 398 } |
391 | 399 |
(...skipping 1428 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1820 } | 1828 } |
1821 | 1829 |
1822 // static | 1830 // static |
1823 RenderWidgetHostView* | 1831 RenderWidgetHostView* |
1824 RenderWidgetHostView::GetRenderWidgetHostViewFromNativeView( | 1832 RenderWidgetHostView::GetRenderWidgetHostViewFromNativeView( |
1825 gfx::NativeView native_view) { | 1833 gfx::NativeView native_view) { |
1826 return ::IsWindow(native_view) ? | 1834 return ::IsWindow(native_view) ? |
1827 reinterpret_cast<RenderWidgetHostView*>( | 1835 reinterpret_cast<RenderWidgetHostView*>( |
1828 ViewProp::GetValue(native_view, kRenderWidgetHostViewKey)) : NULL; | 1836 ViewProp::GetValue(native_view, kRenderWidgetHostViewKey)) : NULL; |
1829 } | 1837 } |
OLD | NEW |