Commit 8d952da6 authored by Yuki Awano's avatar Yuki Awano Committed by Commit Bot

Use active window to calculate ax bounds

- Initially ExoShellSurface has both focus and active state. But when
  user clicks something on Android window, ExoSurface becomes focused.
  We need to use ExoShellSurface to get the widget. This CL changes it
  to use active window instead of focused one.

  click maximize button. Confirm that Chrome doesn't crash.

Bug: 867199
Test: Enable S2S and open Play Store app. Focus on the search box and
Change-Id: I74e363e2ee91986966a97a12f7cdb5399721f6cf
Reviewed-on: https://chromium-review.googlesource.com/1183046Reviewed-by: default avatarDavid Tseng <dtseng@chromium.org>
Commit-Queue: Yuki Awano <yawano@chromium.org>
Cr-Commit-Position: refs/heads/master@{#584919}
parent 54d4a765
...@@ -450,9 +450,9 @@ void AXTreeSourceArc::SerializeNode(AXNodeInfoData* node, ...@@ -450,9 +450,9 @@ void AXTreeSourceArc::SerializeNode(AXNodeInfoData* node,
// - Root node must exist. // - Root node must exist.
// - Window where this tree is attached to need to be focused. // - Window where this tree is attached to need to be focused.
if (root_id_ != -1 && wm_helper) { if (root_id_ != -1 && wm_helper) {
aura::Window* focused_window = aura::Window* active_window =
is_notification_ ? nullptr : wm_helper->GetFocusedWindow(); is_notification_ ? nullptr : wm_helper->GetActiveWindow();
const gfx::Rect& local_bounds = GetBounds(node, focused_window); const gfx::Rect& local_bounds = GetBounds(node, active_window);
out_data->location.SetRect(local_bounds.x(), local_bounds.y(), out_data->location.SetRect(local_bounds.x(), local_bounds.y(),
local_bounds.width(), local_bounds.height()); local_bounds.width(), local_bounds.height());
} }
...@@ -504,18 +504,18 @@ void AXTreeSourceArc::SerializeNode(AXNodeInfoData* node, ...@@ -504,18 +504,18 @@ void AXTreeSourceArc::SerializeNode(AXNodeInfoData* node,
} }
const gfx::Rect AXTreeSourceArc::GetBounds(AXNodeInfoData* node, const gfx::Rect AXTreeSourceArc::GetBounds(AXNodeInfoData* node,
aura::Window* focused_window) const { aura::Window* active_window) const {
DCHECK_NE(root_id_, -1); DCHECK_NE(root_id_, -1);
gfx::Rect node_bounds = node->bounds_in_screen; gfx::Rect node_bounds = node->bounds_in_screen;
if (focused_window && node->id == root_id_) { if (active_window && node->id == root_id_) {
// Top level window returns its bounds in dip. // Top level window returns its bounds in dip.
aura::Window* toplevel_window = focused_window->GetToplevelWindow(); aura::Window* toplevel_window = active_window->GetToplevelWindow();
float scale = toplevel_window->layer()->device_scale_factor(); float scale = toplevel_window->layer()->device_scale_factor();
views::Widget* widget = views::Widget* widget =
views::Widget::GetWidgetForNativeView(focused_window); views::Widget::GetWidgetForNativeView(active_window);
DCHECK(widget); DCHECK(widget);
DCHECK(widget->widget_delegate()); DCHECK(widget->widget_delegate());
DCHECK(widget->widget_delegate()->GetContentsView()); DCHECK(widget->widget_delegate()->GetContentsView());
......
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