Chromium Code Reviews| Index: components/exo/shell_surface.cc |
| diff --git a/components/exo/shell_surface.cc b/components/exo/shell_surface.cc |
| index 7fe884ddec4f26815a3096cd588f82293181620f..cdaa5e4ff4523a3f8a8eb867b2989e9a8b681d55 100644 |
| --- a/components/exo/shell_surface.cc |
| +++ b/components/exo/shell_surface.cc |
| @@ -103,17 +103,22 @@ class CustomWindowTargeter : public aura::WindowTargeter { |
| if (component != HTNOWHERE && component != HTCLIENT) |
| return true; |
| - // If there is an underlay, test against it's bounds instead since it will |
| - // be equal or larger than the surface's bounds. |
| + // If there is an underlay, test against it first as it's bounds may be |
| + // larger than the surface's bounds. |
| aura::Window* shadow_underlay = |
| static_cast<ShellSurface*>( |
| widget_->widget_delegate()->GetContentsView()) |
| ->shadow_underlay(); |
| if (shadow_underlay) { |
| - aura::Window::ConvertPointToTarget(window, shadow_underlay, &local_point); |
| - return gfx::Rect(shadow_underlay->layer()->size()).Contains(local_point); |
| + gfx::Point local_point_in_shadow = local_point; |
|
reveman
2017/05/30 13:33:55
nit: local_point_in_shadow_underlay as we might re
mtomasz
2017/05/31 01:38:19
Done.
|
| + aura::Window::ConvertPointToTarget(window, shadow_underlay, |
| + &local_point_in_shadow); |
| + if (gfx::Rect(shadow_underlay->layer()->size()) |
| + .Contains(local_point_in_shadow)) |
|
reveman
2017/05/30 13:33:55
nit: use {} when statement and/or conditional code
mtomasz
2017/05/31 01:38:19
Done.
|
| + return true; |
| } |
| + // Otherwise, fallback to hit test on the surface. |
| aura::Window::ConvertPointToTarget(window, surface->window(), &local_point); |
| return surface->HitTestRect(gfx::Rect(local_point, gfx::Size(1, 1))); |
| } |
| @@ -123,7 +128,8 @@ class CustomWindowTargeter : public aura::WindowTargeter { |
| aura::Window* window = static_cast<aura::Window*>(root); |
| Surface* surface = ShellSurface::GetMainSurface(window); |
| - // Send events which are outside of the surface's bounds to the underlay. |
| + // Send events which wouldn't be handled by the surface, to the shadow |
| + // underlay. |
| aura::Window* shadow_underlay = |
| static_cast<ShellSurface*>( |
| widget_->widget_delegate()->GetContentsView()) |
| @@ -131,8 +137,13 @@ class CustomWindowTargeter : public aura::WindowTargeter { |
| if (surface && event->IsLocatedEvent() && shadow_underlay) { |
| gfx::Point local_point = event->AsLocatedEvent()->location(); |
| int component = widget_->non_client_view()->NonClientHitTest(local_point); |
| - if (component == HTNOWHERE) |
| + |
| + aura::Window::ConvertPointToTarget(window, surface->window(), |
| + &local_point); |
| + if (!surface->HitTestRect(gfx::Rect(local_point, gfx::Size(1, 1))) && |
| + component == HTNOWHERE) { |
|
reveman
2017/05/30 13:33:55
nit: please do this "component == HTNOWHERE" check
|
| return shadow_underlay; |
| + } |
| } |
| return aura::WindowTargeter::FindTargetForEvent(root, event); |
| } |