Skip to content

Commit 23a7249

Browse files
committed
RenderClientAdapter - Update GetViewRect to default to using width/height as 1 instead of 0 as CEF doesn't like 0
cefclient performs the same checks
1 parent ec527c1 commit 23a7249

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

CefSharp.Core/Internals/RenderClientAdapter.h

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,13 +95,26 @@ namespace CefSharp
9595
{
9696
if ((IRenderWebBrowser^)_renderWebBrowser == nullptr)
9797
{
98-
rect = CefRect(0, 0, 0, 0);
98+
//CEF doesn't like a 0 width or 0 height, cefclient
99+
//defaults these to 1, so we'll do the same
100+
rect = CefRect(0, 0, 1, 1);
99101
}
100102
else
101103
{
102104
auto viewRect = _renderWebBrowser->GetViewRect();
103105

104106
rect = CefRect(viewRect.X, viewRect.Y, viewRect.Width, viewRect.Height);
107+
108+
//Cefclient defaults these to 1 instead of 0, we'll do the same
109+
if (rect.height == 0)
110+
{
111+
rect.height = 1;
112+
}
113+
114+
if (rect.width == 0)
115+
{
116+
rect.width = 1;
117+
}
105118
}
106119
};
107120

0 commit comments

Comments
 (0)