mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-02-09 16:48:49 +01:00
Fix OSR resize issue when multiple monitors have different scale factors (fixes issue #3240)
This commit is contained in:
parent
031c8a7f52
commit
9e416a7921
@ -1467,8 +1467,13 @@ void CefRenderWidgetHostViewOSR::OnPaint(const gfx::Rect& damage_rect,
|
|||||||
rcList, pixels, pixel_size.width(), pixel_size.height());
|
rcList, pixels, pixel_size.width(), pixel_size.height());
|
||||||
|
|
||||||
// Release the resize hold when we reach the desired size.
|
// Release the resize hold when we reach the desired size.
|
||||||
if (hold_resize_ && pixel_size == SizeInPixels())
|
if (hold_resize_) {
|
||||||
ReleaseResizeHold();
|
DCHECK_GT(cached_scale_factor_, 0);
|
||||||
|
gfx::Size expected_size =
|
||||||
|
gfx::ScaleToCeiledSize(GetViewBounds().size(), cached_scale_factor_);
|
||||||
|
if (pixel_size == expected_size)
|
||||||
|
ReleaseResizeHold();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ui::Layer* CefRenderWidgetHostViewOSR::GetRootLayer() const {
|
ui::Layer* CefRenderWidgetHostViewOSR::GetRootLayer() const {
|
||||||
@ -1573,6 +1578,7 @@ bool CefRenderWidgetHostViewOSR::ResizeRootLayer() {
|
|||||||
// The size has changed. Avoid resizing again until ReleaseResizeHold() is
|
// The size has changed. Avoid resizing again until ReleaseResizeHold() is
|
||||||
// called.
|
// called.
|
||||||
hold_resize_ = true;
|
hold_resize_ = true;
|
||||||
|
cached_scale_factor_ = GetCurrentDeviceScaleFactor();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
} else if (!pending_resize_) {
|
} else if (!pending_resize_) {
|
||||||
@ -1586,6 +1592,7 @@ bool CefRenderWidgetHostViewOSR::ResizeRootLayer() {
|
|||||||
void CefRenderWidgetHostViewOSR::ReleaseResizeHold() {
|
void CefRenderWidgetHostViewOSR::ReleaseResizeHold() {
|
||||||
DCHECK(hold_resize_);
|
DCHECK(hold_resize_);
|
||||||
hold_resize_ = false;
|
hold_resize_ = false;
|
||||||
|
cached_scale_factor_ = -1;
|
||||||
if (pending_resize_) {
|
if (pending_resize_) {
|
||||||
pending_resize_ = false;
|
pending_resize_ = false;
|
||||||
CEF_POST_TASK(CEF_UIT,
|
CEF_POST_TASK(CEF_UIT,
|
||||||
|
@ -375,6 +375,8 @@ class CefRenderWidgetHostViewOSR
|
|||||||
bool hold_resize_ = false;
|
bool hold_resize_ = false;
|
||||||
bool pending_resize_ = false;
|
bool pending_resize_ = false;
|
||||||
|
|
||||||
|
float cached_scale_factor_ = 0.0f;
|
||||||
|
|
||||||
// The associated Model. While |this| is being Destroyed,
|
// The associated Model. While |this| is being Destroyed,
|
||||||
// |render_widget_host_| is NULL and the message loop is run one last time
|
// |render_widget_host_| is NULL and the message loop is run one last time
|
||||||
// Message handlers must check for a NULL |render_widget_host_|.
|
// Message handlers must check for a NULL |render_widget_host_|.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user