Fix crash due to CefRenderHandler::GetViewRect returning 0 size for popup windows (issue #1910)
This commit is contained in:
parent
1e6b870af0
commit
e6a3a5b72d
|
@ -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,
|
||||||
|
|
|
@ -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,
|
||||||
|
|
|
@ -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,
|
||||||
|
|
Loading…
Reference in New Issue