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

Unified Diff: ui/base/gestures/gesture_sequence.cc

Issue 11410024: ui: Remove gfx::Size::ClampToNonNegative, prevent negative sizes always. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: no negative sizes Created 8 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 side-by-side diff with in-line comments
Download patch
Index: ui/base/gestures/gesture_sequence.cc
diff --git a/ui/base/gestures/gesture_sequence.cc b/ui/base/gestures/gesture_sequence.cc
index c4a6d316fa7718f584d9cd3fd22108110c3ef5e4..befae4ed9700a90c9057814a20b10b2c4bc6c174 100644
--- a/ui/base/gestures/gesture_sequence.cc
+++ b/ui/base/gestures/gesture_sequence.cc
@@ -588,6 +588,7 @@ void GestureSequence::RecreateBoundingBox() {
} else {
sadrul 2012/11/12 01:28:02 You can set bounding_box_ to empty when point_coun
danakj 2012/11/12 05:45:56 Done.
int left = INT_MAX / 20, top = INT_MAX / 20;
int right = INT_MIN / 20, bottom = INT_MIN / 20;
+ bool empty_box = true;
for (int i = 0; i < kMaxGesturePoints; ++i) {
if (!points_[i].in_use())
continue;
@@ -600,8 +601,12 @@ void GestureSequence::RecreateBoundingBox() {
right = std::max(right, point.x());
top = std::min(top, point.y());
bottom = std::max(bottom, point.y());
+ empty_box = false;
}
- bounding_box_.SetRect(left, top, right - left, bottom - top);
+ if (empty_box)
+ bounding_box_.SetRect(0, 0, 0, 0);
+ else
+ bounding_box_.SetRect(left, top, right - left, bottom - top);
}
}

Powered by Google App Engine
This is Rietveld 408576698