Skip to content

Commit fa28608

Browse files
committed
Fixes 2 minor code issues
Removed unused variables and also set width/height when x/y < 0 in GetPopupRectInWebView
1 parent 3b30ecc commit fa28608

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

obs-browser/browser-render-handler.cpp

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,15 @@ CefRect BrowserRenderHandler::GetPopupRectInWebView(const CefRect& originalRect)
8484
rc.y = height - rc.height;
8585
// if x or y became negative, move them to 0 again.
8686
if (rc.x < 0)
87+
{
8788
rc.x = 0;
89+
rc.width = width;
90+
}
8891
if (rc.y < 0)
92+
{
8993
rc.y = 0;
94+
rc.height = height;
95+
}
9096
return rc;
9197
}
9298

@@ -124,22 +130,17 @@ void BrowserRenderHandler::OnPaint(CefRefPtr<CefBrowser> browser,
124130
else if (type == PET_POPUP && popupRect.width > 0 &&
125131
popupRect.height > 0)
126132
{
127-
int skipPixels = 0, x = popupRect.x;
128-
int skipRows = 0, y = popupRect.y;
133+
int x = popupRect.x;
134+
int y = popupRect.y;
129135
int w = width;
130136
int h = height;
131137

132138
if (x < 0)
133-
{
134-
skipPixels = -x;
135139
x = 0;
136-
}
137140

138141
if (y < 0)
139-
{
140-
skipRows = -y;
141142
y = 0;
142-
}
143+
143144
if (x + w > viewWidth)
144145
w -= x + w - viewWidth;
145146
if (y + h > viewHeight)

0 commit comments

Comments
 (0)