Commit a57b188b authored by Katie D's avatar Katie D Committed by Commit Bot

Fixes padding between autoclick scroll bubble and menu bubble.

Padding between the two bubbles should be 8dips, but it was 16dips.
This removes insets above both bubbles so as not to clip the shadow,
and ensures layout still occurs at the right place on the screen.

four corners of the screen.

Test: Chrome OS on Linux, with and without docked magnifier, all
Bug: 947068
Change-Id: Ia8f6d14d1a6036f743e57077b6bda41523229cc5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1660715
Commit-Queue: Katie Dektar <katie@chromium.org>
Reviewed-by: default avatarTetsui Ohkubo <tetsui@chromium.org>
Cr-Commit-Position: refs/heads/master@{#669709}
parent d1f094d1
......@@ -145,13 +145,21 @@ void AutoclickMenuBubbleController::SetPosition(
width, kAutoclickMenuHeight);
break;
case mojom::AutoclickMenuPosition::kTopLeft:
// Setting the top to 1 instead of 0 so that the view is drawn on screen.
new_bounds = gfx::Rect(work_area.x(), 1, width, kAutoclickMenuHeight);
// Because there is no inset at the top of the widget, add
// 2 * kCollisionWindowWorkAreaInsetsDp to the top of the work area.
// to ensure correct padding.
new_bounds = gfx::Rect(
work_area.x(), work_area.y() + 2 * kCollisionWindowWorkAreaInsetsDp,
width, kAutoclickMenuHeight);
break;
case mojom::AutoclickMenuPosition::kTopRight:
// Setting the top to 1 instead of 0 so that the view is drawn on screen.
// Because there is no inset at the top of the widget, add
// 2 * kCollisionWindowWorkAreaInsetsDp to the top of the work area.
// to ensure correct padding.
new_bounds =
gfx::Rect(work_area.right() - width, 1, width, kAutoclickMenuHeight);
gfx::Rect(work_area.right() - width,
work_area.y() + 2 * kCollisionWindowWorkAreaInsetsDp, width,
kAutoclickMenuHeight);
break;
case mojom::AutoclickMenuPosition::kSystemDefault:
return;
......@@ -200,7 +208,14 @@ void AutoclickMenuBubbleController::ShowBubble(
init_params.parent_window = Shell::GetContainer(
Shell::GetPrimaryRootWindow(), kShellWindowId_AutoclickContainer);
init_params.anchor_mode = TrayBubbleView::AnchorMode::kRect;
init_params.insets = gfx::Insets(kCollisionWindowWorkAreaInsetsDp);
// The widget's shadow is drawn below and on the sides of the view, with a
// width of kCollisionWindowWorkAreaInsetsDp. Set the top inset to 0 to ensure
// the scroll view is drawn at kCollisionWindowWorkAreaInsetsDp above the
// bubble menu when the position is at the bottom of the screen. The space
// between the bubbles belongs to the scroll view bubble's shadow.
init_params.insets = gfx::Insets(0, kCollisionWindowWorkAreaInsetsDp,
kCollisionWindowWorkAreaInsetsDp,
kCollisionWindowWorkAreaInsetsDp);
int width = base::CommandLine::ForCurrentProcess()->HasSwitch(
switches::kEnableExperimentalAccessibilityAutoclick)
? kAutoclickMenuWidthWithScroll
......
......@@ -55,8 +55,12 @@ void AutoclickScrollBubbleController::ShowBubble(
Shell::GetPrimaryRootWindow(), kShellWindowId_AutoclickContainer);
init_params.anchor_mode = TrayBubbleView::AnchorMode::kRect;
init_params.anchor_rect = anchor_rect;
init_params.insets = gfx::Insets(kUnifiedMenuPadding, kUnifiedMenuPadding,
kUnifiedMenuPadding, kUnifiedMenuPadding);
// The widget's shadow is drawn below and on the sides of the scroll view.
// Do not inset the top, so that when the scroll bubble is shown below the
// menu bubble it lays out directly below the menu bubble's shadow, at a
// height of kUnifiedMenuPadding.
init_params.insets = gfx::Insets(0, kUnifiedMenuPadding, kUnifiedMenuPadding,
kUnifiedMenuPadding);
init_params.min_width = kAutoclickScrollMenuSizeDips;
init_params.max_width = kAutoclickScrollMenuSizeDips;
init_params.max_height = kAutoclickScrollMenuSizeDips;
......
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