Clarify expectations for CefRenderHandler::GetViewRect (issue #1910)

This commit is contained in:
Marshall Greenblatt
2018-09-25 15:40:02 +02:00
parent 64cd460c73
commit 09afa3a843
17 changed files with 100 additions and 99 deletions

View File

@@ -1348,13 +1348,18 @@ bool BrowserWindowOsrMac::GetRootScreenRect(CefRefPtr<CefBrowser> browser,
return false;
}
bool BrowserWindowOsrMac::GetViewRect(CefRefPtr<CefBrowser> browser,
void BrowserWindowOsrMac::GetViewRect(CefRefPtr<CefBrowser> browser,
CefRect& rect) {
CEF_REQUIRE_UI_THREAD();
REQUIRE_MAIN_THREAD();
if (!nsview_)
return false;
rect.x = rect.y = 0;
if (!nsview_) {
// Never return an empty rectangle.
rect.width = rect.height = 1;
return;
}
const float device_scale_factor = [GLView(nsview_) getDeviceScaleFactor];
@@ -1365,11 +1370,8 @@ bool BrowserWindowOsrMac::GetViewRect(CefRefPtr<CefBrowser> browser,
bounds = [GLView(nsview_) convertRectToBackingInternal:bounds];
// Convert to browser view coordinates.
rect.x = rect.y = 0;
rect.width = DeviceToLogical(bounds.size.width, device_scale_factor);
rect.height = DeviceToLogical(bounds.size.height, device_scale_factor);
return true;
}
bool BrowserWindowOsrMac::GetScreenPoint(CefRefPtr<CefBrowser> browser,