Commit d9be36be authored by tdanderson's avatar tdanderson Committed by Commit bot

Remove aura::Window::hit_test_bounds_override_inner_

The |hit_test_bounds_override_inner_| member of
aura::Window is no longer used, so remove it.
No functional changes.

BUG=344924
TEST=aura_unittests
TBR=varkha@chromium.org

Review-Url: https://codereview.chromium.org/2852653004
Cr-Commit-Position: refs/heads/master@{#468328}
parent 3369956d
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
#include "ui/compositor/layer.h" #include "ui/compositor/layer.h"
#include "ui/compositor/scoped_layer_animation_settings.h" #include "ui/compositor/scoped_layer_animation_settings.h"
#include "ui/gfx/canvas.h" #include "ui/gfx/canvas.h"
#include "ui/gfx/geometry/insets.h"
#include "ui/gfx/image/canvas_image_source.h" #include "ui/gfx/image/canvas_image_source.h"
namespace { namespace {
......
...@@ -728,23 +728,11 @@ Window* Window::GetWindowForPoint(const gfx::Point& local_point, ...@@ -728,23 +728,11 @@ Window* Window::GetWindowForPoint(const gfx::Point& local_point,
bool return_tightest, bool return_tightest,
bool for_event_handling) { bool for_event_handling) {
if (!IsVisible()) if (!IsVisible())
return NULL; return nullptr;
if ((for_event_handling && !HitTest(local_point)) || if ((for_event_handling && !HitTest(local_point)) ||
(!for_event_handling && !ContainsPoint(local_point))) (!for_event_handling && !ContainsPoint(local_point))) {
return NULL; return nullptr;
// Check if I should claim this event and not pass it to my children because
// the location is inside my hit test override area. For details, see
// set_hit_test_bounds_override_inner().
if (for_event_handling && !hit_test_bounds_override_inner_.IsEmpty()) {
gfx::Rect inset_local_bounds(gfx::Point(), bounds().size());
inset_local_bounds.Inset(hit_test_bounds_override_inner_);
// We know we're inside the normal local bounds, so if we're outside the
// inset bounds we must be in the special hit test override area.
DCHECK(HitTest(local_point));
if (!inset_local_bounds.Contains(local_point))
return delegate_ ? this : NULL;
} }
if (!return_tightest && delegate_) if (!return_tightest && delegate_)
...@@ -758,13 +746,16 @@ Window* Window::GetWindowForPoint(const gfx::Point& local_point, ...@@ -758,13 +746,16 @@ Window* Window::GetWindowForPoint(const gfx::Point& local_point,
if (for_event_handling) { if (for_event_handling) {
if (child->ignore_events_) if (child->ignore_events_)
continue; continue;
// The client may not allow events to be processed by certain subtrees. // The client may not allow events to be processed by certain subtrees.
client::EventClient* client = client::GetEventClient(GetRootWindow()); client::EventClient* client = client::GetEventClient(GetRootWindow());
if (client && !client->CanProcessEventsWithinSubtree(child)) if (client && !client->CanProcessEventsWithinSubtree(child))
continue; continue;
if (delegate_ && !delegate_->ShouldDescendIntoChildForEventHandling( if (delegate_ && !delegate_->ShouldDescendIntoChildForEventHandling(
child, local_point)) child, local_point)) {
continue; continue;
}
} }
gfx::Point point_in_child_coords(local_point); gfx::Point point_in_child_coords(local_point);
...@@ -776,7 +767,7 @@ Window* Window::GetWindowForPoint(const gfx::Point& local_point, ...@@ -776,7 +767,7 @@ Window* Window::GetWindowForPoint(const gfx::Point& local_point,
return match; return match;
} }
return delegate_ ? this : NULL; return delegate_ ? this : nullptr;
} }
void Window::RemoveChildImpl(Window* child, Window* new_parent) { void Window::RemoveChildImpl(Window* child, Window* new_parent) {
......
...@@ -27,7 +27,6 @@ ...@@ -27,7 +27,6 @@
#include "ui/events/event_target.h" #include "ui/events/event_target.h"
#include "ui/events/event_targeter.h" #include "ui/events/event_targeter.h"
#include "ui/events/gestures/gesture_types.h" #include "ui/events/gestures/gesture_types.h"
#include "ui/gfx/geometry/insets.h"
#include "ui/gfx/geometry/rect.h" #include "ui/gfx/geometry/rect.h"
#include "ui/gfx/native_widget_types.h" #include "ui/gfx/native_widget_types.h"
#include "ui/wm/public/window_types.h" #include "ui/wm/public/window_types.h"
...@@ -240,16 +239,6 @@ class AURA_EXPORT Window : public ui::LayerDelegate, ...@@ -240,16 +239,6 @@ class AURA_EXPORT Window : public ui::LayerDelegate,
void set_ignore_events(bool ignore_events) { ignore_events_ = ignore_events; } void set_ignore_events(bool ignore_events) { ignore_events_ = ignore_events; }
bool ignore_events() const { return ignore_events_; } bool ignore_events() const { return ignore_events_; }
// Sets the window to grab hits for an area extending |insets| pixels inside
// its bounds (even if that inner region overlaps a child window). This can be
// used to create an invisible non-client area that overlaps the client area.
void set_hit_test_bounds_override_inner(const gfx::Insets& insets) {
hit_test_bounds_override_inner_ = insets;
}
gfx::Insets hit_test_bounds_override_inner() const {
return hit_test_bounds_override_inner_;
}
// Returns true if the |point_in_root| in root window's coordinate falls // Returns true if the |point_in_root| in root window's coordinate falls
// within this window's bounds. Returns false if the window is detached // within this window's bounds. Returns false if the window is detached
// from root window. // from root window.
...@@ -482,9 +471,6 @@ class AURA_EXPORT Window : public ui::LayerDelegate, ...@@ -482,9 +471,6 @@ class AURA_EXPORT Window : public ui::LayerDelegate,
// Makes the window pass all events through to any windows behind it. // Makes the window pass all events through to any windows behind it.
bool ignore_events_; bool ignore_events_;
// See set_hit_test_bounds_override_inner().
gfx::Insets hit_test_bounds_override_inner_;
base::ObserverList<WindowObserver, true> observers_; base::ObserverList<WindowObserver, true> observers_;
DISALLOW_COPY_AND_ASSIGN(Window); DISALLOW_COPY_AND_ASSIGN(Window);
......
...@@ -544,7 +544,7 @@ TEST_P(WindowTest, GetEventHandlerForPoint) { ...@@ -544,7 +544,7 @@ TEST_P(WindowTest, GetEventHandlerForPoint) {
EXPECT_EQ(w13.get(), root->GetEventHandlerForPoint(gfx::Point(26, 481))); EXPECT_EQ(w13.get(), root->GetEventHandlerForPoint(gfx::Point(26, 481)));
} }
TEST_P(WindowTest, GetEventHandlerForPointWithOverride) { TEST_P(WindowTest, GetEventHandlerForPointInCornerOfChildBounds) {
// If our child is flush to our top-left corner it gets events just inside the // If our child is flush to our top-left corner it gets events just inside the
// window edges. // window edges.
std::unique_ptr<Window> parent(CreateTestWindow( std::unique_ptr<Window> parent(CreateTestWindow(
...@@ -553,12 +553,6 @@ TEST_P(WindowTest, GetEventHandlerForPointWithOverride) { ...@@ -553,12 +553,6 @@ TEST_P(WindowTest, GetEventHandlerForPointWithOverride) {
CreateTestWindow(SK_ColorRED, 2, gfx::Rect(0, 0, 60, 70), parent.get())); CreateTestWindow(SK_ColorRED, 2, gfx::Rect(0, 0, 60, 70), parent.get()));
EXPECT_EQ(child.get(), parent->GetEventHandlerForPoint(gfx::Point(0, 0))); EXPECT_EQ(child.get(), parent->GetEventHandlerForPoint(gfx::Point(0, 0)));
EXPECT_EQ(child.get(), parent->GetEventHandlerForPoint(gfx::Point(1, 1))); EXPECT_EQ(child.get(), parent->GetEventHandlerForPoint(gfx::Point(1, 1)));
// We can override the hit test bounds of the parent to make the parent grab
// events along that edge.
parent->set_hit_test_bounds_override_inner(gfx::Insets(1, 1, 1, 1));
EXPECT_EQ(parent.get(), parent->GetEventHandlerForPoint(gfx::Point(0, 0)));
EXPECT_EQ(child.get(), parent->GetEventHandlerForPoint(gfx::Point(1, 1)));
} }
TEST_P(WindowTest, GetEventHandlerForPointWithOverrideDescendingOrder) { TEST_P(WindowTest, GetEventHandlerForPointWithOverrideDescendingOrder) {
......
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
#include "ui/aura/window.h" #include "ui/aura/window.h"
#include "ui/base/ime/input_method.h" #include "ui/base/ime/input_method.h"
#include "ui/base/ime/text_input_client.h" #include "ui/base/ime/text_input_client.h"
#include "ui/gfx/geometry/insets.h"
#include "ui/keyboard/content/keyboard_constants.h" #include "ui/keyboard/content/keyboard_constants.h"
#include "ui/keyboard/keyboard_controller.h" #include "ui/keyboard/keyboard_controller.h"
#include "ui/keyboard/keyboard_switches.h" #include "ui/keyboard/keyboard_switches.h"
......
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