Fix for out-of-sync scale factor issue
- Set active root window early when creating browsers on startup. - Send screen info when device scale factor chagned. - gfx::Screen::GetDisplayNearestWindow should return Primary when the window's root doesn't exist. I missed this condition in https://chromiumcodereview.appspot.com/10961021 BUG=155201, 152728 TEST=manual: see bug for repro steps Review URL: https://chromiumcodereview.appspot.com/11066130 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@161758 0039d316-1c4b-4281-b951-d872f2087c98
This commit is contained in:
ash/display
chrome/browser/ui/startup
content/browser/renderer_host
@ -307,7 +307,9 @@ const gfx::Display& MultiDisplayManager::GetDisplayNearestWindow(
|
||||
return DisplayController::GetPrimaryDisplay();
|
||||
const RootWindow* root = window->GetRootWindow();
|
||||
MultiDisplayManager* manager = const_cast<MultiDisplayManager*>(this);
|
||||
return root ? manager->FindDisplayForRootWindow(root) : GetInvalidDisplay();
|
||||
return root ?
|
||||
manager->FindDisplayForRootWindow(root) :
|
||||
DisplayController::GetPrimaryDisplay();
|
||||
}
|
||||
|
||||
const gfx::Display& MultiDisplayManager::GetDisplayNearestPoint(
|
||||
|
@ -95,6 +95,8 @@
|
||||
|
||||
#if defined(USE_ASH)
|
||||
#include "ash/launcher/launcher_types.h"
|
||||
#include "ash/shell.h"
|
||||
#include "ui/aura/window.h"
|
||||
#endif
|
||||
|
||||
#if defined(OS_MACOSX)
|
||||
@ -796,6 +798,18 @@ Browser* StartupBrowserCreatorImpl::OpenTabsInBrowser(Browser* browser,
|
||||
#endif
|
||||
}
|
||||
|
||||
#if defined(USE_ASH)
|
||||
// Set the browser's root window to be an active root window now so
|
||||
// that that web contents can determine correct scale factor for the
|
||||
// renderer. This is a short term fix for crbug.com/155201. Without
|
||||
// this, the renderer may use wrong scale factor first, then
|
||||
// switched to the correct scale factor, which can cause race
|
||||
// condition and lead to the results rendered at wrong scale factor.
|
||||
// Long term fix is tracked in crbug.com/15543.
|
||||
ash::Shell::GetInstance()->set_active_root_window(
|
||||
browser->window()->GetNativeWindow()->GetRootWindow());
|
||||
#endif
|
||||
|
||||
// In kiosk mode, we want to always be fullscreen, so switch to that now.
|
||||
if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kKioskMode))
|
||||
chrome::ToggleFullscreenMode(browser);
|
||||
|
@ -1101,6 +1101,11 @@ void RenderWidgetHostImpl::NotifyScreenInfoChanged() {
|
||||
}
|
||||
|
||||
void RenderWidgetHostImpl::SetDeviceScaleFactor(float scale) {
|
||||
// Send secreen info as well because JavaScript API |window.open|
|
||||
// uses screen info to determine the scale factor (crbug.com/155201).
|
||||
// TODO(oshima|thakis): Consolidate SetDeviceScaleFactor and
|
||||
// ScreenInfoChanged. crbug.com/155213.
|
||||
NotifyScreenInfoChanged();
|
||||
Send(new ViewMsg_SetDeviceScaleFactor(GetRoutingID(), scale));
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user