Fix crash due to CefRenderHandler::GetViewRect returning 0 size for popup windows (issue #1910)

This commit is contained in:
Marshall Greenblatt 2018-09-26 15:09:46 +02:00
parent 1e6b870af0
commit e6a3a5b72d
3 changed files with 13 additions and 0 deletions

View File

@ -1143,8 +1143,12 @@ void BrowserWindowOsrGtk::GetViewRect(CefRefPtr<CefBrowser> browser,
// The simulated screen and view rectangle are the same. This is necessary // The simulated screen and view rectangle are the same. This is necessary
// for popup menus to be located and sized inside the view. // for popup menus to be located and sized inside the view.
rect.width = DeviceToLogical(glarea_->allocation.width, device_scale_factor); rect.width = DeviceToLogical(glarea_->allocation.width, device_scale_factor);
if (rect.width == 0)
rect.width = 1;
rect.height = rect.height =
DeviceToLogical(glarea_->allocation.height, device_scale_factor); DeviceToLogical(glarea_->allocation.height, device_scale_factor);
if (rect.height == 0)
rect.height = 1;
} }
bool BrowserWindowOsrGtk::GetScreenPoint(CefRefPtr<CefBrowser> browser, bool BrowserWindowOsrGtk::GetScreenPoint(CefRefPtr<CefBrowser> browser,

View File

@ -1371,7 +1371,11 @@ void BrowserWindowOsrMac::GetViewRect(CefRefPtr<CefBrowser> browser,
// Convert to browser view coordinates. // Convert to browser view coordinates.
rect.width = DeviceToLogical(bounds.size.width, device_scale_factor); rect.width = DeviceToLogical(bounds.size.width, device_scale_factor);
if (rect.width == 0)
rect.width = 1;
rect.height = DeviceToLogical(bounds.size.height, device_scale_factor); rect.height = DeviceToLogical(bounds.size.height, device_scale_factor);
if (rect.height == 0)
rect.height = 1;
} }
bool BrowserWindowOsrMac::GetScreenPoint(CefRefPtr<CefBrowser> browser, bool BrowserWindowOsrMac::GetScreenPoint(CefRefPtr<CefBrowser> browser,

View File

@ -47,6 +47,7 @@ OsrWindowWin::OsrWindowWin(Delegate* delegate,
last_click_time_(0), last_click_time_(0),
last_mouse_down_on_view_(false) { last_mouse_down_on_view_(false) {
DCHECK(delegate_); DCHECK(delegate_);
client_rect_ = {0};
} }
OsrWindowWin::~OsrWindowWin() { OsrWindowWin::~OsrWindowWin() {
@ -783,8 +784,12 @@ void OsrWindowWin::GetViewRect(CefRefPtr<CefBrowser> browser, CefRect& rect) {
rect.x = rect.y = 0; rect.x = rect.y = 0;
rect.width = DeviceToLogical(client_rect_.right - client_rect_.left, rect.width = DeviceToLogical(client_rect_.right - client_rect_.left,
device_scale_factor_); device_scale_factor_);
if (rect.width == 0)
rect.width = 1;
rect.height = DeviceToLogical(client_rect_.bottom - client_rect_.top, rect.height = DeviceToLogical(client_rect_.bottom - client_rect_.top,
device_scale_factor_); device_scale_factor_);
if (rect.height == 0)
rect.height = 1;
} }
bool OsrWindowWin::GetScreenPoint(CefRefPtr<CefBrowser> browser, bool OsrWindowWin::GetScreenPoint(CefRefPtr<CefBrowser> browser,