aura: Work around race condition in ui::Compositor::SetScaleAndSize
The aura::Window LocalSurfaceId is updated after device scale factor change via - aura::Window::OnDeviceScaleFactorChanged, which is called by - ui::Layer::OnDeviceScaleFactorChanged, which is called by - ui::Compositor::SetScaleAndSize But ui::Compositor::SetScaleAndSize takes the aura::Window's LocalSurfaceId as a parameter. This means that ui::Compositor::SetScaleAndSize's LocalSurfaceId argument will be incorrect any time that the DeviceScaleFactor changes. Note that the way that aura::Window updates its LocalSurfaceId for bounds' changes is different. It does not implicitly update the bounds of its root layer, rather, it requires that the root layer's bounds be updated before calling ui::Compositor::SetScaleAndSize. Add a function aura::Window::SetDeviceScaleFactor, to match aura::Window::SetBounds, which will update the layer's properties and cause the generation of a new LocalSurfaceId. Make this call in WindowTreeHost::UpdateRootWindowSizeInPixels (next to the corresponding call to aura::Window::SetBounds). Bug: 818085 Change-Id: I929a6e641aa3aa1253e99647ce3bfe05ca7c482a Reviewed-on: https://chromium-review.googlesource.com/961450 Commit-Queue: ccameron <ccameron@chromium.org> Reviewed-by:Fady Samuel <fsamuel@chromium.org> Cr-Commit-Position: refs/heads/master@{#542948}
Showing
Please register or sign in to comment