Consider scale factor changes to OSR browsers when switching monitors (issue #1774)

This commit is contained in:
Marshall Greenblatt 2015-12-03 15:22:44 -05:00
parent 667f0edcf4
commit 06e1a34850
2 changed files with 17 additions and 1 deletions

View File

@ -1345,7 +1345,10 @@ void CefRenderWidgetHostViewOSR::SetDeviceScaleFactor() {
void CefRenderWidgetHostViewOSR::ResizeRootLayer() {
SetFrameRate();
const float orgScaleFactor = scale_factor_;
SetDeviceScaleFactor();
const bool scaleFactorDidChange = (orgScaleFactor != scale_factor_);
gfx::Size size;
if (!IsPopupWidget())
@ -1353,7 +1356,7 @@ void CefRenderWidgetHostViewOSR::ResizeRootLayer() {
else
size = popup_position_.size();
if (size == root_layer_->bounds().size())
if (!scaleFactorDidChange && size == root_layer_->bounds().size())
return;
const gfx::Size& size_in_pixels =

View File

@ -1099,6 +1099,19 @@ BrowserOpenGLView* GLView(NSView* view) {
return device_scale_factor_;
}
- (void)viewDidChangeBackingProperties {
const CGFloat device_scale_factor = [self getDeviceScaleFactor];
if (device_scale_factor == device_scale_factor_)
return;
CefRefPtr<CefBrowser> browser = [self getBrowser];
if (browser) {
browser->GetHost()->NotifyScreenInfoChanged();
browser->GetHost()->WasResized();
}
}
- (bool)isOverPopupWidgetX:(int)x andY:(int)y {
CefRect rc = renderer_->popup_rect();
int popup_right = rc.x + rc.width;