| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ash/wm/workspace_controller.h" | 5 #include "ash/wm/workspace_controller.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 | 8 |
| 9 #include "ash/root_window_controller.h" | 9 #include "ash/root_window_controller.h" |
| 10 #include "ash/screen_util.h" | 10 #include "ash/screen_util.h" |
| (...skipping 1460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1471 }; | 1471 }; |
| 1472 // Do two iterations, first without any transform on |second|, and the second | 1472 // Do two iterations, first without any transform on |second|, and the second |
| 1473 // time after applying some transform on |second| so that it doesn't get | 1473 // time after applying some transform on |second| so that it doesn't get |
| 1474 // targeted. | 1474 // targeted. |
| 1475 for (int times = 0; times < 2; ++times) { | 1475 for (int times = 0; times < 2; ++times) { |
| 1476 SCOPED_TRACE(times == 0 ? "Without transform" : "With transform"); | 1476 SCOPED_TRACE(times == 0 ? "Without transform" : "With transform"); |
| 1477 aura::Window* expected_target = times == 0 ? second.get() : first.get(); | 1477 aura::Window* expected_target = times == 0 ? second.get() : first.get(); |
| 1478 for (int i = 0; i < kNumPoints; ++i) { | 1478 for (int i = 0; i < kNumPoints; ++i) { |
| 1479 SCOPED_TRACE(points[i].direction); | 1479 SCOPED_TRACE(points[i].direction); |
| 1480 const gfx::Point& location = points[i].location; | 1480 const gfx::Point& location = points[i].location; |
| 1481 ui::MouseEvent mouse(ui::ET_MOUSE_MOVED, location, location, | 1481 ui::MouseEvent mouse( |
| 1482 ui::EventTimeForNow(), ui::EF_NONE, ui::EF_NONE); | 1482 ui::ET_MOUSE_MOVED, location, location, ui::EventTimeForNow(), |
| 1483 ui::EF_NONE, ui::EF_NONE, |
| 1484 ui::PointerEventDetails(ui::EventPointerType::POINTER_TYPE_MOUSE)); |
| 1483 ui::EventTarget* target = targeter->FindTargetForEvent(root, &mouse); | 1485 ui::EventTarget* target = targeter->FindTargetForEvent(root, &mouse); |
| 1484 EXPECT_EQ(expected_target, target); | 1486 EXPECT_EQ(expected_target, target); |
| 1485 | 1487 |
| 1486 ui::TouchEvent touch(ui::ET_TOUCH_PRESSED, location, 0, | 1488 ui::TouchEvent touch(ui::ET_TOUCH_PRESSED, location, 0, |
| 1487 ui::EventTimeForNow()); | 1489 ui::EventTimeForNow()); |
| 1488 target = targeter->FindTargetForEvent(root, &touch); | 1490 target = targeter->FindTargetForEvent(root, &touch); |
| 1489 EXPECT_EQ(expected_target, target); | 1491 EXPECT_EQ(expected_target, target); |
| 1490 } | 1492 } |
| 1491 // Apply a transform on |second|. After the transform is applied, the window | 1493 // Apply a transform on |second|. After the transform is applied, the window |
| 1492 // should no longer be targeted. | 1494 // should no longer be targeted. |
| (...skipping 19 matching lines...) Expand all Loading... |
| 1512 } points[kNumPoints] = { | 1514 } points[kNumPoints] = { |
| 1513 { "left", gfx::Point(bounds.x() - 2, bounds.y() + 10), true }, | 1515 { "left", gfx::Point(bounds.x() - 2, bounds.y() + 10), true }, |
| 1514 { "top", gfx::Point(bounds.x() + 10, bounds.y() - 2), true }, | 1516 { "top", gfx::Point(bounds.x() + 10, bounds.y() - 2), true }, |
| 1515 { "right", gfx::Point(bounds.right() + 2, bounds.y() + 10), true }, | 1517 { "right", gfx::Point(bounds.right() + 2, bounds.y() + 10), true }, |
| 1516 { "bottom", gfx::Point(bounds.x() + 10, bounds.bottom() + 2), true }, | 1518 { "bottom", gfx::Point(bounds.x() + 10, bounds.bottom() + 2), true }, |
| 1517 { "outside", gfx::Point(bounds.x() + 10, bounds.y() - 31), false }, | 1519 { "outside", gfx::Point(bounds.x() + 10, bounds.y() - 31), false }, |
| 1518 }; | 1520 }; |
| 1519 for (int i = 0; i < kNumPoints; ++i) { | 1521 for (int i = 0; i < kNumPoints; ++i) { |
| 1520 SCOPED_TRACE(points[i].direction); | 1522 SCOPED_TRACE(points[i].direction); |
| 1521 const gfx::Point& location = points[i].location; | 1523 const gfx::Point& location = points[i].location; |
| 1522 ui::MouseEvent mouse(ui::ET_MOUSE_MOVED, location, location, | 1524 ui::MouseEvent mouse( |
| 1523 ui::EventTimeForNow(), ui::EF_NONE, ui::EF_NONE); | 1525 ui::ET_MOUSE_MOVED, location, location, ui::EventTimeForNow(), |
| 1526 ui::EF_NONE, ui::EF_NONE, |
| 1527 ui::PointerEventDetails(ui::EventPointerType::POINTER_TYPE_MOUSE)); |
| 1524 ui::EventTarget* target = targeter->FindTargetForEvent(root, &mouse); | 1528 ui::EventTarget* target = targeter->FindTargetForEvent(root, &mouse); |
| 1525 if (points[i].is_target_hit) | 1529 if (points[i].is_target_hit) |
| 1526 EXPECT_EQ(window.get(), target); | 1530 EXPECT_EQ(window.get(), target); |
| 1527 else | 1531 else |
| 1528 EXPECT_NE(window.get(), target); | 1532 EXPECT_NE(window.get(), target); |
| 1529 } | 1533 } |
| 1530 } | 1534 } |
| 1531 | 1535 |
| 1532 // Verifies touch event targeting just outside the window edges for panels. | 1536 // Verifies touch event targeting just outside the window edges for panels. |
| 1533 // The shelf is aligned to the bottom by default, and so touches just below | 1537 // The shelf is aligned to the bottom by default, and so touches just below |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1589 } points[kNumPoints] = { | 1593 } points[kNumPoints] = { |
| 1590 { "left", gfx::Point(bounds.x() - 2, bounds.y() + 10), true }, | 1594 { "left", gfx::Point(bounds.x() - 2, bounds.y() + 10), true }, |
| 1591 { "top", gfx::Point(bounds.x() + 10, bounds.y() - 2), true }, | 1595 { "top", gfx::Point(bounds.x() + 10, bounds.y() - 2), true }, |
| 1592 { "right", gfx::Point(bounds.right() + 2, bounds.y() + 10), true }, | 1596 { "right", gfx::Point(bounds.right() + 2, bounds.y() + 10), true }, |
| 1593 { "bottom", gfx::Point(bounds.x() + 10, bounds.bottom() + 2), true }, | 1597 { "bottom", gfx::Point(bounds.x() + 10, bounds.bottom() + 2), true }, |
| 1594 { "outside", gfx::Point(bounds.x() + 10, bounds.y() - 31), false }, | 1598 { "outside", gfx::Point(bounds.x() + 10, bounds.y() - 31), false }, |
| 1595 }; | 1599 }; |
| 1596 for (int i = 0; i < kNumPoints; ++i) { | 1600 for (int i = 0; i < kNumPoints; ++i) { |
| 1597 SCOPED_TRACE(points[i].direction); | 1601 SCOPED_TRACE(points[i].direction); |
| 1598 const gfx::Point& location = points[i].location; | 1602 const gfx::Point& location = points[i].location; |
| 1599 ui::MouseEvent mouse(ui::ET_MOUSE_MOVED, location, location, | 1603 ui::MouseEvent mouse( |
| 1600 ui::EventTimeForNow(), ui::EF_NONE, ui::EF_NONE); | 1604 ui::ET_MOUSE_MOVED, location, location, ui::EventTimeForNow(), |
| 1605 ui::EF_NONE, ui::EF_NONE, |
| 1606 ui::PointerEventDetails(ui::EventPointerType::POINTER_TYPE_MOUSE)); |
| 1601 ui::EventTarget* target = targeter->FindTargetForEvent(root, &mouse); | 1607 ui::EventTarget* target = targeter->FindTargetForEvent(root, &mouse); |
| 1602 if (points[i].is_target_hit) | 1608 if (points[i].is_target_hit) |
| 1603 EXPECT_EQ(window.get(), target); | 1609 EXPECT_EQ(window.get(), target); |
| 1604 else | 1610 else |
| 1605 EXPECT_NE(window.get(), target); | 1611 EXPECT_NE(window.get(), target); |
| 1606 | 1612 |
| 1607 ui::TouchEvent touch(ui::ET_TOUCH_PRESSED, location, 0, | 1613 ui::TouchEvent touch(ui::ET_TOUCH_PRESSED, location, 0, |
| 1608 ui::EventTimeForNow()); | 1614 ui::EventTimeForNow()); |
| 1609 target = targeter->FindTargetForEvent(root, &touch); | 1615 target = targeter->FindTargetForEvent(root, &touch); |
| 1610 if (points[i].is_target_hit) | 1616 if (points[i].is_target_hit) |
| 1611 EXPECT_EQ(window.get(), target); | 1617 EXPECT_EQ(window.get(), target); |
| 1612 else | 1618 else |
| 1613 EXPECT_NE(window.get(), target); | 1619 EXPECT_NE(window.get(), target); |
| 1614 } | 1620 } |
| 1615 } | 1621 } |
| 1616 | 1622 |
| 1617 } // namespace ash | 1623 } // namespace ash |
| OLD | NEW |