Commit eba62fae authored by Yuki Awano's avatar Yuki Awano Committed by Commit Bot

Consider caption bar if window is maximized with a11y node bounds

- When window is maximized, Android content is rendered without
  considering caption bar. We need to adjust accessibility node bounds
  to consider it.

      window in maximized state. Confirm that accessibility focus rect
      is shown in the right place.

Bug: 850427
Test: Enable chrome caption bar and spoken feedback. Open any Android
Change-Id: I82a6020135623d73f0f5905ef49ce44328470108
Reviewed-on: https://chromium-review.googlesource.com/1090598Reviewed-by: default avatarMitsuru Oshima <oshima@chromium.org>
Commit-Queue: Yuki Awano <yawano@chromium.org>
Cr-Commit-Position: refs/heads/master@{#566681}
parent 158724ba
...@@ -532,12 +532,24 @@ const gfx::Rect AXTreeSourceArc::GetBounds(AXNodeInfoData* node, ...@@ -532,12 +532,24 @@ const gfx::Rect AXTreeSourceArc::GetBounds(AXNodeInfoData* node,
aura::Window* toplevel_window = focused_window->GetToplevelWindow(); aura::Window* toplevel_window = focused_window->GetToplevelWindow();
float scale = toplevel_window->layer()->device_scale_factor(); float scale = toplevel_window->layer()->device_scale_factor();
// When window is maximized, Android content is rendered without considering
// caption bar. When window is not maximized, Android content is rendered
// with considering caption bar. We need to do nothing for the later case.
int caption_bar_offset = 0;
views::Widget* widget =
views::Widget::GetTopLevelWidgetForNativeView(toplevel_window);
if (widget->IsMaximized()) {
caption_bar_offset =
widget->non_client_view()->frame_view()->GetBoundsForClientView().y();
}
// Bounds of root node is relative to its container, i.e. focused window. // Bounds of root node is relative to its container, i.e. focused window.
node_bounds.Offset( node_bounds.Offset(
static_cast<int>(-1.0f * scale * static_cast<int>(-1.0f * scale *
static_cast<float>(toplevel_window->bounds().x())), static_cast<float>(toplevel_window->bounds().x())),
static_cast<int>(-1.0f * scale * static_cast<int>(-1.0f * scale *
static_cast<float>(toplevel_window->bounds().y()))); static_cast<float>(toplevel_window->bounds().y()) +
scale * static_cast<float>(caption_bar_offset)));
return node_bounds; return node_bounds;
} }
......
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