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

Side by Side Diff: ui/views/controls/textfield/native_textfield_views.cc

Issue 11269022: Add Vector2d classes that represent offsets, instead of using Point. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: more vector use fixes 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
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/views/controls/textfield/native_textfield_views.h" 5 #include "ui/views/controls/textfield/native_textfield_views.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <set> 8 #include <set>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 // TODO: Remove once NativeTextfield implementations are consolidated to 105 // TODO: Remove once NativeTextfield implementations are consolidated to
106 // Textfield. 106 // Textfield.
107 if (!textfield_->OnMousePressed(event)) 107 if (!textfield_->OnMousePressed(event))
108 HandleMousePressEvent(event); 108 HandleMousePressEvent(event);
109 OnAfterUserAction(); 109 OnAfterUserAction();
110 return true; 110 return true;
111 } 111 }
112 112
113 bool NativeTextfieldViews::ExceededDragThresholdFromLastClickLocation( 113 bool NativeTextfieldViews::ExceededDragThresholdFromLastClickLocation(
114 const ui::MouseEvent& event) { 114 const ui::MouseEvent& event) {
115 gfx::Point location_delta = event.location().Subtract(last_click_location_); 115 gfx::Vector2d location_delta = event.location() - last_click_location_;
116 return ExceededDragThreshold(location_delta.x(), location_delta.y()); 116 return ExceededDragThreshold(location_delta.x(), location_delta.y());
Peter Kasting 2012/10/30 01:14:14 This may be another function that makes sense to c
danakj 2012/10/30 19:21:21 Ya for sure. Changed the method. This was a really
117 } 117 }
118 118
119 bool NativeTextfieldViews::OnMouseDragged(const ui::MouseEvent& event) { 119 bool NativeTextfieldViews::OnMouseDragged(const ui::MouseEvent& event) {
120 // Don't adjust the cursor on a potential drag and drop, or if the mouse 120 // Don't adjust the cursor on a potential drag and drop, or if the mouse
121 // movement from the last mouse click does not exceed the drag threshold. 121 // movement from the last mouse click does not exceed the drag threshold.
122 if (initiating_drag_ || !ExceededDragThresholdFromLastClickLocation(event)) 122 if (initiating_drag_ || !ExceededDragThresholdFromLastClickLocation(event))
123 return true; 123 return true;
124 124
125 OnBeforeUserAction(); 125 OnBeforeUserAction();
126 // TODO: Remove once NativeTextfield implementations are consolidated to 126 // TODO: Remove once NativeTextfield implementations are consolidated to
(...skipping 1106 matching lines...) Expand 10 before | Expand all | Expand 10 after
1233 // Filter out all control characters, including tab and new line characters, 1233 // Filter out all control characters, including tab and new line characters,
1234 // and all characters with Alt modifier. But we need to allow characters with 1234 // and all characters with Alt modifier. But we need to allow characters with
1235 // AltGr modifier. 1235 // AltGr modifier.
1236 // On Windows AltGr is represented by Alt+Ctrl, and on Linux it's a different 1236 // On Windows AltGr is represented by Alt+Ctrl, and on Linux it's a different
1237 // flag that we don't care about. 1237 // flag that we don't care about.
1238 return ((ch >= 0x20 && ch < 0x7F) || ch > 0x9F) && 1238 return ((ch >= 0x20 && ch < 0x7F) || ch > 0x9F) &&
1239 (flags & ~(ui::EF_SHIFT_DOWN | ui::EF_CAPS_LOCK_DOWN)) != ui::EF_ALT_DOWN; 1239 (flags & ~(ui::EF_SHIFT_DOWN | ui::EF_CAPS_LOCK_DOWN)) != ui::EF_ALT_DOWN;
1240 } 1240 }
1241 1241
1242 } // namespace views 1242 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698