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

Unified Diff: ui/views/controls/textfield/textfield.cc

Issue 265713007: views: Update event-related API to use PointF/RectF instead of Point/Rect. Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: ui/views/controls/textfield/textfield.cc
diff --git a/ui/views/controls/textfield/textfield.cc b/ui/views/controls/textfield/textfield.cc
index 9b20f0c1606fa98e688dcd556c340c91e88c6eb8..fec3991d2da7534764e78a637389eb496a126c4c 100644
--- a/ui/views/controls/textfield/textfield.cc
+++ b/ui/views/controls/textfield/textfield.cc
@@ -937,7 +937,7 @@ void Textfield::ShowContextMenuForView(View* source,
// Textfield, DragController overrides:
void Textfield::WriteDragDataForView(View* sender,
- const gfx::Point& press_pt,
+ const gfx::PointF& press_pt,
OSExchangeData* data) {
const base::string16& selected_text(GetSelectedText());
data->SetString(selected_text);
@@ -964,10 +964,10 @@ void Textfield::WriteDragDataForView(View* sender,
controller_->OnWriteDragData(data);
}
-int Textfield::GetDragOperationsForView(View* sender, const gfx::Point& p) {
+int Textfield::GetDragOperationsForView(View* sender, const gfx::PointF& p) {
int drag_operations = ui::DragDropTypes::DRAG_COPY;
if (!enabled() || text_input_type_ == ui::TEXT_INPUT_TYPE_PASSWORD ||
- !GetRenderText()->IsPointInSelection(p)) {
+ !GetRenderText()->IsPointInSelection(gfx::ToFlooredPoint(p))) {
drag_operations = ui::DragDropTypes::DRAG_NONE;
} else if (sender == this && !read_only()) {
drag_operations =
@@ -979,9 +979,10 @@ int Textfield::GetDragOperationsForView(View* sender, const gfx::Point& p) {
}
bool Textfield::CanStartDragForView(View* sender,
- const gfx::Point& press_pt,
- const gfx::Point& p) {
- return initiating_drag_ && GetRenderText()->IsPointInSelection(press_pt);
+ const gfx::PointF& press_pt,
+ const gfx::PointF& p) {
+ return initiating_drag_ &&
+ GetRenderText()->IsPointInSelection(gfx::ToFlooredPoint(press_pt));
}
////////////////////////////////////////////////////////////////////////////////

Powered by Google App Engine
This is Rietveld 408576698