aura: Move Window::ContainsMouse() implementation into the test API.

BUG=none
R=sky@chromium.org

Review URL: https://codereview.chromium.org/602043006

Cr-Commit-Position: refs/heads/master@{#300540}
parent ea649ee1
......@@ -5,6 +5,8 @@
#include "ui/aura/test/window_test_api.h"
#include "ui/aura/window.h"
#include "ui/aura/window_event_dispatcher.h"
#include "ui/aura/window_tree_host.h"
namespace aura {
namespace test {
......@@ -17,7 +19,12 @@ bool WindowTestApi::OwnsLayer() const {
}
bool WindowTestApi::ContainsMouse() const {
return window_->ContainsMouse();
if (!window_->IsVisible())
return false;
WindowTreeHost* host = window_->GetHost();
return host &&
window_->ContainsPointInRoot(
host->dispatcher()->GetLastMouseLocationInRoot());
}
} // namespace test
......
......@@ -1445,16 +1445,6 @@ void Window::UpdateLayerName() {
#endif
}
bool Window::ContainsMouse() {
bool contains_mouse = false;
if (IsVisible()) {
WindowTreeHost* host = GetHost();
contains_mouse = host &&
ContainsPointInRoot(host->dispatcher()->GetLastMouseLocationInRoot());
}
return contains_mouse;
}
const Window* Window::GetAncestorWithLayer(gfx::Vector2d* offset) const {
for (const aura::Window* window = this; window; window = window->parent()) {
if (window->layer())
......
......@@ -470,9 +470,6 @@ class AURA_EXPORT Window : public ui::LayerDelegate,
// Updates the layer name based on the window's name and id.
void UpdateLayerName();
// Returns true if the mouse is currently within our bounds.
bool ContainsMouse();
// Returns the first ancestor (starting at |this|) with a layer. |offset| is
// set to the offset from |this| to the first ancestor with a layer. |offset|
// may be NULL.
......
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