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

Side by Side Diff: ui/views/rect_based_targeting_utils.h

Issue 22891016: Add support for rect-based event targeting in views (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: comments addressed, moved fuzzing utility functions to new file Created 7 years, 2 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef UI_RECT_BASED_TARGETING_UTILS_H_
sky 2013/10/08 20:01:12 Since this is all touch based, how about touch_tar
tdanderson 2013/10/09 21:42:06 My preference would be to use point/rect instead o
6 #define UI_RECT_BASED_TARGETING_UTILS_H_
7
8 #include "ui/gfx/point.h"
9 #include "ui/gfx/rect.h"
10 #include "ui/views/views_export.h"
11
12 namespace views {
13
14 // Returns true if |rect| is 1x1.
15 VIEWS_EXPORT bool UsePointBasedTargeting(const gfx::Rect& rect);
16
17 // Returns the percentage of |rect_1|'s area that is covered by |rect_2|.
18 VIEWS_EXPORT float PercentCoveredBy(const gfx::Rect& rect_1,
19 const gfx::Rect& rect_2);
20
21 // Returns the square of the distance from |point| to the center line of
22 // |rect|. The center line of a rectangle is obtained by repeatedly
23 // stripping away 1px borders around the rectangle until a line remains.
24 VIEWS_EXPORT int DistanceSquaredFromCenterLineToPoint(const gfx::Point& point,
25 const gfx::Rect& rect);
26
27 } // namespace views
28
29 #endif // UI_RECT_BASED_TARGETING_UTILS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698