Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(86)

Unified Diff: ui/views/view.cc

Issue 381323002: [rough WIP] Make View::GetEventHandlerForRect() non-virtual (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ui/views/view.cc
diff --git a/ui/views/view.cc b/ui/views/view.cc
index 3809c1e73250005d9607e065292d14316ff57e81..ef43e348c1b85fbb3b04a6a25a9e3f726839e851 100644
--- a/ui/views/view.cc
+++ b/ui/views/view.cc
@@ -28,7 +28,7 @@
#include "ui/gfx/path.h"
#include "ui/gfx/point3_f.h"
#include "ui/gfx/point_conversions.h"
-#include "ui/gfx/rect_conversions.h"
+//#include "ui/gfx/rect_conversions.h"
#include "ui/gfx/scoped_canvas.h"
#include "ui/gfx/screen.h"
#include "ui/gfx/skia_util.h"
@@ -41,7 +41,7 @@
#include "ui/views/drag_controller.h"
#include "ui/views/focus/view_storage.h"
#include "ui/views/layout/layout_manager.h"
-#include "ui/views/rect_based_targeting_utils.h"
+//#include "ui/views/rect_based_targeting_utils.h"
#include "ui/views/views_delegate.h"
#include "ui/views/widget/native_widget_private.h"
#include "ui/views/widget/root_view.h"
@@ -60,11 +60,6 @@ const bool kContextMenuOnMousePress = false;
const bool kContextMenuOnMousePress = true;
#endif
-// The minimum percentage of a view's area that needs to be covered by a rect
-// representing a touch region in order for that view to be considered by the
-// rect-based targeting algorithm.
-static const float kRectTargetOverlap = 0.6f;
-
// Default horizontal drag threshold in pixels.
// Same as what gtk uses.
const int kDefaultHorizontalDragThreshold = 8;
@@ -835,6 +830,14 @@ View* View::GetEventHandlerForPoint(const gfx::Point& point) {
}
View* View::GetEventHandlerForRect(const gfx::Rect& rect) {
+ // Terry - make a helper for this logic
+ ViewTargeter* view_targeter = targeter();
+ if (!view_targeter)
+ view_targeter = GetWidget()->GetRootView()->targeter();
+ CHECK(view_targeter);
+ return view_targeter->TargetForRect(this, rect);
+
+ /*
// |rect_view| represents the current best candidate to return
// if rect-based targeting (i.e., fuzzing) is used.
// |rect_view_distance| is used to keep track of the distance
@@ -906,6 +909,7 @@ View* View::GetEventHandlerForRect(const gfx::Rect& rect) {
}
return rect_view ? rect_view : point_view;
+ */
}
bool View::CanProcessEventsWithinSubtree() const {
@@ -948,35 +952,11 @@ bool View::HitTestPoint(const gfx::Point& point) const {
}
bool View::HitTestRect(const gfx::Rect& rect) const {
- // If no ViewTargeter is installed on |this|, use the ViewTargeter installed
- // on our root view instead.
ViewTargeter* view_targeter = targeter();
if (!view_targeter)
view_targeter = GetWidget()->GetRootView()->targeter();
CHECK(view_targeter);
-
- // TODO(tdanderson): The check for !HasHitTestMask() is temporary. Remove
- // the check along with the duplicated code below once all
- // of the masked views subclass MaskedViewDelegate.
- // HasHitTestMask() and GetHitTestMaskDeprecated() can also
- // be removed from the View interface at that time.
- if (!HasHitTestMask())
- return view_targeter->DoesIntersectRect(this, rect);
-
- if (GetLocalBounds().Intersects(rect)) {
- gfx::Path mask;
- HitTestSource source = HIT_TEST_SOURCE_MOUSE;
- if (!views::UsePointBasedTargeting(rect))
- source = HIT_TEST_SOURCE_TOUCH;
- GetHitTestMaskDeprecated(source, &mask);
- SkRegion clip_region;
- clip_region.setRect(0, 0, width(), height());
- SkRegion mask_region;
- return mask_region.setPath(mask, clip_region) &&
- mask_region.intersects(RectToSkIRect(rect));
- }
- // Outside our bounds.
- return false;
+ return view_targeter->DoesIntersectRect(this, rect);
}
bool View::IsMouseHovered() {
@@ -1592,15 +1572,6 @@ void View::ReorderChildLayers(ui::Layer* parent_layer) {
// Input -----------------------------------------------------------------------
-bool View::HasHitTestMask() const {
- return false;
-}
-
-void View::GetHitTestMaskDeprecated(HitTestSource source,
- gfx::Path* mask) const {
- DCHECK(mask);
-}
-
View::DragInfo* View::GetDragInfo() {
return parent_ ? parent_->GetDragInfo() : NULL;
}
« no previous file with comments | « ui/views/view.h ('k') | ui/views/view_targeter.h » ('j') | ui/views/view_targeter.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698