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

Side by Side Diff: ui/base/gestures/gesture_sequence.cc

Issue 11359194: Revert 167255 - ui: Remove gfx::Size::ClampToNonNegative, prevent negative sizes always. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: 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 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/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 565 matching lines...) Expand 10 before | Expand all | Expand 10 after
576 pinch_distance_current_ = BoundingBoxDiagonal(bounding_box_); 576 pinch_distance_current_ = BoundingBoxDiagonal(bounding_box_);
577 pinch_distance_start_ = pinch_distance_current_; 577 pinch_distance_start_ = pinch_distance_current_;
578 } 578 }
579 } 579 }
580 return gestures.release(); 580 return gestures.release();
581 } 581 }
582 582
583 void GestureSequence::RecreateBoundingBox() { 583 void GestureSequence::RecreateBoundingBox() {
584 // TODO(sad): Recreating the bounding box at every touch-event is not very 584 // TODO(sad): Recreating the bounding box at every touch-event is not very
585 // efficient. This should be made better. 585 // efficient. This should be made better.
586 if (point_count_ == 0) { 586 if (point_count_ == 1) {
587 bounding_box_.SetRect(0, 0, 0, 0);
588 } else if (point_count_ == 1) {
589 bounding_box_ = GetPointByPointId(0)->enclosing_rectangle(); 587 bounding_box_ = GetPointByPointId(0)->enclosing_rectangle();
590 } else { 588 } else {
591 int left = INT_MAX / 20, top = INT_MAX / 20; 589 int left = INT_MAX / 20, top = INT_MAX / 20;
592 int right = INT_MIN / 20, bottom = INT_MIN / 20; 590 int right = INT_MIN / 20, bottom = INT_MIN / 20;
593 for (int i = 0; i < kMaxGesturePoints; ++i) { 591 for (int i = 0; i < kMaxGesturePoints; ++i) {
594 if (!points_[i].in_use()) 592 if (!points_[i].in_use())
595 continue; 593 continue;
596 // Using the |enclosing_rectangle()| for the touch-points would be ideal. 594 // Using the |enclosing_rectangle()| for the touch-points would be ideal.
597 // However, this becomes brittle especially when a finger is in motion 595 // However, this becomes brittle especially when a finger is in motion
598 // because the change in radius can overshadow the actual change in 596 // because the change in radius can overshadow the actual change in
(...skipping 574 matching lines...) Expand 10 before | Expand all | Expand 10 after
1173 return; 1171 return;
1174 1172
1175 // Since long press timer has been started, there should be a non-NULL point. 1173 // Since long press timer has been started, there should be a non-NULL point.
1176 const GesturePoint* point = GetPointByPointId(0); 1174 const GesturePoint* point = GetPointByPointId(0);
1177 if (!ui::gestures::IsInsideManhattanSquare(point->first_touch_position(), 1175 if (!ui::gestures::IsInsideManhattanSquare(point->first_touch_position(),
1178 event.location())) 1176 event.location()))
1179 GetLongPressTimer()->Stop(); 1177 GetLongPressTimer()->Stop();
1180 } 1178 }
1181 1179
1182 } // namespace ui 1180 } // 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