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

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

Issue 32463003: Modify hit test masks for tabs and tab close buttons (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: HitTestSource moved Created 7 years, 1 month 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
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 #ifndef UI_RECT_BASED_TARGETING_UTILS_H_ 5 #ifndef UI_RECT_BASED_TARGETING_UTILS_H_
6 #define UI_RECT_BASED_TARGETING_UTILS_H_ 6 #define UI_RECT_BASED_TARGETING_UTILS_H_
7 7
8 #include "ui/views/views_export.h" 8 #include "ui/views/views_export.h"
9 9
10 namespace gfx { 10 namespace gfx {
11 class Point; 11 class Point;
12 class Rect; 12 class Rect;
13 } 13 }
14 14
15 namespace views { 15 namespace views {
16 16
17 // Specifies the source of the region used in a hit test.
18 // HIT_TEST_SOURCE_MOUSE indicates the hit test is being performed with a
19 // single point and HIT_TEST_SOURCE_TOUCH indicates the hit test is being
20 // performed with a rect larger than a single point. This value can be used,
21 // for example, to add extra padding or change the shape of the hit test mask.
22 enum HitTestSource {
Ben Goodger (Google) 2013/11/04 20:14:04 just go ahead and inline this into View now, as yo
tdanderson 2013/11/04 20:36:07 Done.
23 HIT_TEST_SOURCE_MOUSE,
24 HIT_TEST_SOURCE_TOUCH
25 };
26
17 // Returns true if |rect| is 1x1. 27 // Returns true if |rect| is 1x1.
18 VIEWS_EXPORT bool UsePointBasedTargeting(const gfx::Rect& rect); 28 VIEWS_EXPORT bool UsePointBasedTargeting(const gfx::Rect& rect);
19 29
20 // Returns the percentage of |rect_1|'s area that is covered by |rect_2|. 30 // Returns the percentage of |rect_1|'s area that is covered by |rect_2|.
21 VIEWS_EXPORT float PercentCoveredBy(const gfx::Rect& rect_1, 31 VIEWS_EXPORT float PercentCoveredBy(const gfx::Rect& rect_1,
22 const gfx::Rect& rect_2); 32 const gfx::Rect& rect_2);
23 33
24 // Returns the square of the distance from |point| to the center line of 34 // Returns the square of the distance from |point| to the center line of
25 // |rect|. The center line of a rectangle is obtained by repeatedly 35 // |rect|. The center line of a rectangle is obtained by repeatedly
26 // stripping away 1px borders around the rectangle until a line remains. 36 // stripping away 1px borders around the rectangle until a line remains.
27 VIEWS_EXPORT int DistanceSquaredFromCenterLineToPoint(const gfx::Point& point, 37 VIEWS_EXPORT int DistanceSquaredFromCenterLineToPoint(const gfx::Point& point,
28 const gfx::Rect& rect); 38 const gfx::Rect& rect);
29 39
30 } // namespace views 40 } // namespace views
31 41
32 #endif // UI_RECT_BASED_TARGETING_UTILS_H_ 42 #endif // UI_RECT_BASED_TARGETING_UTILS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698