Commit bd4e1c48 authored by Mohsen Izadi's avatar Mohsen Izadi Committed by Commit Bot

Move docked magnifier out of magnified contents

Currently, docked magnifier container is nested inside containers that
have contents to be magnified, essentially creating a cycle (magnifier
magnifying itself). Since docked magnifier uses ui::Reflector, it is not
an issue because ui::Reflector is one frame behind, magnifying the
previous frame. However, ui::Refelctor does not work with out-of-process
display compositor (OOP-D).

Our solution to the OOP-D case is to update generated compositor frame
to create a RenderPass for the magnified content and refer to that
RenderPass twice in the compositor frame: once where the content should
appear normally, and once inside the magnified viewport. This way the
magnifier is not one frame behind anymore, however, we need to break the
cycle mentioned above. To remove the cycle, this CL creates a container
for the magnified content (called MagnifiedContainer) and makes the
DockedMagnifierContainer a sibling of this new container.

BUG=947565

Change-Id: Id8d685f90667eac0302b788ffc6d17d02fb79435
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1628909Reviewed-by: default avatarScott Violet <sky@chromium.org>
Reviewed-by: default avatarAhmed Fakhry <afakhry@chromium.org>
Commit-Queue: Mohsen Izadi <mohsen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#664302}
parent e0344f61
......@@ -21,6 +21,13 @@ enum ShellWindowId {
// for screen rotation animation.
kShellWindowId_ScreenRotationContainer = 0,
// The magnified container which contains everything that would be magnified
// when docked magnifier is enabled.
kShellWindowId_MagnifiedContainer,
// The container for the Docked Magnifier viewport widget and the separator.
kShellWindowId_DockedMagnifierContainer,
// A higher-level container that holds all of the containers stacked below
// kShellWindowId_LockScreenContainer. Only used by PowerButtonController for
// animating lower-level containers.
......@@ -35,9 +42,8 @@ enum ShellWindowId {
// lock-screen-related windows (which are displayed regardless of the screen
// lock state, effectively containers stacked above
// kShellWindowId_LockSystemModalContainer). Used by the shelf, status area,
// virtual keyboard, settings bubble, menus, Docked Magnifier viewport, etc.
// Also used by the PowerButtonController for animating lower-level
// containers.
// virtual keyboard, settings bubble, menus, etc. Also used by the
// PowerButtonController for animating lower-level containers.
kShellWindowId_LockScreenRelatedContainersContainer,
// A container used for windows of WINDOW_TYPE_CONTROL that have no parent.
......@@ -151,9 +157,6 @@ enum ShellWindowId {
// region selector for partial screenshots.
kShellWindowId_OverlayContainer,
// The container for the Docked Magnifier viewport widget and the separator.
kShellWindowId_DockedMagnifierContainer,
// The container for mouse cursor.
kShellWindowId_MouseCursorContainer,
......
......@@ -908,11 +908,21 @@ void RootWindowController::CreateContainers() {
aura::Window* screen_rotation_container = CreateContainer(
kShellWindowId_ScreenRotationContainer, "ScreenRotationContainer", root);
// Everything that needs to be included in the docked magnifier, when enabled,
// should be a descendant of MagnifiedContainer. The DockedMagnifierContainer
// should not be a descendant of this container, otherwise there would be a
// cycle (docked magnifier trying to magnify itself).
aura::Window* magnified_container =
CreateContainer(kShellWindowId_MagnifiedContainer, "MagnifiedContainer",
screen_rotation_container);
CreateContainer(kShellWindowId_DockedMagnifierContainer,
"DockedMagnifierContainer", screen_rotation_container);
// These containers are just used by PowerButtonController to animate groups
// of containers simultaneously without messing up the current transformations
// on those containers. These are direct children of the
// screen_rotation_container window; all of the other containers are their
// children.
// on those containers. These are direct children of the magnified_container
// window; all of the other containers are their children.
// The wallpaper container is not part of the lock animation, so it is not
// included in those animate groups. When the screen is locked, the wallpaper
......@@ -920,27 +930,27 @@ void RootWindowController::CreateContainers() {
// Ensure that there's an opaque layer occluding the non-lock-screen layers.
aura::Window* wallpaper_container =
CreateContainer(kShellWindowId_WallpaperContainer, "WallpaperContainer",
screen_rotation_container);
magnified_container);
::wm::SetChildWindowVisibilityChangesAnimated(wallpaper_container);
aura::Window* non_lock_screen_containers = CreateContainer(
kShellWindowId_NonLockScreenContainersContainer,
"NonLockScreenContainersContainer", screen_rotation_container);
aura::Window* non_lock_screen_containers =
CreateContainer(kShellWindowId_NonLockScreenContainersContainer,
"NonLockScreenContainersContainer", magnified_container);
// Clip all windows inside this container, as half pixel of the window's
// texture may become visible when the screen is scaled. crbug.com/368591.
non_lock_screen_containers->layer()->SetMasksToBounds(true);
aura::Window* lock_wallpaper_containers = CreateContainer(
kShellWindowId_LockScreenWallpaperContainer,
"LockScreenWallpaperContainer", screen_rotation_container);
aura::Window* lock_wallpaper_containers =
CreateContainer(kShellWindowId_LockScreenWallpaperContainer,
"LockScreenWallpaperContainer", magnified_container);
::wm::SetChildWindowVisibilityChangesAnimated(lock_wallpaper_containers);
aura::Window* lock_screen_containers = CreateContainer(
kShellWindowId_LockScreenContainersContainer,
"LockScreenContainersContainer", screen_rotation_container);
aura::Window* lock_screen_containers =
CreateContainer(kShellWindowId_LockScreenContainersContainer,
"LockScreenContainersContainer", magnified_container);
aura::Window* lock_screen_related_containers = CreateContainer(
kShellWindowId_LockScreenRelatedContainersContainer,
"LockScreenRelatedContainersContainer", screen_rotation_container);
"LockScreenRelatedContainersContainer", magnified_container);
aura::Window* app_list_tablet_mode_container =
CreateContainer(kShellWindowId_HomeScreenContainer, "HomeScreenContainer",
......@@ -1119,19 +1129,16 @@ void RootWindowController::CreateContainers() {
overlay_container->SetLayoutManager(
new OverlayLayoutManager(overlay_container)); // Takes ownership.
CreateContainer(kShellWindowId_DockedMagnifierContainer,
"DockedMagnifierContainer", lock_screen_related_containers);
aura::Window* mouse_cursor_container =
CreateContainer(kShellWindowId_MouseCursorContainer,
"MouseCursorContainer", screen_rotation_container);
"MouseCursorContainer", magnified_container);
mouse_cursor_container->SetProperty(::wm::kUsesScreenCoordinatesKey, true);
CreateContainer(kShellWindowId_AlwaysOnTopWallpaperContainer,
"AlwaysOnTopWallpaperContainer", screen_rotation_container);
"AlwaysOnTopWallpaperContainer", magnified_container);
CreateContainer(kShellWindowId_PowerButtonAnimationContainer,
"PowerButtonAnimationContainer", screen_rotation_container);
"PowerButtonAnimationContainer", magnified_container);
}
void RootWindowController::CreateSystemWallpaper(
......
......@@ -12,16 +12,16 @@ namespace ash {
namespace {
// Resize all container windows that RootWindowLayoutManager is responsible for.
// That includes all container windows up to three depth except that top level
// window which has a delegate. We cannot simply check top level window, because
// we need to skip other windows without a delegate, such as ScreenDimmer
// windows.
// That includes all container windows up to depth four except the top level
// windows which have a delegate. We cannot simply check top level windows,
// because we need to skip other windows without a delegate, such as
// ScreenDimmer windows.
// TODO(wutao): The above logic is error prone. Consider using a Shell window id
// to indentify such a container.
void ResizeWindow(const aura::Window::Windows& children,
const gfx::Rect& fullscreen_bounds,
int depth) {
if (depth > 2)
if (depth > 3)
return;
const int child_depth = depth + 1;
aura::WindowTracker children_tracker(children);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment