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

Side by Side Diff: ui/views/touchui/touch_selection_controller_impl.cc

Issue 1440593004: Make operators on scoped_ptr match the ones defined for std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: scopedptrequals: followupfix-after-rebase Created 5 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
« no previous file with comments | « ui/views/controls/webview/webview.cc ('k') | ui/views/view_unittest.cc » ('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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/touchui/touch_selection_controller_impl.h" 5 #include "ui/views/touchui/touch_selection_controller_impl.h"
6 6
7 #include "base/metrics/histogram_macros.h" 7 #include "base/metrics/histogram_macros.h"
8 #include "base/time/time.h" 8 #include "base/time/time.h"
9 #include "ui/aura/client/cursor_client.h" 9 #include "ui/aura/client/cursor_client.h"
10 #include "ui/aura/env.h" 10 #include "ui/aura/env.h"
(...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after
497 // Temporary fix for selection handle going outside a window. On a webpage, 497 // Temporary fix for selection handle going outside a window. On a webpage,
498 // the page should scroll if the selection handle is dragged outside the 498 // the page should scroll if the selection handle is dragged outside the
499 // window. That does not happen currently. So we just hide the handle for 499 // window. That does not happen currently. So we just hide the handle for
500 // now. 500 // now.
501 // TODO(varunjain): Fix this: crbug.com/269003 501 // TODO(varunjain): Fix this: crbug.com/269003
502 dragging_handle_->SetDrawInvisible(!ShouldShowHandleFor(focus)); 502 dragging_handle_->SetDrawInvisible(!ShouldShowHandleFor(focus));
503 503
504 if (dragging_handle_ != cursor_handle_.get()) { 504 if (dragging_handle_ != cursor_handle_.get()) {
505 // The non-dragging-handle might have recently become visible. 505 // The non-dragging-handle might have recently become visible.
506 EditingHandleView* non_dragging_handle = selection_handle_1_.get(); 506 EditingHandleView* non_dragging_handle = selection_handle_1_.get();
507 if (dragging_handle_ == selection_handle_1_) { 507 if (dragging_handle_ == selection_handle_1_.get()) {
508 non_dragging_handle = selection_handle_2_.get(); 508 non_dragging_handle = selection_handle_2_.get();
509 // if handle 1 is being dragged, it is corresponding to the end of 509 // if handle 1 is being dragged, it is corresponding to the end of
510 // selection and the other handle to the start of selection. 510 // selection and the other handle to the start of selection.
511 selection_bound_1_ = screen_bound_focus; 511 selection_bound_1_ = screen_bound_focus;
512 selection_bound_2_ = screen_bound_anchor; 512 selection_bound_2_ = screen_bound_anchor;
513 selection_bound_1_clipped_ = screen_bound_focus_clipped; 513 selection_bound_1_clipped_ = screen_bound_focus_clipped;
514 selection_bound_2_clipped_ = screen_bound_anchor_clipped; 514 selection_bound_2_clipped_ = screen_bound_anchor_clipped;
515 } 515 }
516 SetHandleBound(non_dragging_handle, anchor, screen_bound_anchor_clipped); 516 SetHandleBound(non_dragging_handle, anchor, screen_bound_anchor_clipped);
517 } 517 }
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
560 gfx::Point drag_pos_in_client = drag_pos; 560 gfx::Point drag_pos_in_client = drag_pos;
561 ConvertPointToClientView(dragging_handle_, &drag_pos_in_client); 561 ConvertPointToClientView(dragging_handle_, &drag_pos_in_client);
562 562
563 if (dragging_handle_ == cursor_handle_.get()) { 563 if (dragging_handle_ == cursor_handle_.get()) {
564 client_view_->MoveCaretTo(drag_pos_in_client); 564 client_view_->MoveCaretTo(drag_pos_in_client);
565 return; 565 return;
566 } 566 }
567 567
568 // Find the stationary selection handle. 568 // Find the stationary selection handle.
569 ui::SelectionBound anchor_bound = 569 ui::SelectionBound anchor_bound =
570 selection_handle_1_ == dragging_handle_ ? selection_bound_2_ 570 selection_handle_1_.get() == dragging_handle_ ? selection_bound_2_
571 : selection_bound_1_; 571 : selection_bound_1_;
572 572
573 // Find selection end points in client_view's coordinate system. 573 // Find selection end points in client_view's coordinate system.
574 gfx::Point p2 = anchor_bound.edge_top_rounded(); 574 gfx::Point p2 = anchor_bound.edge_top_rounded();
575 p2.Offset(0, anchor_bound.GetHeight() / 2); 575 p2.Offset(0, anchor_bound.GetHeight() / 2);
576 client_view_->ConvertPointFromScreen(&p2); 576 client_view_->ConvertPointFromScreen(&p2);
577 577
578 // Instruct client_view to select the region between p1 and p2. The position 578 // Instruct client_view to select the region between p1 and p2. The position
579 // of |fixed_handle| is the start and that of |dragging_handle| is the end 579 // of |fixed_handle| is the start and that of |dragging_handle| is the end
580 // of selection. 580 // of selection.
581 client_view_->SelectRect(p2, drag_pos_in_client); 581 client_view_->SelectRect(p2, drag_pos_in_client);
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
770 770
771 views::WidgetDelegateView* TouchSelectionControllerImpl::GetHandle1View() { 771 views::WidgetDelegateView* TouchSelectionControllerImpl::GetHandle1View() {
772 return selection_handle_1_.get(); 772 return selection_handle_1_.get();
773 } 773 }
774 774
775 views::WidgetDelegateView* TouchSelectionControllerImpl::GetHandle2View() { 775 views::WidgetDelegateView* TouchSelectionControllerImpl::GetHandle2View() {
776 return selection_handle_2_.get(); 776 return selection_handle_2_.get();
777 } 777 }
778 778
779 } // namespace views 779 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/controls/webview/webview.cc ('k') | ui/views/view_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698