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

Side by Side 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: negative-width Created 7 years, 11 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
« no previous file with comments | « chrome/browser/ui/extensions/shell_window.cc ('k') | ui/gfx/rect_f.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #include "ui/base/gestures/gesture_sequence.h" 5 #include "ui/base/gestures/gesture_sequence.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 #include <stdlib.h> 8 #include <stdlib.h>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 519 matching lines...) Expand 10 before | Expand all | Expand 10 after
530 pinch_distance_current_ = BoundingBoxDiagonal(bounding_box_); 530 pinch_distance_current_ = BoundingBoxDiagonal(bounding_box_);
531 pinch_distance_start_ = pinch_distance_current_; 531 pinch_distance_start_ = pinch_distance_current_;
532 } 532 }
533 } 533 }
534 return gestures.release(); 534 return gestures.release();
535 } 535 }
536 536
537 void GestureSequence::RecreateBoundingBox() { 537 void GestureSequence::RecreateBoundingBox() {
538 // TODO(sad): Recreating the bounding box at every touch-event is not very 538 // TODO(sad): Recreating the bounding box at every touch-event is not very
539 // efficient. This should be made better. 539 // efficient. This should be made better.
540 if (point_count_ == 1) { 540 if (point_count_ == 0) {
541 bounding_box_.SetRect(0, 0, 0, 0);
542 } else if (point_count_ == 1) {
541 bounding_box_ = GetPointByPointId(0)->enclosing_rectangle(); 543 bounding_box_ = GetPointByPointId(0)->enclosing_rectangle();
542 } else { 544 } else {
543 int left = INT_MAX / 20, top = INT_MAX / 20; 545 int left = INT_MAX / 20, top = INT_MAX / 20;
544 int right = INT_MIN / 20, bottom = INT_MIN / 20; 546 int right = INT_MIN / 20, bottom = INT_MIN / 20;
545 for (int i = 0; i < kMaxGesturePoints; ++i) { 547 for (int i = 0; i < kMaxGesturePoints; ++i) {
546 if (!points_[i].in_use()) 548 if (!points_[i].in_use())
547 continue; 549 continue;
548 // Using the |enclosing_rectangle()| for the touch-points would be ideal. 550 // Using the |enclosing_rectangle()| for the touch-points would be ideal.
549 // However, this becomes brittle especially when a finger is in motion 551 // However, this becomes brittle especially when a finger is in motion
550 // because the change in radius can overshadow the actual change in 552 // because the change in radius can overshadow the actual change in
(...skipping 571 matching lines...) Expand 10 before | Expand all | Expand 10 after
1122 return; 1124 return;
1123 1125
1124 // Since long press timer has been started, there should be a non-NULL point. 1126 // Since long press timer has been started, there should be a non-NULL point.
1125 const GesturePoint* point = GetPointByPointId(0); 1127 const GesturePoint* point = GetPointByPointId(0);
1126 if (!ui::gestures::IsInsideManhattanSquare(point->first_touch_position(), 1128 if (!ui::gestures::IsInsideManhattanSquare(point->first_touch_position(),
1127 event.location())) 1129 event.location()))
1128 GetLongPressTimer()->Stop(); 1130 GetLongPressTimer()->Stop();
1129 } 1131 }
1130 1132
1131 } // namespace ui 1133 } // namespace ui
OLDNEW
« no previous file with comments | « chrome/browser/ui/extensions/shell_window.cc ('k') | ui/gfx/rect_f.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698