diff options
-rw-r--r-- | chrome/browser/renderer_host/render_widget_host_view_win.cc | 9 | ||||
-rw-r--r-- | content/browser/gpu/gpu_process_host_ui_shim.cc | 8 |
2 files changed, 13 insertions, 4 deletions
diff --git a/chrome/browser/renderer_host/render_widget_host_view_win.cc b/chrome/browser/renderer_host/render_widget_host_view_win.cc index da10b8c..cbc97f6 100644 --- a/chrome/browser/renderer_host/render_widget_host_view_win.cc +++ b/chrome/browser/renderer_host/render_widget_host_view_win.cc @@ -1549,8 +1549,13 @@ gfx::PluginWindowHandle RenderWidgetHostViewWin::GetCompositingSurface() { RECT currentRect; GetClientRect(¤tRect); - int width = currentRect.right - currentRect.left; - int height = currentRect.bottom - currentRect.top; + + // Ensure window does not have zero area because D3D cannot create a zero + // area swap chain. + int width = std::max(1, + static_cast<int>(currentRect.right - currentRect.left)); + int height = std::max(1, + static_cast<int>(currentRect.bottom - currentRect.top)); compositor_host_window_ = CreateWindowEx( WS_EX_LEFT | WS_EX_LTRREADING | WS_EX_RIGHTSCROLLBAR, diff --git a/content/browser/gpu/gpu_process_host_ui_shim.cc b/content/browser/gpu/gpu_process_host_ui_shim.cc index a356f3b..0abee9f 100644 --- a/content/browser/gpu/gpu_process_host_ui_shim.cc +++ b/content/browser/gpu/gpu_process_host_ui_shim.cc @@ -4,6 +4,8 @@ #include "content/browser/gpu/gpu_process_host_ui_shim.h" +#include <algorithm> + #include "base/id_map.h" #include "base/process_util.h" #include "base/debug/trace_event.h" @@ -194,11 +196,13 @@ void GpuProcessHostUIShim::OnResizeView(int32 renderer_id, XSync(display, False); } #elif defined(OS_WIN) + // Ensure window does not have zero area because D3D cannot create a zero + // area swap chain. SetWindowPos(handle, NULL, 0, 0, - size.width(), - size.height(), + std::max(1, size.width()), + std::max(1, size.height()), SWP_NOSENDCHANGING | SWP_NOCOPYBITS | SWP_NOZORDER | SWP_NOACTIVATE | SWP_DEFERERASE); #endif |