OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 1531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1542 wcex.hbrBackground = NULL; | 1542 wcex.hbrBackground = NULL; |
1543 wcex.lpszMenuName = 0; | 1543 wcex.lpszMenuName = 0; |
1544 wcex.lpszClassName = L"CompositorHostWindowClass"; | 1544 wcex.lpszClassName = L"CompositorHostWindowClass"; |
1545 wcex.hIconSm = 0; | 1545 wcex.hIconSm = 0; |
1546 window_class = RegisterClassEx(&wcex); | 1546 window_class = RegisterClassEx(&wcex); |
1547 DCHECK(window_class); | 1547 DCHECK(window_class); |
1548 } | 1548 } |
1549 | 1549 |
1550 RECT currentRect; | 1550 RECT currentRect; |
1551 GetClientRect(¤tRect); | 1551 GetClientRect(¤tRect); |
1552 int width = currentRect.right - currentRect.left; | 1552 |
1553 int height = currentRect.bottom - currentRect.top; | 1553 // Ensure window does not have zero area because D3D cannot create a zero |
| 1554 // area swap chain. |
| 1555 int width = std::max(1, |
| 1556 static_cast<int>(currentRect.right - currentRect.left)); |
| 1557 int height = std::max(1, |
| 1558 static_cast<int>(currentRect.bottom - currentRect.top)); |
1554 | 1559 |
1555 compositor_host_window_ = CreateWindowEx( | 1560 compositor_host_window_ = CreateWindowEx( |
1556 WS_EX_LEFT | WS_EX_LTRREADING | WS_EX_RIGHTSCROLLBAR, | 1561 WS_EX_LEFT | WS_EX_LTRREADING | WS_EX_RIGHTSCROLLBAR, |
1557 MAKEINTATOM(window_class), 0, | 1562 MAKEINTATOM(window_class), 0, |
1558 WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | WS_DISABLED, | 1563 WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | WS_DISABLED, |
1559 0, 0, width, height, m_hWnd, 0, GetModuleHandle(NULL), 0); | 1564 0, 0, width, height, m_hWnd, 0, GetModuleHandle(NULL), 0); |
1560 ui::CheckWindowCreated(compositor_host_window_); | 1565 ui::CheckWindowCreated(compositor_host_window_); |
1561 | 1566 |
1562 ui::SetWindowUserData(compositor_host_window_, this); | 1567 ui::SetWindowUserData(compositor_host_window_, this); |
1563 | 1568 |
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1798 } | 1803 } |
1799 | 1804 |
1800 // static | 1805 // static |
1801 RenderWidgetHostView* | 1806 RenderWidgetHostView* |
1802 RenderWidgetHostView::GetRenderWidgetHostViewFromNativeView( | 1807 RenderWidgetHostView::GetRenderWidgetHostViewFromNativeView( |
1803 gfx::NativeView native_view) { | 1808 gfx::NativeView native_view) { |
1804 return ::IsWindow(native_view) ? | 1809 return ::IsWindow(native_view) ? |
1805 reinterpret_cast<RenderWidgetHostView*>( | 1810 reinterpret_cast<RenderWidgetHostView*>( |
1806 ViewProp::GetValue(native_view, kRenderWidgetHostViewKey)) : NULL; | 1811 ViewProp::GetValue(native_view, kRenderWidgetHostViewKey)) : NULL; |
1807 } | 1812 } |
OLD | NEW |