| Index: ui/views/widget/native_widget_aura_unittest.cc
|
| diff --git a/ui/views/widget/native_widget_aura_unittest.cc b/ui/views/widget/native_widget_aura_unittest.cc
|
| index 4d06907e1c48e312a7b2faaf3e24bd23243c7200..3a59c5936a3b7301d67f3575195c86eb374665c1 100644
|
| --- a/ui/views/widget/native_widget_aura_unittest.cc
|
| +++ b/ui/views/widget/native_widget_aura_unittest.cc
|
| @@ -517,6 +517,54 @@ TEST_F(NativeWidgetAuraTest, PreferViewLayersToChildWindows) {
|
| parent->Close();
|
| }
|
|
|
| +// Verifies views with layers are targeted for events properly.
|
| +TEST_F(NativeWidgetAuraTest,
|
| + ShouldDescendIntoChildForEventHandlingChecksVisibleBounds) {
|
| + // Create two widgets: |parent| and |child|. |child| is a child of |parent|.
|
| + View* parent_root_view = new View;
|
| + Widget parent;
|
| + Widget::InitParams parent_params(Widget::InitParams::TYPE_WINDOW_FRAMELESS);
|
| + parent_params.ownership = Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET;
|
| + parent_params.context = root_window();
|
| + parent.Init(parent_params);
|
| + parent.SetContentsView(parent_root_view);
|
| + parent.SetBounds(gfx::Rect(0, 0, 400, 400));
|
| + parent.Show();
|
| +
|
| + Widget child;
|
| + Widget::InitParams child_params(Widget::InitParams::TYPE_CONTROL);
|
| + child_params.ownership = Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET;
|
| + child_params.parent = parent.GetNativeWindow();
|
| + child.Init(child_params);
|
| + child.SetBounds(gfx::Rect(0, 0, 200, 200));
|
| + child.Show();
|
| +
|
| + // Point is over |child|.
|
| + EXPECT_EQ(
|
| + child.GetNativeWindow(),
|
| + parent.GetNativeWindow()->GetEventHandlerForPoint(gfx::Point(50, 50)));
|
| +
|
| + View* parent_root_view_child = new View;
|
| + parent_root_view->AddChildView(parent_root_view_child);
|
| + parent_root_view_child->SetBounds(0, 0, 10, 10);
|
| +
|
| + // Create a View whose layer extends outside the bounds of its parent. Event
|
| + // targetting should only consider the visible bounds.
|
| + View* parent_root_view_child_child = new View;
|
| + parent_root_view_child->AddChildView(parent_root_view_child_child);
|
| + parent_root_view_child_child->SetBounds(0, 0, 100, 100);
|
| + parent_root_view_child_child->SetPaintToLayer();
|
| + parent_root_view_child_child->layer()->parent()->StackAtTop(
|
| + parent_root_view_child_child->layer());
|
| +
|
| + // 20,20 is over |parent_root_view_child_child|'s layer, but not the visible
|
| + // bounds of |parent_root_view_child_child|, so |child| should be the event
|
| + // target.
|
| + EXPECT_EQ(
|
| + child.GetNativeWindow(),
|
| + parent.GetNativeWindow()->GetEventHandlerForPoint(gfx::Point(20, 20)));
|
| +}
|
| +
|
| // Verifies that widget->FlashFrame() sets aura::client::kDrawAttentionKey,
|
| // and activating the window clears it.
|
| TEST_F(NativeWidgetAuraTest, FlashFrame) {
|
|
|