Consider scale factor changes to OSR browsers when switching monitors (issue #1774)
This commit is contained in:
parent
667f0edcf4
commit
06e1a34850
|
@ -1345,7 +1345,10 @@ void CefRenderWidgetHostViewOSR::SetDeviceScaleFactor() {
|
||||||
|
|
||||||
void CefRenderWidgetHostViewOSR::ResizeRootLayer() {
|
void CefRenderWidgetHostViewOSR::ResizeRootLayer() {
|
||||||
SetFrameRate();
|
SetFrameRate();
|
||||||
|
|
||||||
|
const float orgScaleFactor = scale_factor_;
|
||||||
SetDeviceScaleFactor();
|
SetDeviceScaleFactor();
|
||||||
|
const bool scaleFactorDidChange = (orgScaleFactor != scale_factor_);
|
||||||
|
|
||||||
gfx::Size size;
|
gfx::Size size;
|
||||||
if (!IsPopupWidget())
|
if (!IsPopupWidget())
|
||||||
|
@ -1353,7 +1356,7 @@ void CefRenderWidgetHostViewOSR::ResizeRootLayer() {
|
||||||
else
|
else
|
||||||
size = popup_position_.size();
|
size = popup_position_.size();
|
||||||
|
|
||||||
if (size == root_layer_->bounds().size())
|
if (!scaleFactorDidChange && size == root_layer_->bounds().size())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const gfx::Size& size_in_pixels =
|
const gfx::Size& size_in_pixels =
|
||||||
|
|
|
@ -1099,6 +1099,19 @@ BrowserOpenGLView* GLView(NSView* view) {
|
||||||
return device_scale_factor_;
|
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 {
|
- (bool)isOverPopupWidgetX:(int)x andY:(int)y {
|
||||||
CefRect rc = renderer_->popup_rect();
|
CefRect rc = renderer_->popup_rect();
|
||||||
int popup_right = rc.x + rc.width;
|
int popup_right = rc.x + rc.width;
|
||||||
|
|
Loading…
Reference in New Issue